Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (28 sloc) 1.286 kb
{log} = console
{exec} = require 'child_process'
fs = require 'fs'
STYLE = 'style.css'
SCRIPT = 'OneeChan.user.js'
CHANGELOG = 'CHANGELOG'
option '-o', '--output [DIR]', 'Specify output location.'
task 'build', (options) ->
OUTPUT = options.output || SCRIPT
css = fs.readFileSync STYLE, 'utf8'
css = css.replace /(\/\*[^\*]+\*\/|\t|\r|\n|\s{4})/g, ''
css = css.replace /;}/g, '}'
css = css.replace /\s(\+|\?|:|(?:!|=)==)(?:\s|\n)/g, '$1'
ujs = fs.readFileSync SCRIPT, 'utf8'
fs.writeFileSync OUTPUT, ujs.replace /css\s=.+;/, "css = \"#{css}\";", 'utf8', (err) ->
throw err if err
log 'Build Successful!'
option '-v', '--version [VERSION]', 'Release a new version.'
task 'release', (options) ->
{version} = options
return log 'ERROR! No version provided.' unless version
data = fs.readFileSync SCRIPT, 'utf8'
fs.writeFileSync SCRIPT, data.replace /(\/\s@version\s+|VERSION\s+=\s\")[\d\.]+/g, "$1#{version}", 'utf8', (err) ->
throw err if err
data = fs.readFileSync CHANGELOG, 'utf8'
fs.writeFileSync CHANGELOG, data.replace 'master', "master\n\n#{version}", 'utf8', (err) ->
throw err if err
exec "cake build && git commit -am 'Release #{version}' && git tag -a #{version} -m '#{version}' && git tag -af stable -m '#{version}'"
Jump to Line
Something went wrong with that request. Please try again.