Skip to content

Commit

Permalink
New build system working for safari
Browse files Browse the repository at this point in the history
  • Loading branch information
greneholt committed Sep 21, 2013
1 parent 088856f commit d243c45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
15 changes: 2 additions & 13 deletions build.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,10 @@ if task == 'safari'
(cb) ->
async.parallel [
(cb) ->
b.concat [
'src/util.js'
'safari/inject.coffee'
'src/player.js'
'src/inject.js'
]
, 'build/YouTube5.safariextension/inject.js', cb
b.concat '{src/{util,player,inject}.js,safari/inject.coffee}', 'build/YouTube5.safariextension/inject.js', cb

(cb) ->
b.concat [
'src/util.js'
'src/main.js'
'safari/main.coffee'
]
, 'build/YouTube5.safariextension/main.js', cb
b.concat '{src/{util,main,providers/*}.js,safari/main.coffee}', 'build/YouTube5.safariextension/main.js', cb

(cb) ->
b.globCopy 'assets/*', 'build/YouTube5.safariextension', cb
Expand Down
22 changes: 12 additions & 10 deletions buildutils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ path = require 'path'

module.exports = utils = {}

utils.concat = (fileList, dest, callback) ->
async.map fileList, (filePath, cb) ->
fs.readFile filePath, FILE_ENCODING, (err, src) ->
return cb err if err
src = coffee.compile src, {bare: yes} if coffee.helpers.isCoffee(filePath)
cb null, src
, (err, fileContents) ->
utils.concat = (pattern, dest, callback) ->
glob pattern, (err, matches) ->
return callback err if err
fs.writeFile dest, fileContents.join(EOL), FILE_ENCODING, (err) ->
async.map matches, (filePath, cb) ->
fs.readFile filePath, FILE_ENCODING, (err, src) ->
return cb err if err
src = coffee.compile src, {bare: yes} if coffee.helpers.isCoffee(filePath)
cb null, src
, (err, fileContents) ->
return callback err if err
console.log "Built #{dest}"
callback()
fs.writeFile dest, fileContents.join(EOL), FILE_ENCODING, (err) ->
return callback err if err
console.log "Concat #{matches.join(', ')} -> #{dest}"
callback()

utils.globCopy = (pattern, destDir, callback) ->
glob pattern, (err, matches) ->
Expand Down
6 changes: 1 addition & 5 deletions safari/global.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<!DOCTYPE html><html><head><title>YouTube5</title>
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="providers/youtube.js"></script>
<script type="text/javascript" src="providers/vimeo.js"></script>
<script type="text/javascript" src="providers/facebook.js"></script>
<script type="text/javascript" src="main.js"></script>2
</head><body></body></html>

0 comments on commit d243c45

Please sign in to comment.