add beta and noupdate versions to build script

This commit is contained in:
ccd0 2014-06-29 22:48:39 -07:00
parent 70486be734
commit 7b87885731
6 changed files with 52 additions and 69 deletions

View File

@ -49,16 +49,9 @@ module.exports = (grunt) ->
'LICENSE': 'src/General/meta/banner.js'
crx:
files:
'testbuilds/crx/manifest.json': 'src/General/meta/manifest.json'
'testbuilds/updates.xml': 'src/General/meta/updates.xml'
'testbuilds/crx/script.js': [
'src/General/meta/botproc.js'
'src/General/meta/banner.js'
'src/General/meta/usestrict.js'
'tmp-<%= pkg.type %>/script.js'
]
'testbuilds/wcrx/manifest.json': 'src/General/meta/manifest-w.json'
'testbuilds/wcrx/script.js': [
'testbuilds/updates<%= pkg.meta.suffix[pkg.channel] %>.xml': 'src/General/meta/updates.xml'
'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/manifest.json': 'src/General/meta/manifest.json'
'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/script.js': [
'src/General/meta/botproc.js'
'src/General/meta/banner.js'
'src/General/meta/usestrict.js'
@ -66,8 +59,8 @@ module.exports = (grunt) ->
]
userscript:
files:
'testbuilds/<%= pkg.name %>.meta.js': 'src/General/meta/metadata.js'
'testbuilds/<%= pkg.name %>.user.js': [
'testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.meta.js': 'src/General/meta/metadata.js'
'testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.user.js': [
'src/General/meta/botproc.js'
'src/General/meta/metadata.js'
'src/General/meta/banner.js'
@ -78,19 +71,15 @@ module.exports = (grunt) ->
copy:
crx:
src: 'src/General/img/*.png'
dest: 'testbuilds/crx/'
expand: true
flatten: true
wcrx:
src: 'src/General/img/*.png'
dest: 'testbuilds/wcrx/'
dest: 'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/'
expand: true
flatten: true
builds:
cwd: 'testbuilds/'
src: '**'
src: '*'
dest: 'builds/'
expand: true
filter: 'isFile'
coffee:
script:
@ -119,8 +108,6 @@ module.exports = (grunt) ->
failOnError: true
checkout:
command: 'git checkout <%= pkg.meta.mainBranch %>'
pack:
command: 'chromium --pack-extension=testbuilds/crx --pack-extension-key=$HOME/.ssh/<%= pkg.name %>.pem'
commit:
command: """
git commit -am "Release <%= pkg.meta.name %> v<%= pkg.version %>."
@ -147,6 +134,12 @@ module.exports = (grunt) ->
]
tasks: 'build'
crx:
prod:
src: 'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/'
dest: 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.crx'
privateKey: '~/.ssh/<%= pkg.name %>.pem'
compress:
crx:
options:
@ -155,14 +148,14 @@ module.exports = (grunt) ->
pretty: true
expand: true
flatten: true
src: 'testbuilds/wcrx/*'
src: 'testbuilds/crx<%= pkg.meta.suffix.noupdate %>/*'
dest: '/'
clean:
builds: 'builds'
testbuilds: 'testbuilds'
tmpcrx: 'tmp-crx'
tmpuserscript: 'tmp-userscript'
tmpcrx: ['tmp-crx', 'testbuilds/updates<%= pkg.meta.suffix.noupdate %>.xml']
tmpuserscript: ['tmp-userscript', 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix.noupdate %>.meta.js']
require('load-grunt-tasks') grunt
@ -186,6 +179,11 @@ module.exports = (grunt) ->
grunt.log.ok 'pkg.type = %s', type
grunt.registerTask 'set-channel', 'Set the update channel', (channel) ->
pkg = grunt.config 'pkg'
pkg.channel = channel
grunt.config 'pkg', pkg
grunt.registerTask 'enable-tests', 'Include testing code', () ->
pkg = grunt.config 'pkg'
pkg.tests_enabled = true
@ -195,13 +193,23 @@ module.exports = (grunt) ->
'concurrent:build'
]
grunt.registerTask 'build-crx-channel', [
'concat:crx'
'copy:crx'
'crx:prod'
]
grunt.registerTask 'build-crx', [
'set-build:crx'
'concat:coffee'
'coffee:script'
'concat:crx'
'copy:crx'
'copy:wcrx'
'set-channel:stable'
'build-crx-channel'
'set-channel:beta'
'build-crx-channel'
'set-channel:noupdate'
'build-crx-channel'
'compress:crx'
'clean:tmpcrx'
]
@ -209,6 +217,11 @@ module.exports = (grunt) ->
'set-build:userscript'
'concat:coffee'
'coffee:script'
'set-channel:stable'
'concat:userscript'
'set-channel:beta'
'concat:userscript'
'set-channel:noupdate'
'concat:userscript'
'clean:tmpuserscript'
]
@ -219,23 +232,15 @@ module.exports = (grunt) ->
'build-crx'
]
grunt.registerTask 'testing', [
grunt.registerTask 'tag', [
'build'
'shell:pack'
'compress:crx'
'concat:meta'
'copy:builds'
'shell:commit'
'shell:push'
]
grunt.registerTask 'release', [
'build'
'shell:pack'
'compress:crx'
'concat:meta'
'copy:builds'
'shell:commit'
'tag'
'shell:stable'
'shell:push'
]

View File

@ -17,9 +17,10 @@
"*://a.4cdn.org/*",
"*://i.4cdn.org/*"
],
"files": {
"metajs": "4chan-X.meta.js",
"userjs": "4chan-X.user.js"
"suffix": {
"stable": "",
"beta": "-beta",
"noupdate": "-noupdate"
},
"min": {
"chrome": "31",
@ -38,6 +39,7 @@
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-crx": "~0.3.3",
"grunt-shell": "~0.7.0",
"load-grunt-tasks": "~0.4.0"
},

View File

@ -1,24 +0,0 @@
{
"name": "<%= meta.name %>",
"version": "<%= version %>",
"manifest_version": 2,
"description": "<%= description %>",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"content_scripts": [{
"js": ["script.js"],
"matches": <%= JSON.stringify(meta.matches) %>,
"all_frames": true,
"run_at": "document_start"
}],
"homepage_url": "<%= meta.page %>",
"minimum_chrome_version": "<%= meta.min.chrome %>",
"permissions": [
"storage",
"http://*/",
"https://*/"
]
}

View File

@ -15,8 +15,8 @@
"run_at": "document_start"
}],
"homepage_url": "<%= meta.page %>",
"update_url": "<%= meta.downloads %>updates.xml",
"minimum_chrome_version": "<%= meta.min.chrome %>",
<% if (channel !== 'noupdate') { %> "update_url": "<%= meta.downloads %>updates<%= meta.suffix[channel] %>.xml",
<% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
"permissions": [
"storage",
"http://*/",

View File

@ -18,7 +18,7 @@
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @run-at document-start
// @updateURL <%= meta.downloads %><%= meta.files.metajs %>
// @downloadURL <%= meta.downloads %><%= meta.files.userjs %>
<% if (channel !== 'noupdate') { %>// @updateURL <%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.meta.js
<% } %>// @downloadURL <%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.user.js
// @icon data:image/png;base64,<%= grunt.file.read('src/General/img/icon48.png', {encoding: 'base64'}) %>
// ==/UserScript==

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='<%= meta.appid %>'>
<updatecheck codebase='<%= meta.downloads %>crx.crx' version='<%= version %>' />
<updatecheck codebase='<%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.crx' version='<%= version %>' />
</app>
</gupdate>