module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: '', meta: { name: '<%= pkg.name.replace(/-/g, " ") %>', repo: 'https://github.com/MayhemYDG/4chan-x/', banner: [ '/* <%= meta.name %> - Version <%= pkg.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', ' * Non-GitHub contributors:', ' * ferongr, xat-, Ongpot, thisisanon and Anonymous - favicon contributions', ' * 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 <%= pkg.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("<%= pkg.name.replace(/-/g, "") %>Update",{detail:{v:"<%= pkg.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: '' } }, coffee: { all: { src: 'tmp/script.coffee', dest: 'tmp/script.js' }, }, exec: { commit: { command: function(grunt) { var name, version; name = grunt.config(['pkg', 'name']).replace(/-/g, ' '); version = grunt.config(['pkg', 'version']); return [ 'git checkout master', 'git commit -am "Release ' + name + ' v' + version + '."', 'git tag -a ' + version + ' -m "' + version + '"', 'git tag -af stable -m "' + version + '"' ].join(' && '); }, stdout: true }, push: { command: 'git push && git push --tags', stdout: true }, clean: { command: 'rm -r tmp' } }, watch: { files: ['grunt.js', 'lib/**/*.coffee', 'src/**/*.coffee', 'css/**/*.css', 'img/*'], tasks: 'default' } }); grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-exec'); grunt.registerTask('default', 'concat:coffee coffee concat:js exec:clean'); grunt.registerTask('release', 'concat:meta concat:latest default exec:commit exec:push'); grunt.registerTask('patch', 'bump'); grunt.registerTask('upgrade', 'bump:minor'); };