diff --git a/ghost/admin/Gruntfile.js b/ghost/admin/Gruntfile.js index df223f21f8..c4557e7f3a 100644 --- a/ghost/admin/Gruntfile.js +++ b/ghost/admin/Gruntfile.js @@ -8,10 +8,7 @@ var _ = require('lodash'), getTopContribs = require('top-gh-contribs'), moment = require('moment'), chalk = require('chalk'), - Promise = require('bluebird'), - - escapeChar = process.platform.match(/^win/) ? '^' : '\\', - cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'); + Promise = require('bluebird'); module.exports = function(grunt) { @@ -85,21 +82,61 @@ module.exports = function(grunt) { } }, + // ### grunt-bg-shell + // Used to run ember-cli watch in the background + bgShell: { + ember: { + cmd: 'npm run build -- --watch', + bg: true, + stdout: function (out) { + grunt.log.writeln(chalk.cyan('Ember-cli::') + out); + }, + stderror: function (error) { + grunt.log.error(chalk.red('Ember-cli::' + error)); + } + } + }, + shell: { 'npm-install': { command: 'npm install' }, 'bower-install': { - command: path.resolve(cwd + '/node_modules/.bin/bower install') + command: 'bower install' + }, + + ember: { + command: function (mode) { + switch (mode) { + case 'prod': + return 'npm run build -- --environment=production --silent'; + + case 'dev': + return 'npm run build'; + } + }, + options: { + execOptions: { + stdout: false + } + } }, csscombfix: { - command: path.resolve(cwd + '/node_modules/.bin/csscomb -c app/styles/csscomb.json -v app/styles') + command: 'csscomb -c app/styles/csscomb.json -v app/styles' }, csscomblint: { - command: path.resolve(cwd + '/node_modules/.bin/csscomb -c app/styles/csscomb.json -lv app/styles') + command: 'csscomb -c app/styles/csscomb.json -lv app/styles' + }, + + test: { + command: 'npm test' + }, + + options: { + preferLocal: true } } }); diff --git a/ghost/admin/package.json b/ghost/admin/package.json index dbba073b96..51885e34c4 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -76,6 +76,7 @@ "fs-extra": "0.30.0", "glob": "7.0.5", "grunt": "1.0.1", + "grunt-bg-shell": "2.3.3", "grunt-contrib-clean": "1.0.0", "grunt-contrib-jshint": "1.0.0", "grunt-jscs": "3.0.1",