Remove Grunt.

This commit is contained in:
ccd0 2016-04-17 04:37:47 -07:00
parent 46a7df9824
commit 9613de917f
3 changed files with 2 additions and 422 deletions

View File

@ -1,240 +0,0 @@
path = require 'path'
os = require 'os'
module.exports = (grunt) ->
grunt.util.linefeed = '\n'
loadPkg = ->
pkg = grunt.file.readJSON 'package.json'
version = grunt.file.readJSON 'version.json'
pkg.meta[key] = val for key, val of version
pkg
# Project configuration.
grunt.initConfig
pkg: loadPkg()
BIN: ['node_modules', '.bin', ''].join(path.sep)
MAKEFLAGS: if process.platform is 'linux' then "-j#{os.cpus().length}" else ''
shell:
options:
stdout: true
stderr: true
failOnError: true
build:
command: 'make <%= MAKEFLAGS %>'
full:
command: """
make cleanrel
make <%= MAKEFLAGS %> all
""".split('\n').join('&&')
clean:
command: 'make clean'
markdown:
command: 'make test.html'
commit:
command: """
git commit -am "Release <%= pkg.meta.name %> v<%= pkg.meta.version %>."
git tag -a <%= pkg.meta.version %> -m "<%= pkg.meta.name %> v<%= pkg.meta.version %>."
""".split('\n').join('&&')
'gh-pages':
command: """
git checkout gh-pages
git pull
""".split('\n').join('&&')
'tag-beta':
command: """
git tag -af beta -m "<%= pkg.meta.name %> v<%= pkg.meta.version %>."
""".split('\n').join('&&')
beta:
command: """
git merge --no-commit -s ours beta
git checkout beta "builds/*-beta.*" LICENSE CHANGELOG.md img .gitignore .gitattributes
git commit -am "Move <%= pkg.meta.name %> v<%= pkg.meta.version %> to beta channel."
""".split('\n').join('&&')
'tag-stable':
command: """
git push . HEAD:bstable
git tag -af stable -m "<%= pkg.meta.name %> v<%= pkg.meta.version %>."
""".split('\n').join('&&')
stable:
command: """
git merge --no-commit -s ours stable
git checkout stable "builds/<%= pkg.name %>.*" builds/updates.xml
git commit -am "Move <%= pkg.meta.name %> v<%= pkg.meta.version %> to stable channel."
""".split('\n').join('&&')
web:
command: """
git merge --no-commit -s ours master
git checkout master README.md web.css img
git commit -am "Update web page."
""".split('\n').join('&&')
push:
command: """
git push origin --tags -f
git push origin --all
""".split('\n').join('&&')
aws:
command: """
aws s3 cp builds/ s3://<%= pkg.meta.awsBucket %>/builds/ --recursive --exclude "*" --include "*.js" --cache-control "max-age=600" --content-type "application/javascript; charset=utf-8"
aws s3 cp builds/ s3://<%= pkg.meta.awsBucket %>/builds/ --recursive --exclude "*" --include "*.crx" --cache-control "max-age=600" --content-type "application/x-chrome-extension"
aws s3 cp builds/ s3://<%= pkg.meta.awsBucket %>/builds/ --recursive --exclude "*" --include "*.xml" --cache-control "max-age=600" --content-type "text/xml; charset=utf-8"
aws s3 cp builds/ s3://<%= pkg.meta.awsBucket %>/builds/ --recursive --exclude "*" --include "*.zip" --cache-control "max-age=600" --content-type "application/zip"
aws s3 cp img/ s3://<%= pkg.meta.awsBucket %>/img/ --recursive --cache-control "max-age=600"
aws s3 cp index.html s3://<%= pkg.meta.awsBucket %> --cache-control "max-age=600" --content-type "text/html; charset=utf-8"
aws s3 cp web.css s3://<%= pkg.meta.awsBucket %> --cache-control "max-age=600" --content-type "text/css; charset=utf-8"
""".split('\n').join('&&')
captchas:
command: """
<%= BIN %>coffee tools/templates.coffee redirect.html captchas.html url=#{process.env.url || 'https://www.4chan.org/feedback'}
aws s3 cp captchas.html s3://<%= pkg.meta.awsBucket %> --cache-control "max-age=0" --content-type "text/html; charset=utf-8"
""".split('\n').join('&&')
update:
command: """
npm install --save-dev <%= Object.keys(pkg.devDependencies).filter(function(name) {return /^\\^/.test(pkg.devDependencies[name]);}).map(function(name) {return name+'@latest';}).join(' ') %>
npm shrinkwrap --dev
""".split('\n').join('&&')
webstore_upload:
accounts:
default:
publish: true
client_id: '<%= grunt.file.readJSON("../"+pkg.meta.path+".keys/chrome-store.json").installed.client_id %>'
client_secret: '<%= grunt.file.readJSON("../"+pkg.meta.path+".keys/chrome-store.json").installed.client_secret %>'
extensions:
extension:
appID: '<%= pkg.meta.chromeStoreID %>'
zip: 'builds/<%= pkg.name %>.zip'
grunt.loadNpmTasks 'grunt-shell'
grunt.loadNpmTasks 'grunt-webstore-upload'
grunt.registerTask 'default', [
'build'
]
for task in ['clean', 'markdown', 'push', 'captchas', 'update']
grunt.registerTask task, ["shell:#{task}"]
grunt.registerTask 'set-tests', 'Set whether to include testing code', (value) ->
try
oldValue = grunt.file.readJSON '.tests_enabled'
catch
unless oldValue is JSON.parse value
grunt.file.write '.tests_enabled', value
grunt.registerTask 'build', [
'set-tests:false'
'shell:build'
]
grunt.registerTask 'build-tests', [
'set-tests:true'
'shell:build'
]
grunt.registerTask 'full', [
'set-tests:false'
'shell:full'
]
grunt.registerTask 'tag', 'Tag a new release', (version) ->
grunt.task.run [
"setversion:#{version}"
'updcl'
'full'
'shell:commit'
]
grunt.registerTask 'bump', 'Bump the version number and tag a new release', (level) ->
pkg = grunt.config 'pkg'
parts = pkg.meta.version.split '.'
parts[i] or= '0' for i in [0...level]
parts[level-1] = +parts[level-1] + 1
parts[i] = 0 for i in [level...parts.length]
grunt.task.run "tag:#{parts.join '.'}"
grunt.registerTask 'pushd', 'Change directory to the distribution worktree and check out gh-pages branch.', ->
pkg = grunt.config 'pkg'
grunt.file.setBase "../#{pkg.meta.path}.gh-pages"
grunt.task.run 'shell:gh-pages'
grunt.registerTask 'popd', 'Return to the normal working directory.', ->
pkg = grunt.config 'pkg'
grunt.file.setBase "../#{pkg.meta.path}"
grunt.registerTask 'beta', [
'shell:tag-beta'
'pushd'
'shell:beta'
'popd'
]
grunt.registerTask 'stable', [
'shell:tag-stable'
'pushd'
'shell:stable'
'popd'
]
grunt.registerTask 'copy-web', 'Copy test.html into distribution worktree.', ->
pkg = grunt.config('pkg')
grunt.file.copy "../#{pkg.meta.path}/test.html", 'index.html'
grunt.registerTask 'web', [
'shell:markdown'
'pushd'
'copy-web'
'shell:web'
'popd'
]
grunt.registerTask 'aws', [
'pushd'
'shell:aws'
'popd'
]
grunt.registerTask 'store', [
'pushd'
'webstore_upload'
'popd'
]
grunt.registerTask 'setversion', 'Set the version number', (version) ->
data = grunt.file.readJSON 'version.json'
oldversion = data.version
data.version = version
data.date = new Date()
grunt.file.write 'version.json', JSON.stringify(data, null, 2) + '\n'
grunt.log.ok "Version updated from v#{oldversion} to v#{version}."
grunt.config 'pkg', loadPkg()
grunt.registerTask 'updcl', 'Update the changelog', ->
{meta, name} = grunt.config('pkg')
{version, oldVersions} = meta
branch = version.replace /\.\d+$/, ''
headerLevel = branch.replace(/(\.0)*$/, '').split('.').length
headerPrefix = new Array(headerLevel + 1).join '#'
separator = "#{headerPrefix} v#{branch}"
today = grunt.template.today 'yyyy-mm-dd'
filename = "/builds/#{name}-noupdate"
ffLink = "#{oldVersions}#{version}#{filename}.user.js"
crLink = "#{oldVersions}#{version}#{filename}.crx"
line = "**v#{version}** *(#{today})* - [[Firefox](#{ffLink} \"Firefox version\")] [[Chromium](#{crLink} \"Chromium version\")]"
changelog = grunt.file.read 'CHANGELOG.md'
breakPos = changelog.indexOf(separator)
throw new Error 'Separator not found.' if breakPos is -1
breakPos += separator.length
prevVersion = changelog[breakPos..].match(/\*\*v([\d\.]+)\*\*/)[1]
unless prevVersion.replace(/\.\d+$/, '') is branch
line += "\n- Based on v#{prevVersion}."
grunt.file.write 'CHANGELOG.md', "#{changelog[...breakPos]}\n\n#{line}#{changelog[breakPos..]}"
grunt.log.ok "Changelog updated for v#{version}."

