From c817fefcf983595bf31ddcae7df88fc0d3c5ca27 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Sat, 26 Apr 2014 12:51:45 -0300 Subject: [PATCH] Add deploy task to send files to gh-pages branch --- Gruntfile.js | 34 ++++++++++++++++------------------ README.md | 14 ++++++++------ package.json | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 379cf38..beef310 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,7 @@ module.exports = function(grunt) { grunt.initConfig({ - connect: { + 'connect': { demo: { options: { open: true, @@ -9,7 +9,17 @@ module.exports = function(grunt) { } } }, - replace: { + 'gh-pages': { + options: { + clone: 'bower_components/hello-world-polymer' + }, + src: [ + 'bower_components/**/*', + '!bower_components/hello-world-polymer/**/*', + 'src/*', 'index.html' + ] + }, + 'replace': { example: { src: ['src/*'], dest: 'dist/', @@ -18,27 +28,15 @@ module.exports = function(grunt) { to: '..' }] } - }, - bump: { - options: { - commit: true, - commitFiles: ['bower.json', 'package.json'], - commitMessage: 'Release v%VERSION%', - createTag: true, - files: ['bower.json', 'package.json'], - push: true, - pushTo: 'origin gh-pages', - tagMessage: '', - tagName: 'v%VERSION%' - } } }); - grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('grunt-contrib-connect'); + grunt.loadNpmTasks('grunt-gh-pages'); grunt.loadNpmTasks('grunt-text-replace'); - grunt.registerTask('default', ['connect']); - grunt.registerTask('build', ['replace']); + grunt.registerTask('build', ['replace']); + grunt.registerTask('deploy', ['gh-pages']); + grunt.registerTask('server', ['connect']); }; diff --git a/README.md b/README.md index 290cc05..8abb575 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Install the component using [Bower](http://bower.io/): $ bower install hello-world-polymer --save ``` -Or [download as ZIP](https://github.com/webcomponents/hello-world-polymer/archive/gh-pages.zip). +Or [download as ZIP](https://github.com/webcomponents/hello-world-polymer/archive/master.zip). ## Usage @@ -63,17 +63,19 @@ In order to run it locally you'll need to fetch some dependencies and a basic se 3. To test your project, start the development server and open `http://localhost:8000`. ```sh - $ grunt + $ grunt server ``` -4. To publish a new version, build the distribution files, bump package version, create tag, commit and push. +4. To build the distribution files before releasing a new version. ```sh $ grunt build + ``` + +5. To provide a live demo, send everything to `gh-pages` branch. - $ grunt bump # v0.0.1 - $ grunt bump:minor # v0.1.0 - $ grunt bump:major # v1.0.0 + ```sh + $ grunt deploy ``` ## Contributing diff --git a/package.json b/package.json index a5286b0..3ba14c3 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "private": true, "devDependencies": { "grunt": "~0.4.1", - "grunt-bump": "~0.0.13", "grunt-cli": "~0.1.9", "grunt-contrib-connect": "~0.7.1", + "grunt-gh-pages": "~0.9.1", "grunt-text-replace": "~0.3.11" } }