Cake task: ugrade. Close #256

This commit is contained in:
Nicolas Stepien 2012-03-03 18:39:23 +01:00
parent 5ff3878360
commit bf18a4b06b
3 changed files with 24 additions and 3 deletions

View File

@ -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) ->

View File

@ -1 +1 @@
postMessage({version:'2.28.0'},'*');
postMessage({version:'2.28.0'},'*')

View File

@ -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`