examinator v1.1.0
Examinator
Extract a git repository's metadata relying on open source conventions
Installation
Install examinator by running:
npm install --save examinatorDocumentation
- examinator
- .local(gitRepository, options) ⇒ Promise
- .remote(gitRepository, options) ⇒ Promise
examinator.local(gitRepository, options) ⇒ Promise
Kind: static method of examinator
Summary: Examine a local git repository directory
Access: public
Fulfil: Object - examination results
| Param | Type | Description |
|---|---|---|
| gitRepository | String | path to git repository |
| options | Object | options |
| options.reference | String | git reference to check |
| options.progress | function | progress callback (state) |
Example
examinator.local('./foo/bar/baz', {
reference: 'master',
progress: (state) => {
console.log(state.percentage)
}
}).then((results) => {
console.log(results)
})examinator.remote(gitRepository, options) ⇒ Promise
If $GITHUB_TOKEN is set, it will be used to authenticate with
GitHub to increase rate-limiting.
Kind: static method of examinator
Summary: Examine a remote git repository url
Access: public
Fulfil: Object - examination results
| Param | Type | Description |
|---|---|---|
| gitRepository | String | git repository url |
| options | Object | options |
| options.reference | String | git reference to check |
| options.progress | function | progress callback (state) |
Example
examinator.remote('git@github.com:foo/bar.git', {
reference: 'master',
progress: (state) => {
console.log(state.percentage)
}
}).then((results) => {
console.log(results)
})Tests
Our test suite contains integration test cases that run this module against
real projects. For that reason, we maintain a set of git submodules in
test/repositories, where the actual test cases that assert their results live
in test/e2e.
- Fetch all git submodules
git submodule update --init --recursiveSet
$GITHUB_TOKEN, to increase rate-limitingRun the
testnpm script:
npm testYou may enable debug information by setting DEBUG=examinator*.
Contribute
- Issue Tracker: github.com/resin-io-modules/examinator/issues
- Source Code: github.com/resin-io-modules/examinator
Before submitting a PR, please make sure that you include tests, and that the linter runs without any warning:
npm run lintOne of the most valuable things you can contribute to this project is implement or improve plugins, which are small functions whose duty is to extract a certain facet about the repository, like license information.
Create a new file in
lib/plugins, likemyplugin.jsExport a function that takes a single argument,
backend, which contains every function you need to interact with a git repository, like reading a file
Make sure you use the backend object instead of falling back to fs or an
API call, so the plugin works fine in both local and remote modes.
You can do whatever you need here, including checking out other branches.
examinator will make sure the project is properly reset before calling
another plugin.
Add the new plugin to
BUILTIN_PLUGINSinlib/index.jsUpdate test cases in
test/e2e
Support
If you're having any problem, please raise an issue on GitHub.
License
This project is free software, and may be redistributed under the terms specified in the license.