Skip to content

Commit

Permalink
Added the ability to include devDependencies in GitHub Pages. Fixes y…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alon Amster committed Jan 15, 2015
1 parent 41fc16a commit 7a70882
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gh/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ module.exports = yeoman.generators.Base.extend({
name: 'elementName',
message: 'What is your element\'s name',
default: defaultName
},
{
name: 'includeDevDeps',

This comment has been minimized.

Copy link
@robdodson

robdodson Jan 15, 2015

Instead of prompting the user for another question, I think we can just turn this on by default.

message: 'Would you like to include the devDependencies from your bower.json file?',
type: 'confirm',
default: false
}
];

this.prompt(prompts, function (props) {
this.ghUser = props.ghUser;
this.elementName = props.elementName;
this.includeDevDeps = props.includeDevDeps ? 'yes' : 'no';

done();
}.bind(this));
Expand All @@ -44,7 +51,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
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ 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, you can include them in the Github pages branch by answering _yes_ to the relevant question.

This comment has been minimized.

Copy link
@robdodson

robdodson Jan 15, 2015

"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
Expand Down

0 comments on commit 7a70882

Please sign in to comment.