Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
Merge pull request #126 from MasterAM/master
Browse files Browse the repository at this point in the history
Added the ability to include devDependencies in GitHub Pages. Fixes #61
  • Loading branch information
robdodson committed Feb 5, 2015
2 parents 369e498 + 05278fa commit 8a07e09
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gh/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ var spawn = require('child_process').spawn;
var rimraf = require('rimraf');

module.exports = yeoman.generators.Base.extend({
constructor: function () {
yeoman.generators.Base.apply(this, arguments);
this.option('nodevdeps', {
desc: 'Whether devDependencies should be installed in the gh-pages branch',
default: false
});
this.includeDevDeps = this.options.nodevdeps ? 'no' : 'yes';
},
askFor: function () {
var done = this.async();

Expand Down Expand Up @@ -44,7 +52,7 @@ module.exports = yeoman.generators.Base.extend({
return this.log(err);
}

var gp = spawn('sh', ['gp.sh', this.ghUser, this.elementName], {cwd: dest});
var gp = spawn('sh', ['gp.sh', this.ghUser, this.elementName, this.includeDevDeps], {cwd: dest});

gp.stdout.on('data', function (data) {
this.log(data.toString());
Expand Down
10 changes: 10 additions & 0 deletions gh/templates/gp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Run in a clean directory passing in a GitHub org and repo name
org=$1
repo=$2
getdevdeps=$3

# make folder (same as input, no checking!)
mkdir $repo
Expand All @@ -26,6 +27,15 @@ bower install --config.directory="components" $org/$repo#master
# redirect by default to the component folder
echo "<META http-equiv="refresh" content=\"0;URL=components/$repo/\">" >index.html


# install the project's dev dependencies
if [ "$getdevdeps" = "yes" ]
then
cd components/$repo
bower install --config.directory="../"
cd ../../
fi

# send it all to github
git add -A .
git commit -am 'seed gh-pages'
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ yo polymer:seed x-foo
### Gh
Generates a Github pages branch for your [seed-element](#seed).

If your documentation or demo pages have dependencies declared as devDependencies in `bower.json`, they will be included in your GitHub pages branch.

Example:
```bash
cd components/x-foo
yo polymer:gh
```

If, for some reason, you don't want the devDependencies, use the `--nodevdeps` option.

## Testing

The project generated by `yo polymer` contains support for [web-component-tester](https://github.com/Polymer/web-component-tester). The following commands are included:
Expand Down

0 comments on commit 8a07e09

Please sign in to comment.