181
npm-shrinkwrap.json generated
View File

@ -1,11 +1,6 @@
{
"name": "4chan-X",
"dependencies": {
"abbrev": {
"version": "1.0.7",
"from": "abbrev@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz"
},
"ansi-regex": {
"version": "2.0.0",
"from": "ansi-regex@>=2.0.0 <3.0.0",
@ -28,11 +23,6 @@
}
}
},
"argparse": {
"version": "1.0.7",
"from": "argparse@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.7.tgz"
},
"array-find-index": {
"version": "1.0.1",
"from": "array-find-index@>=1.0.0 <2.0.0",
@ -147,11 +137,6 @@
"from": "coffee-script@1.9.3",
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.9.3.tgz"
},
"colors": {
"version": "1.1.2",
"from": "colors@>=1.1.2 <1.2.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz"
},
"combined-stream": {
"version": "1.0.5",
"from": "combined-stream@>=1.0.5 <1.1.0",
@ -296,11 +281,6 @@
"from": "esprima@>=2.6.0 <3.0.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.2.tgz"
},
"eventemitter2": {
"version": "0.4.14",
"from": "eventemitter2@>=0.4.13 <0.5.0",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz"
},
"exit": {
"version": "0.1.2",
"from": "exit@>=0.1.1 <0.2.0",
@ -375,11 +355,6 @@
"from": "get-stdin@>=4.0.1 <5.0.0",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
},
"getobject": {
"version": "0.1.0",
"from": "getobject@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz"
},
"glob": {
"version": "3.2.11",
"from": "glob@>=3.2.6 <3.3.0",
@ -402,108 +377,6 @@
"from": "graceful-readlink@>=1.0.0",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz"
},
"grunt": {
"version": "1.0.1",
"from": "grunt@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.1.tgz",
"dependencies": {
"coffee-script": {
"version": "1.10.0",
"from": "coffee-script@>=1.10.0 <1.11.0",
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.10.0.tgz"
},
"findup-sync": {
"version": "0.3.0",
"from": "findup-sync@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz",
"dependencies": {
"glob": {
"version": "5.0.15",
"from": "glob@>=5.0.0 <5.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz"
}
}
},
"glob": {
"version": "7.0.3",
"from": "glob@>=7.0.0 <7.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.3.tgz"
},
"grunt-cli": {
"version": "1.2.0",
"from": "grunt-cli@>=1.2.0 <1.3.0",
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz"
},
"iconv-lite": {
"version": "0.4.13",
"from": "iconv-lite@>=0.4.13 <0.5.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz"
},
"minimatch": {
"version": "3.0.0",
"from": "minimatch@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz"
}
}
},
"grunt-known-options": {
"version": "1.1.0",
"from": "grunt-known-options@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.0.tgz"
},
"grunt-legacy-log": {
"version": "1.0.0",
"from": "grunt-legacy-log@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-1.0.0.tgz",
"dependencies": {
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.10.1 <3.11.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"
}
}
},
"grunt-legacy-log-utils": {
"version": "1.0.0",
"from": "grunt-legacy-log-utils@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-1.0.0.tgz",
"dependencies": {
"lodash": {
"version": "4.3.0",
"from": "lodash@>=4.3.0 <4.4.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz"
}
}
},
"grunt-legacy-util": {
"version": "1.0.0",
"from": "grunt-legacy-util@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.0.0.tgz",
"dependencies": {
"lodash": {
"version": "4.3.0",
"from": "lodash@>=4.3.0 <4.4.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz"
}
}
},
"grunt-shell": {
"version": "1.2.1",
"from": "grunt-shell@>=1.2.1 <2.0.0",
"resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-1.2.1.tgz"
},
"grunt-webstore-upload": {
"version": "0.8.10",
"from": "grunt-webstore-upload@>=0.8.10 <0.9.0",
"resolved": "https://registry.npmjs.org/grunt-webstore-upload/-/grunt-webstore-upload-0.8.10.tgz",
"dependencies": {
"lodash": {
"version": "2.4.2",
"from": "lodash@>=2.4.1 <3.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz"
}
}
},
"har-validator": {
"version": "2.0.6",
"from": "har-validator@>=2.0.6 <2.1.0",
@ -524,11 +397,6 @@
"from": "hoek@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
},
"hooker": {
"version": "0.2.3",
"from": "hooker@>=0.2.3 <0.3.0",
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz"
},
"hosted-git-info": {
"version": "2.1.4",
"from": "hosted-git-info@>=2.1.4 <3.0.0",
@ -540,9 +408,9 @@
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz",
"dependencies": {
"readable-stream": {
"version": "1.1.13",
"version": "1.1.14",
"from": "readable-stream@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz"
}
}
},
@ -571,11 +439,6 @@
"from": "inherits@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"is-absolute": {
"version": "0.1.7",
"from": "is-absolute@>=0.1.7 <0.2.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz"
},
"is-arrayish": {
"version": "0.2.1",
"from": "is-arrayish@>=0.2.1 <0.3.0",
@ -601,11 +464,6 @@
"from": "is-property@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz"
},
"is-relative": {
"version": "0.1.3",
"from": "is-relative@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz"
},
"is-typedarray": {
"version": "1.0.0",
"from": "is-typedarray@>=1.0.0 <1.1.0",
@ -626,11 +484,6 @@
"from": "isbinaryfile@>=0.1.9 <0.2.0",
"resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz"
},
"isexe": {
"version": "1.1.2",
"from": "isexe@>=1.1.1 <2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-1.1.2.tgz"
},
"isstream": {
"version": "0.1.2",
"from": "isstream@>=0.1.2 <0.2.0",
@ -641,11 +494,6 @@
"from": "jodid25519@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz"
},
"js-yaml": {
"version": "3.5.5",
"from": "js-yaml@>=3.5.2 <3.6.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz"
},
"jsbn": {
"version": "0.1.0",
"from": "jsbn@>=0.1.0 <0.2.0",
@ -775,11 +623,6 @@
"from": "node-uuid@>=1.4.7 <1.5.0",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz"
},
"nopt": {
"version": "3.0.6",
"from": "nopt@>=3.0.6 <3.1.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz"
},
"normalize-package-data": {
"version": "2.3.5",
"from": "normalize-package-data@>=2.3.4 <3.0.0",
@ -910,11 +753,6 @@
"from": "request-promise@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/request-promise/-/request-promise-2.0.1.tgz"
},
"resolve": {
"version": "1.1.7",
"from": "resolve@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz"
},
"rimraf": {
"version": "2.2.8",
"from": "rimraf@>=2.2.2 <2.3.0",
@ -965,11 +803,6 @@
"from": "spdx-license-ids@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.1.tgz"
},
"sprintf-js": {
"version": "1.0.3",
"from": "sprintf-js@>=1.0.2 <1.1.0",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz"
},
"sshpk": {
"version": "1.7.4",
"from": "sshpk@>=1.7.0 <2.0.0",
@ -1035,11 +868,6 @@
"from": "tweetnacl@>=0.13.0 <1.0.0",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.3.tgz"
},
"underscore.string": {
"version": "3.2.3",
"from": "underscore.string@>=3.2.3 <3.3.0",
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0",
@ -1077,11 +905,6 @@
}
}
},
"which": {
"version": "1.2.4",
"from": "which@>=1.2.1 <1.3.0",
"resolved": "https://registry.npmjs.org/which/-/which-1.2.4.tgz"
},
"wrappy": {
"version": "1.0.1",
"from": "wrappy@>=1.0.0 <2.0.0",

View File

@ -53,9 +53,6 @@
"dateformat": "^1.0.12",
"esprima": "^2.7.2",
"font-awesome": "4.5.0",
"grunt": "^1.0.1",
"grunt-shell": "^1.2.1",
"grunt-webstore-upload": "^0.8.10",
"jshint": "^2.9.1",
"jszip": "^2.6.0",
"lodash": "^4.10.0",