Skip to content

Commit 18e3e6d

Browse files
committed
writing things down
1 parent 14bf419 commit 18e3e6d

File tree

3 files changed

+70
-3
lines changed

3 files changed

+70
-3
lines changed

deploy.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
'use strict';
2+
3+
var ghpages = require('gh-pages');
4+
var RSVP = require('rsvp');
5+
6+
module.exports = {
7+
name: 'ghpages',
8+
aliases: ['gh-pages'],
9+
description: 'Publish to any gh-pages branch on GitHub (or any other branch on any other remote). Build the project before publishing!',
10+
works: 'insideProject',
11+
12+
availableOptions: [{
13+
name: 'repo',
14+
type: String,
15+
default: undefined, // using gh-pages default -- see readme
16+
description: 'The commit message to include with the build, must be wrapped in quotes.'
17+
}, {
18+
name: 'message',
19+
type: String,
20+
default: 'Auto-generated commit',
21+
description: 'The commit message, must be wrapped in quotes.'
22+
}, {
23+
name: 'branch',
24+
type: String,
25+
default: 'gh-pages',
26+
description: 'The git branch to push your pages to'
27+
}, {
28+
name: 'name',
29+
type: String,
30+
default: undefined, // using gh-pages default -- see readme
31+
description: 'The git user-name which is associated with this commit'
32+
}, {
33+
name: 'email',
34+
type: String,
35+
default: undefined, // using gh-pages default -- see readme
36+
description: 'The git user-email which is associated with this commit'
37+
}],
38+
run: function(options, rawArgs) {
39+
40+
var ui = this.ui;
41+
var root = this.project.root;
42+
var dir = path.join(root, 'dist');
43+
44+
options = options || {};
45+
if (options['name'] && options['email']) {
46+
options.user = {
47+
name: options['name'],
48+
email: options['email']
49+
}
50+
};
51+
options.dotfiles = true;
52+
options.silent = true; // hides credentials, if provided via repo URL
53+
54+
if (process.env.TRAVIS) {
55+
options.message += '\n\n' +
56+
'Triggered by commit: https://github.com/' + process.env.TRAVIS_REPO_SLUG + '/commit/' + process.env.TRAVIS_COMMIT + '\n' +
57+
'Travis build: https://travis-ci.org/' + process.env.TRAVIS_REPO_SLUG + '/builds/' + process.env.TRAVIS_BUILD_ID;
58+
}
59+
60+
var publish = RSVP.denodeify(ghpages.publish);
61+
62+
return publish(dir, options)
63+
.then(function(committed) {
64+
ui.write('Successfully published!\n');
65+
});
66+
}
67+
};

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ module.exports = {
33

44
includedCommands: function() {
55
return {
6-
'gh-pages': require('./lib/commands/deploy'),
7-
'ghpages': require('./lib/commands/deploy'),
6+
'ghpages': require('./deploy'),
87
};
98
}
109
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
],
3434
"license": "MIT",
3535
"dependencies": {
36-
"gh-pages": "^0.3.1"
36+
"gh-pages": "^0.11.0",
37+
"rsvp": "^3.0.14"
3738
},
3839
"keywords": ["ember-addon", "angular2", "angular-cli", "git", "gh-pages", "ghpages"]
3940
}

0 commit comments

Comments
 (0)