integrated changes from lelandmiller:base-dir
This commit is contained in:
parent
e0f90a8ec2
commit
fde7245554
2 changed files with 24 additions and 2 deletions
|
@ -57,6 +57,7 @@ exports.publish = function publish(basePath, config, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
|
dest: '.',
|
||||||
add: false,
|
add: false,
|
||||||
git: 'git',
|
git: 'git',
|
||||||
clone: getCacheDir(),
|
clone: getCacheDir(),
|
||||||
|
@ -168,14 +169,17 @@ exports.publish = function publish(basePath, config, callback) {
|
||||||
.then(function() {
|
.then(function() {
|
||||||
if (!options.add) {
|
if (!options.add) {
|
||||||
log('Removing files');
|
log('Removing files');
|
||||||
return git.rm(only.join(' '), options.clone);
|
var outputFiles = only.map(function(file) {
|
||||||
|
return path.join(options.dest, file);
|
||||||
|
});
|
||||||
|
return git.rm(outputFiles.join(' '), options.clone);
|
||||||
} else {
|
} else {
|
||||||
return Q.resolve();
|
return Q.resolve();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
log('Copying files');
|
log('Copying files');
|
||||||
return copy(files, basePath, options.clone);
|
return copy(files, basePath, path.join(options.clone, options.dest));
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
log('Adding all');
|
log('Adding all');
|
||||||
|
|
18
readme.md
18
readme.md
|
@ -299,6 +299,24 @@ ghpages.publish(path.join(__dirname, 'build'), {
|
||||||
}, callback);
|
}, callback);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### <a id="optionsdest">options.dest</a>
|
||||||
|
* type: `string`
|
||||||
|
* default: `'.'`
|
||||||
|
|
||||||
|
The destination folder within the destination branch/repository.
|
||||||
|
|
||||||
|
Example use of the `dest` option:
|
||||||
|
|
||||||
|
```js
|
||||||
|
/**
|
||||||
|
* Place content in the static/project subdirectory of the target
|
||||||
|
* branch/repository. If removing files, only remove static/project.
|
||||||
|
*/
|
||||||
|
ghpages.publish(path.join(__dirname, 'build'), {
|
||||||
|
dest: 'static/project'
|
||||||
|
}, callback);
|
||||||
|
```
|
||||||
|
|
||||||
## Command Line Utility
|
## Command Line Utility
|
||||||
|
|
||||||
Installing the package creates a `gh-pages` command line utility. Run `gh-pages --help` to see a list of supported options.
|
Installing the package creates a `gh-pages` command line utility. Run `gh-pages --help` to see a list of supported options.
|
||||||
|
|
Reference in a new issue