Skip to content

Commit

Permalink
Merge pull request #170 from tschaub/integration
Browse files Browse the repository at this point in the history
Integration tests
  • Loading branch information
tschaub authored May 8, 2017
2 parents 120b752 + 41898cc commit 08fc3f6
Show file tree
Hide file tree
Showing 16 changed files with 472 additions and 252 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
dist: trusty
sudo: false

language: node_js
node_js:
- "6"
Expand Down
117 changes: 63 additions & 54 deletions bin/gh-pages
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,69 @@
var ghpages = require('../lib/index');
var program = require('commander');
var path = require('path');
var pkg = require('../package.json');

program
.version(require('../package').version)
.option('-d, --dist <dist>', 'base directory for all source files')
.option(
'-s, --src <src>',
'pattern used to select which files should be published',
'**/*'
)
.option('-r, --repo <repo>', "URL of the repository you'll be pushing to")
.option('-x, --silent', 'Do not output the repository url')
.option(
'-b, --branch <branch>',
"name of the branch you'll be pushing to",
'gh-pages'
)
.option('-o, --remote <name>', 'The name of the remote', 'origin')
.option('-m, --message <message>', 'commit message', 'Updates')
.option('-g, --tag <tag>', 'add tag to commit')
.option('-p, --depth <depth>', 'depth for clone', 1)
.option('-t, --dotfiles', 'Include dotfiles')
.option('-a, --add', 'Only add, and never remove existing files.')
.option(
'-v, --remove <pattern>',
'Remove files that match the given pattern ' +
'(ignored if used together with --add).',
'.'
)
.option('-n, --no-push', 'Commit only (with no push)')
.parse(process.argv);
function main(args) {
program
.version(pkg.version)
.option('-d, --dist <dist>', 'base directory for all source files')
.option(
'-s, --src <src>',
'pattern used to select which files should be published',
'**/*'
)
.option('-r, --repo <repo>', "URL of the repository you'll be pushing to")
.option('-x, --silent', 'Do not output the repository url')
.option(
'-b, --branch <branch>',
"name of the branch you'll be pushing to",
'gh-pages'
)
.option('-o, --remote <name>', 'The name of the remote', 'origin')
.option('-m, --message <message>', 'commit message', 'Updates')
.option('-g, --tag <tag>', 'add tag to commit')
.option('-p, --depth <depth>', 'depth for clone', 1)
.option('-t, --dotfiles', 'Include dotfiles')
.option('-a, --add', 'Only add, and never remove existing files.')
.option(
'-v, --remove <pattern>',
'Remove files that match the given pattern ' +
'(ignored if used together with --add).',
'.'
)
.option('-n, --no-push', 'Commit only (with no push)')
.parse(args);

ghpages.publish(
path.join(process.cwd(), program.dist),
{
repo: program.repo,
silent: !!program.silent,
branch: program.branch,
src: program.src,
message: program.message,
tag: program.tag,
dotfiles: !!program.dotfiles,
add: !!program.add,
only: program.remove,
remote: program.remote,
push: !!program.push,
logger: function(message) {
process.stderr.write(message + '\n');
ghpages.publish(
path.join(process.cwd(), program.dist),
{
repo: program.repo,
silent: !!program.silent,
branch: program.branch,
src: program.src,
message: program.message,
tag: program.tag,
dotfiles: !!program.dotfiles,
add: !!program.add,
only: program.remove,
remote: program.remote,
push: !!program.push,
logger: function(message) {
process.stderr.write(message + '\n');
}
},
function(err) {
if (err) {
process.stderr.write(err.message + '\n');
return process.exit(1);
}
process.stderr.write('Published\n');
}
},
function(err) {
if (err) {
process.stderr.write(err.message + '\n');
return process.exit(1);
}
process.stderr.write('Published\n');
}
);
);
}

if (require.main === module) {
main(process.argv);
}

module.exports = main;
Loading

0 comments on commit 08fc3f6

Please sign in to comment.