From 352606fb28c5f23580f545d9bb1a19bd366e8855 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Mon, 10 Apr 2017 14:51:32 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20grunt=20master=20improvements=20(#8?= =?UTF-8?q?301)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Gruntfile.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 63f63bb840..cca1252221 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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