aboutsummaryrefslogtreecommitdiffstats
path: root/Cakefile
diff options
context:
space:
mode:
authorJez Ng2012-06-22 00:25:12 -0700
committerJez Ng2012-06-22 00:30:46 -0700
commit60a11b405f5939207847f245e73f2798eecfc223 (patch)
treeac6da31abe63741e8a826d73d6286a6916833387 /Cakefile
parent44425f177608f1fc8c82a5301f2c11b9b9e050ff (diff)
downloadvimium-60a11b405f5939207847f245e73f2798eecfc223.tar.bz2
Add 'package' cake task.
Diffstat (limited to 'Cakefile')
-rw-r--r--Cakefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Cakefile b/Cakefile
index 04ef8985..75646be2 100644
--- a/Cakefile
+++ b/Cakefile
@@ -1,6 +1,12 @@
fs = require "fs"
{spawn, exec} = require "child_process"
+spawn_with_opts = (proc_name, opts) ->
+ opt_array = []
+ for key, value of opts
+ opt_array.push "--#{key}=#{value}"
+ spawn proc_name, opt_array
+
src_directories = ["tests", "background_scripts", "content_scripts", "lib"]
task "build", "compile all coffeescript files to javascript", ->
@@ -17,6 +23,25 @@ task "autobuild", "continually rebuild coffeescript files using coffee --watch",
coffee = spawn "coffee", ["-cw"].concat(src_directories)
coffee.stdout.on "data", (data) -> console.log data.toString().trim()
+task "package", "build .crx file", ->
+ invoke "build"
+
+ # ugly hack to modify our manifest file on-the-fly
+ orig_manifest_text = fs.readFileSync "manifest.json"
+ manifest = JSON.parse orig_manifest_text
+ manifest.update_url = "http://philc.github.com/vimium/updates.xml"
+ fs.writeFileSync "manifest.json", JSON.stringify manifest
+
+ crxmake = spawn_with_opts "crxmake"
+ "pack-extension": "."
+ "pack-extension-key": "vimium.pem"
+ "extension-output": "vimium-latest.crx"
+ "ignore-file": "(^\\.|\\.(coffee|crx|pem|un~)$)"
+ "ignore-dir": "^(\\.|test)"
+
+ crxmake.stdout.on "data", (data) -> console.log data.toString().trim()
+ crxmake.stdout.on "exit", -> fs.writeFileSync "manifest.json", orig_manifest_text
+
task "test", "run all unit tests", ->
test_files = fs.readdirSync("tests/").filter((filename) -> filename.indexOf("_test.js") > 0)
test_files = test_files.map((filename) -> "tests/" + filename)