Duo's GitHub package installer.
- github-style urls
- semver support
- flexible api
- checks local before fetching remote
- private repo support
var pkg = new Package('matthewmueller/cheerio', '0.13.x')
.token(process.env.token)
.directory('components');
pkg.fetch(function(err) {
if (err) throw err;
console.log('fetched: %s', pkg.slug());
})
initialize a new Package
with name
and ref
, where name
is a github-style url and ref
is either a tag or a branch. ref
supports semver versioning.
Examples:
Package('matthewmueller/uid', '*');
Package('matthewmueller/uid', 'master');
Package('matthewmueller/uid', 'some/feature');
Package('matthewmueller/uid', '~0.1.0');
authenticate with github. you can create a new token here: https://github.com/settings/tokens/new.
set a directory to install the package in.
cache instance created by duo.
Get the path of the fetched package. optionally add a relative path
.
Get or set the user agent header duo-package uses to make requests. defaults to duo-package
.
Resolve a package's version
fetch the package. returns a generator that can be yielded in a generator function or wrapped in co.
yield pkg.fetch()
Return the full package name (ie. component/[email protected]
)
- Matthew Mueller
- Amir Abu Shareb
- Plus many more wonderful contributors!
The MIT License
Copyright © 2014
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.