module.exports = function(grunt) { // Some tasks do not support directives. var meta = { name: '4chan X Alpha', version: '3.0.0', }; // Project configuration. grunt.initConfig({ meta: { name: meta.name, version: meta.version, repo: 'https://github.com/MayhemYDG/4chan-x/', banner: [ '/* <%= meta.name %> - Version <%= meta.version %> - <%= grunt.template.today("yyyy-mm-dd") %>', ' * http://mayhemydg.github.com/4chan-x/', ' *', ' * Copyright (c) 2009-2011 James Campos ', ' * Copyright (c) <%= grunt.template.today("yyyy") %> Nicolas Stepien ', ' * Licensed under the MIT license.', ' * <%= meta.repo %>blob/master/LICENSE', ' *', ' * Contributors:', ' * <%= meta.repo %>graphs/contributors', ' * ferongr, xat-, Ongpot, thisisanon and Anonymous - cooldown sanity check', ' * e000 - cooldown sanity check', ' * Seiba - chrome quick reply focusing', ' * herpaderpderp - recaptcha fixes', ' * WakiMiko - recaptcha tab order http://userscripts.org/scripts/show/82657', ' *', ' * All the people who\'ve taken the time to write bug reports.', ' *', ' * Thank you.', ' */' ].join('\n'), metadataBlock: [ '// ==UserScript==', '// @name <%= meta.name %>', '// @version <%= meta.version %>', '// @description Adds various features.', '// @copyright 2009-2011 James Campos ', '// @copyright <%= grunt.template.today("yyyy") %> Nicolas Stepien ', '// @license MIT; http://en.wikipedia.org/wiki/Mit_license', '// @match *://boards.4chan.org/*', '// @match *://images.4chan.org/*', '// @match *://sys.4chan.org/*', '// @match *://api.4chan.org/*', '// @match *://*.foolz.us/api/*', '// @grant GM_getValue', '// @grant GM_setValue', '// @grant GM_deleteValue', '// @grant GM_openInTab', '// @run-at document-start', '// @updateURL <%= meta.repo %>raw/stable/<%= meta.files.metajs %>', '// @downloadURL <%= meta.repo %>raw/stable/<%= meta.files.userjs %>', '// @icon <%= meta.repo %>raw/stable/img/icon.gif', '// ==/UserScript==' ].join('\n'), latest: 'document.dispatchEvent(new CustomEvent("<%= meta.name.replace(/ /g, "") %>Update",{detail:{v:"<%= meta.version %>"}}))', files: { metajs: '4chan_x.meta.js', userjs: '4chan_x.user.js', latestjs: 'latestv3.js' }, }, concat: { coffee: { src: [ '', '', '', '', '', '' ], dest: 'tmp/script.coffee' }, js: { src: ['', '', 'tmp/script.js'], dest: '' }, meta: { src: '', dest: '' }, latest: { src: '', dest: '' } }, exec: { coffee: { command: 'coffee --compile tmp/script.coffee', stdout: true }, commit: { command: [ 'git commit -am "Release ' + meta.name + ' v' + meta.version + '."', 'git tag -a ' + meta.version + ' -m "' + meta.version + '"', 'git tag -af stable -m "' + meta.version + '"' ].join(' && '), stdout: true }, clean: { command: 'rm -r tmp' } }, watch: { files: ['grunt.js', 'lib/**/*.coffee', 'src/**/*.coffee', 'css/**/*.css', 'img/*'], tasks: 'coffee concat:build' } }); grunt.loadNpmTasks('grunt-exec'); grunt.registerTask('default', 'concat:coffee exec:coffee concat:js exec:clean'); grunt.registerTask('upgrade', 'concat:meta concat:latest default exec:commit'); };