module.exports = (grunt) -> fs = require('fs') pkg = require('./package.json') # Project configuration. grunt.initConfig pkg: pkg # Lint # ---- # CoffeeLint coffeelint: options: arrow_spacing: level: 'error' line_endings: level: 'error' value: 'unix' max_line_length: level: 'error' value: 150 no_unnecessary_fat_arrows: level: "ignore" source: ['octokit.coffee'] grunt: 'Gruntfile.coffee' # Dist # ---- # Clean clean: files: src: [ 'octokit.js' 'octokit.js.map' ] filter: 'isFile' # Compile CoffeeScript to JavaScript coffee: compile: options: sourceMap: false # true files: 'octokit.js': ['octokit.coffee'] # Release a new version and push upstream bump: options: commit: true push: true pushTo: '' commitFiles: ['package.json', 'component.json', 'bower.json', 'octokit.js'] # Files to bump the version number of files: ['package.json', 'bower.json', 'component.json'] mochaTest: test: options: reporter: 'spec' require: 'coffee-script' src: ['test/**/node*.coffee'] # Used for coveralls.io code coverage mochacov: options: coverage: true # use blanket reporter: 'spec' require: ['coffee-script'] compilers: ['coffee:coffee-script'] all: ['test/**/node*.coffee'] # Code coverage in PhantomJS requires commenting out the following in # node_modules/mocha/mocha.js: # - `self.suiteURL(suite)` # - `self.testURL(test)` blanket_mocha: all: [ 'test/index.html' ] options: threshold: 54 log: true reporter: 'Dot' watch: files: 'octokit.coffee' tasks: ['default'] # Dependencies # ============ for name of pkg.dependencies when name.substring(0, 6) is 'grunt-' grunt.loadNpmTasks(name) for name of pkg.devDependencies when name.substring(0, 6) is 'grunt-' if grunt.file.exists("./node_modules/#{name}") grunt.loadNpmTasks(name) # Tasks # ===== # Travis CI # ----- grunt.registerTask 'test', [ 'coffeelint' 'clean' 'coffee' 'mochaTest' #'blanket_mocha' NOTE: Uncomment once the `suiteURL` problem noted above is fixed ] # Dist # ----- grunt.registerTask 'release', [ 'clean' 'coffeelint' 'coffee' # 'mochaTest' #'blanket_mocha' 'bump' ] grunt.registerTask 'release-minor', [ 'clean' 'coffeelint' 'coffee' 'mochaTest' #'blanket_mocha' 'bump:minor' ] # Default # ----- grunt.registerTask 'default', [ 'coffeelint' 'clean' 'coffee' ]