From bf18a4b06b656ec8fedc3d76a7d47caf218f8a6f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 3 Mar 2012 18:39:23 +0100 Subject: [PATCH] Cake task: ugrade. Close #256 --- Cakefile | 24 ++++++++++++++++++++++-- latest.js | 2 +- readme.md | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Cakefile b/Cakefile index aa2716dd6..66bf02cca 100644 --- a/Cakefile +++ b/Cakefile @@ -81,8 +81,28 @@ HEADER = """ """ -INFILE = 'script.coffee' -OUTFILE = '4chan_x.user.js' +CAKEFILE = 'Cakefile' +INFILE = 'script.coffee' +OUTFILE = '4chan_x.user.js' +CHANGELOG = 'changelog' +LATEST = 'latest.js' + +option '-v', '--version [version]', 'Upgrade version.' + +task 'upgrade', (options) -> + {version} = options + unless version + return + fs.writeFile LATEST, "postMessage({version:'#{version}'},'*')" + for file in [CAKEFILE, INFILE] + data = fs.readFileSync file, 'utf8' + fs.writeFile file, data.replace(/^VERSION = .+/m, "VERSION = '#{version}'") + data = fs.readFileSync CHANGELOG, 'utf8' + fs.writeFile CHANGELOG, data.replace('master', "master\n\n#{version}") + exec 'cake build' + exec "git commit -am 'Release #{version}.'" + exec "git tag -a #{version} -m '#{version}'" + exec "git tag -af stable -m '#{version}'" task 'build', -> exec 'coffee --print script.coffee', (err, stdout, stderr) -> diff --git a/latest.js b/latest.js index 337aa53b1..37b46db7e 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.28.0'},'*'); +postMessage({version:'2.28.0'},'*') \ No newline at end of file diff --git a/readme.md b/readme.md index 5ef6356a9..f4d43ed9f 100644 --- a/readme.md +++ b/readme.md @@ -7,3 +7,4 @@ - Clone 4chan X. - `cd` into it and build with `cake build`. - For development (continuous builds), run `cake dev &`. Kill the process with `killall node`. +- Upgrade version with `cake -v VERSION upgrade`