grunt master improvements (#8301)

refs #8235

- Use yarn to install top-level dependencies
- Change to use git submodule update --remote to update submodules to master rather than the pinned commit
- Clarify that the existing submodule update will update to the pinned commits by naming it 'pinned'
- Use `upstream` as default remote
- Support --upstream= or GHOST_UPSTEAM env var
- Output a log line telling the user where master was pulled from
This commit is contained in:
Hannah Wolfe 2017-04-10 14:51:32 +01:00 committed by Katharina Irrgang
parent 4ba5cc862a
commit 352606fb28
1 changed files with 18 additions and 16 deletions

View File

@ -241,8 +241,9 @@ var overrides = require('./core/server/overrides'),
shell: {
master: {
command: function () {
var upstream = grunt.option('upstream') || 'origin';
return 'git checkout master; git pull ' + upstream + ' master; npm install;';
var upstream = grunt.option('upstream') || process.env.GHOST_UPSTREAM || 'upstream';
grunt.log.writeln('Pulling down the latest master from ' + upstream);
return 'git checkout master; git pull ' + upstream + ' master; yarn;';
}
},
@ -305,10 +306,15 @@ var overrides = require('./core/server/overrides'),
// ### grunt-update-submodules
// Grunt task to update git submodules
update_submodules: {
default: {
pinned: {
options: {
params: '--init'
}
},
master: {
options: {
params: '--remote'
}
}
},
@ -343,9 +349,6 @@ var overrides = require('./core/server/overrides'),
},
init: {
options: {
npmInstall: true
},
projects: {
'core/client': 'init'
}
@ -652,7 +655,7 @@ var overrides = require('./core/server/overrides'),
// `bower` does have some quirks, such as not running as root. If you have problems please try running
// `grunt init --verbose` to see if there are any errors.
grunt.registerTask('init', 'Prepare the project for development',
['update_submodules', 'subgrunt:init', 'clean:tmp', 'default']);
['update_submodules:pinned', 'subgrunt:init', 'clean:tmp', 'default']);
// ### Build assets
// `grunt build` - will build client assets (without updating the submodule)
@ -696,16 +699,15 @@ var overrides = require('./core/server/overrides'),
}
});
/**
* This command helps you to bring your working directory back to current master.
* It will also update your dependencies and shows you if your database is health.
* It won't build the client!
*
* grunt master [origin is the default upstream to pull from]
* grunt master --upstream=parent
*/
// ### grunt master
// This command helps you to bring your working directory back to current master.
// It will also update your dependencies to master and shows you if your database is healthy.
// It won't build the client!
//
// `grunt master` [`upstream` is the default upstream to pull from]
// `grunt master --upstream=parent`
grunt.registerTask('master', 'Update your current working folder to latest master.',
['shell:master', 'update_submodules', 'subgrunt:init', 'shell:dbhealth']
['shell:master', 'update_submodules:master', 'subgrunt:init', 'shell:dbhealth']
);
// ### Release