🎨 Updates for Gruntfile (#8158)

* grunt docs did not work
  - the option "extras" did not work
  - https://github.com/jbt/docker/blob/v0.2.14/src/docker.js#L1280
  - there is a bug in docker docs
  - i removed it for now
* grunt watch-docs typo + remove old config
* remove client testing and client linting
* optimise grunt validate
  - validate is just a wrapper command for `npm test`
  - it will either run lint or the server tests
  - no build - why should validate build ember?
* config updates
  - we don't have a config.js anymore
  - use new config notation
* Update grunt dev
  - livereload for Ghost wasn't working correct, the server wasn't stopped correctly and after reload an address in use error was visibile
  - that is because the "spawn" option has changed to "nospawn"
  - add stdout/stderr info to the bgshell watch command
This commit is contained in:
Katharina Irrgang 2017-03-14 14:51:32 +01:00 committed by Kevin Ansfield
parent 974adee932
commit b5cdc01ad1
2 changed files with 22 additions and 49 deletions

View File

@ -22,7 +22,6 @@ env:
global:
- GITHUB_OAUTH_KEY=003a44d58f12089d0c0261338298af3813330949
- GHOST_NODE_VERSION_CHECK=false
- TEST_SUITE=server
matrix:
- DB=sqlite3 NODE_ENV=testing
- DB=mysql NODE_ENV=testing-mysql

View File

@ -69,10 +69,11 @@ var overrides = require('./core/server/overrides'),
}
},
express: {
files: ['core/ghost-server.js', 'core/server/**/*.js'],
files: ['core/ghost-server.js', 'core/server/**/*.js', 'config.*.json'],
tasks: ['express:dev'],
options: {
spawn: false
nospawn: true,
livereload: true
}
}
},
@ -105,7 +106,7 @@ var overrides = require('./core/server/overrides'),
server: [
'*.js',
'!config*.js', // note: i added this, do we want this linted?
'!config.*.json', // note: i added this, do we want this linted?
'core/*.js',
'core/server/**/*.js',
'core/test/**/*.js',
@ -123,7 +124,7 @@ var overrides = require('./core/server/overrides'),
files: {
src: [
'*.js',
'!config*.js', // note: i added this, do we want this linted?
'!config.*.json', // note: i added this, do we want this linted?
'core/*.js',
'core/server/**/*.js',
'core/test/**/*.js',
@ -217,7 +218,9 @@ var overrides = require('./core/server/overrides'),
bgShell: {
client: {
cmd: 'grunt subgrunt:watch',
bg: true
bg: true,
stdout: true,
stderr: true
}
},
@ -246,8 +249,8 @@ var overrides = require('./core/server/overrides'),
options: {
onlyUpdated: true,
exclude: 'node_modules,bower_components,content,core/client,*test,*doc*,' +
'*vendor,config.js,*buil*,.dist*,.idea,.git*,.travis.yml,.bower*,.editorconfig,.js*,*.md',
extras: ['fileSearch']
'*vendor,config.*.json,*buil*,.dist*,.idea,.git*,.travis.yml,.bower*,.editorconfig,.js*,*.md,' +
'MigratorConfig.js'
}
}
},
@ -317,6 +320,7 @@ var overrides = require('./core/server/overrides'),
options: {
npmInstall: false
},
init: {
options: {
npmInstall: true
@ -335,15 +339,7 @@ var overrides = require('./core/server/overrides'),
},
watch: {
'core/client': ['bgShell:ember', 'watch']
},
lint: {
'core/client': 'lint'
},
test: {
'core/client': 'shell:test'
'core/client': 'shell:ember:watch'
}
}
};
@ -376,12 +372,12 @@ var overrides = require('./core/server/overrides'),
// Run `grunt docs` to generate annotated source code using the documentation described in the code comments.
grunt.registerTask('docs', 'Generate Docs', ['docker']);
// Runun `grunt watch-docs` to setup livereload & watch whilst you're editing the docs
// Run `grunt watch-docs` to setup livereload & watch whilst you're editing the docs
grunt.registerTask('watch-docs', function () {
grunt.config.merge({
watch: {
docs: {
files: ['core/server/**/*', 'index.js', 'Gruntfile.js', 'config.example.js'],
files: ['core/server/**/*', 'index.js', 'Gruntfile.js'],
tasks: ['docker'],
options: {
livereload: true
@ -462,42 +458,24 @@ var overrides = require('./core/server/overrides'),
// ### Validate
// **Main testing task**
//
// `grunt validate` will build, lint and test your local Ghost codebase.
//
// `grunt validate` is one of the most important and useful grunt tasks that we have available to use. It
// manages the build of your environment and then calls `grunt test`
//
// `grunt validate` will either run all tests or run linting
// `grunt validate` is called by `npm test` and is used by Travis.
grunt.registerTask('validate', 'Run tests and lint code', function () {
if (process.env.TEST_SUITE === 'server') {
grunt.task.run(['stubClientFiles', 'test-server']);
} else if (process.env.TEST_SUITE === 'lint') {
grunt.task.run(['lint']);
} else {
grunt.task.run(['validate-all']);
grunt.registerTask('validate', 'Run tests or lint code', function () {
if (process.env.TEST_SUITE === 'lint') {
return grunt.task.run(['lint']);
}
});
grunt.registerTask('validate-all', 'Lint code and run all tests',
['init', 'lint', 'test-all']);
grunt.task.run(['stubClientFiles', 'test-all']);
});
// ### Test-All
// **Main testing task**
//
// `grunt test-all` will lint and test your pre-built local Ghost codebase.
//
// `grunt test-all` runs all 6 test suites. See the individual sub tasks below for
// details of each of the test suites.
//
grunt.registerTask('test-all', 'Run tests for both server and client',
['test-server', 'test-client']);
grunt.registerTask('test-server', 'Run server tests',
grunt.registerTask('test-all', 'Run all server tests',
['test-routes', 'test-module', 'test-unit', 'test-integration']);
grunt.registerTask('test-client', 'Run client tests',
['subgrunt:test']);
// ### Lint
//
// `grunt lint` will run the linter and the code style checker so you can make sure your code is pretty
@ -505,10 +483,6 @@ var overrides = require('./core/server/overrides'),
['jshint', 'jscs']
);
grunt.registerTask('lint-all', 'Run the code style checks and linter for server and client',
['lint', 'subgrunt:lint']
);
// ### test-setup *(utility)(
// `grunt test-setup` will run all the setup tasks required for running tests
grunt.registerTask('test-setup', 'Setup ready to run tests',
@ -537,7 +511,7 @@ var overrides = require('./core/server/overrides'),
// ### Integration tests *(sub task)*
// `grunt test-integration` will run just the integration tests
//
// Provided you already have a `config.js` file, you can run just the model integration tests by running:
// Provided you already have a `config.*.json` file, you can run just the model integration tests by running:
//
// `grunt test:integration/model`
//