licensed/README.md

146 строки
6.1 KiB
Markdown
Исходник Обычный вид История

2018-02-20 18:20:41 +03:00
# Licensed
Licensed caches the licenses of dependencies and checks their status.
Licensed is available as a Ruby gem for Ruby environments, and as a self-contained executable for non-Ruby environments.
2018-02-20 18:20:41 +03:00
Licensed is **not** a complete open source license compliance solution. Please understand the important [disclaimer](#disclaimer) below to make appropriate use of Licensed.
## Current Status
2018-03-29 08:44:53 +03:00
[![Build Status](https://travis-ci.org/github/licensed.svg?branch=master)](https://travis-ci.org/github/licensed)
2018-02-20 18:20:41 +03:00
Licensed is in active development and currently used at GitHub. See the [open issues](https://github.com/github/licensed/issues) for a list of potential work.
2019-02-09 10:33:08 +03:00
## Migrating to 2.x
Licensed 2.x is incompatible with configuration files and cached records from 1.x. Migrating to 2.x is easy using the `licensed migrate` command.
See the [migration documentation](./docs/migrating_to_newer_versions.md) for more info, or run `licensed help migrate`.
2018-02-20 18:20:41 +03:00
## Installation
### With a Gemfile
2018-02-20 18:20:41 +03:00
Add this line to your application's Gemfile:
```ruby
gem 'licensed', :group => 'development'
```
And then execute:
```bash
$ bundle
```
### As an executable
Download a package from GitHub and extract the executable. Executable packages are available for each release starting with version 1.2.0.
```bash
$ curl -sSL https://github.com/github/licensed/releases/download/<version>/licensed-<version>-<os>-x64.tar.gz > licensed.tar.gz
$ tar -xzf licensed.tar.gz
$ rm -f licensed.tar.gz
$ ./licensed list
```
For system wide usage, install licensed to a location on `$PATH`, e.g. `/usr/local/bin`.
2018-02-20 18:20:41 +03:00
#### Dependencies
Licensed uses the the `libgit2` bindings for Ruby provided by `rugged`. `rugged` has its own dependencies - `cmake` and `pkg-config` - which you may need to install before you can install Licensed.
For example, on macOS with Homebrew: `brew install cmake pkg-config` and on Ubuntu: `apt-get install cmake pkg-config`.
## Usage
- `licensed list`: Output enumerated dependencies only.
- `licensed cache`: Cache licenses and metadata.
- `licensed status`: Check status of dependencies' cached licenses. For example:
- `licensed version`: Show current installed version of Licensed. Aliases: `-v|--version`
2019-01-28 07:11:48 +03:00
See the [commands documentation](./docs/commands.md) for additional documentation, or run `licensed -h` to see all of the current available commands.
2018-02-20 18:20:41 +03:00
### Configuration
All commands, except `version`, accept a `-c|--config` option to specify a path to a configuration file or directory.
2018-02-20 18:20:41 +03:00
If a directory is specified, `licensed` will look in that directory for a file named (in order of preference):
1. `.licensed.yml`
2. `.licensed.yaml`
3. `.licensed.json`
If the option is not specified, the value will be set to the current directory.
See the [configuration file documentation](./docs/configuration.md) for more details on the configuration format.
### Sources
Dependencies will be automatically detected for all of the following sources by default.
1. [Bower (bower)](./docs/sources/bower.md)
2018-12-31 22:18:13 +03:00
2. [Bundler](./docs/sources/bundler.md)
3. [Cabal (cabal)](./docs/sources/cabal.md)
4. [Go (go)](./docs/sources/go.md)
5. [Go Dep (dep)](./docs/sources/dep.md)
6. [Manifest lists (manifests)](./docs/sources/manifests.md)
7. [NPM (npm)](./docs/sources/npm.md)
8. [Pip (pip)](./docs/sources/pip.md)
9. [Git Submodules (git_submodule)](./docs/sources/git_submodule.md)
2018-02-20 18:20:41 +03:00
You can disable any of them in the configuration file:
```yml
sources:
2018-12-31 22:18:13 +03:00
bundler: false
2018-02-20 18:20:41 +03:00
npm: false
bower: false
cabal: false
```
## Development
2018-05-21 22:27:25 +03:00
To get started after checking out the repo, run
1. `script/bootstrap` to install dependencies
2. `script/setup` to setup test fixtures.
- `script/setup -f` will force a clean test fixture environment
3. `script/cibuild` to run the tests.
You can also run `script/console` for an interactive prompt that will allow you to experiment.
2018-02-20 18:20:41 +03:00
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
#### Adding sources
When adding new dependency sources, ensure that `script/bootstrap` scripting and tests are only run if the required tooling is available on the development machine.
* See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
* Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
```ruby
if Licensed::Shell.tool_available?('bundle')
describe Licensed::Source::Bundler do
...
end
end
```
2019-01-28 07:11:48 +03:00
See the [documentation on adding new sources](./docs/adding_a_new_source.md) for more information.
#### Adding Commands
See the [documentation on commands](./docs/commands.md) for information about adding a new CLI command.
2018-02-20 18:20:41 +03:00
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/github/licensed. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct. See [CONTRIBUTING](CONTRIBUTING.md) for more details.
## Disclaimer
Licensed is **not** a complete open source license compliance solution. Like any bug, licensing issues are far cheaper to fix if found early. Licensed is intended to provide automation around documenting the licenses of dependencies and whether they are configured to be allowed by a user of licensed, in other words, to surface the most obvious licensing issues early.
Licensed is not a substitute for human review of each dependency for licensing or any other issues. It is not the goal of Licensed or GitHub, Inc. to provide legal advice about licensing or any other issues. If you have any questions regarding licensing compliance for your code or any other legal issues relating to it, its up to you to do further research or consult with a professional.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).