From dc32d516967da26a0a0a5bb85ccce5a0c66ca483 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 13:54:39 +0200 Subject: [PATCH] Add support for updating your gulpfile You can now run `yo jekyllized:gulp --rsync` to update your gulpfile and package.json to the latest version of both with Rsync for uploading. Neat. --- README.md | 7 +++++++ generators/boilerplate/templates/README.md | 6 +++--- generators/gulp/USAGE | 12 ++++++++++++ generators/gulp/index.js | 13 +++++++++++++ package.json | 1 + 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 generators/gulp/USAGE diff --git a/README.md b/README.md index f1e3c1e..aa82325 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,13 @@ new/updated site is uploaded to your platform of choice. in * **Start:** Run `gulp` and watch the magic unfold +#### Update +It's recommended that you keep your `gulpfile` up to date with the generator. +First, update `generator-jekyllized`: `npm update generator-jekyllized -g` and +then run `yo jekyllized:gulp [--rsync|amazon|pages]`, or see the help: `yo +jekyllized:gulp --help`. Note that this will overwrite any local changes you've +made, so make sure to make a backup. + ## Usage #### `gulp [--prod]` diff --git a/generators/boilerplate/templates/README.md b/generators/boilerplate/templates/README.md index 8f66761..bed6816 100644 --- a/generators/boilerplate/templates/README.md +++ b/generators/boilerplate/templates/README.md @@ -28,9 +28,9 @@ If you have cloned this repo or want to reinstall, make sure there's no `bundle install`. #### Update -To update: `npm update generator-jekyllized -g`, then run `yo jekyllized:gulp` -in this directory. Note that this will overwrite any local changes, so back it -up. +To update: `npm update generator-jekyllized -g`, then run `yo jekyllized:gulp +[--rsync|amazon|pages]` in this directory. Note that this will overwrite any +local changes, so back it up. ## Github For more information on how to use your new project, please refer to the [README diff --git a/generators/gulp/USAGE b/generators/gulp/USAGE new file mode 100644 index 0000000..8579276 --- /dev/null +++ b/generators/gulp/USAGE @@ -0,0 +1,12 @@ +Updating: + When updating your gulpfile and packages you need to include a command line + flag specifying how you want to upload your site, if no flag is specified it + will generate a gulpfile without any uploading task. For example: + + yo jekyllized:gulp + yo jekyllized:gulp --rsync + + Options: + --amazon + --rsync + --pages diff --git a/generators/gulp/index.js b/generators/gulp/index.js index 8461a8a..0df8078 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -2,6 +2,7 @@ var _ = require('lodash'); var generators = require('yeoman-generator'); +var argv = require('yargs').argv; module.exports = generators.Base.extend({ constructor: function () { @@ -14,6 +15,18 @@ module.exports = generators.Base.extend({ message: 'How do you want to upload your site?', choices: ['Amazon S3', 'Rsync', 'Github Pages', 'None'] }); + + if (argv.amazon) { + this.options.uploading = 'Amazon S3'; + } + + if (argv.rsync) { + this.options.uploading = 'Rsync'; + } + + if (argv.pages) { + this.options.uploading = 'Github Pages'; + } }, writing: { diff --git a/package.json b/package.json index 2d968f5..c9cf17b 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "istanbul": "^0.4.2", "mocha": "^2.4.5", "mocha-lcov-reporter": "^1.2.0", + "yargs": "^4.6.0", "yeoman-assert": "^2.1.1", "yeoman-test": "^1.1.0", "yo": "^1.7.0"