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

View File

@ -17,9 +17,10 @@
"*://a.4cdn.org/*", "*://a.4cdn.org/*",
"*://i.4cdn.org/*" "*://i.4cdn.org/*"
], ],
"files": { "suffix": {
"metajs": "4chan-X.meta.js", "stable": "",
"userjs": "4chan-X.user.js" "beta": "-beta",
"noupdate": "-noupdate"
}, },
"min": { "min": {
"chrome": "31", "chrome": "31",
@ -38,6 +39,7 @@
"grunt-contrib-concat": "~0.4.0", "grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0", "grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.6.1", "grunt-contrib-watch": "~0.6.1",
"grunt-crx": "~0.3.3",
"grunt-shell": "~0.7.0", "grunt-shell": "~0.7.0",
"load-grunt-tasks": "~0.4.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" "run_at": "document_start"
}], }],
"homepage_url": "<%= meta.page %>", "homepage_url": "<%= meta.page %>",
"update_url": "<%= meta.downloads %>updates.xml", <% if (channel !== 'noupdate') { %> "update_url": "<%= meta.downloads %>updates<%= meta.suffix[channel] %>.xml",
"minimum_chrome_version": "<%= meta.min.chrome %>", <% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
"permissions": [ "permissions": [
"storage", "storage",
"http://*/", "http://*/",

View File

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

View File

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