Skip to content

Commit

Permalink
Update docs, trim dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Ellis committed Aug 13, 2020
1 parent eb02506 commit 5410c56
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# [Spdx](http://libraries.io/rubygems/spdx) - A SPDX license normalizer

This gem allows you to find the closest match using [FuzzyMatch](https://github.com/seamusabshere/fuzzy_match) in the [spdx-licenses](https://github.com/domcleal/spdx-licenses) list for similar (not necessarily exact) license names.
# [Spdx](http://libraries.io/rubygems/spdx) - A SPDX license parser

This gem allows you validate and parse spdx expressions. It also contains (relatively) up to date license and license exception lists from https://github.com/spdx/license-list-data/tree/master/json
## Installation

Add this line to your application's Gemfile:
Expand All @@ -21,14 +20,25 @@ Or install it yourself as:
## Usage

```ruby
Spdx.find('Apache 2') # => <SpdxLicenses::License:0x007fa3a2b462c8 @id="Apache-2.0", @name="Apache License 2.0", @osi_approved=true>
Spdx.valid_spdx?("(MIT OR AGPL-3.0+)")
=> true
```
```ruby
Spdx.parse_spdx("(MIT OR AGPL-3.0+)")
=> CompoundExpression+CompoundExpression0 offset=0, "((MIT OR AGPL-3.0+))" (body):
Body offset=1, "(MIT OR AGPL-3.0+)":
CompoundExpression+CompoundExpression0 offset=1, "(MIT OR AGPL-3.0+)" (body):
Body offset=2, "MIT OR AGPL-3.0+":
License+License0 offset=2, "MIT"
LogicalOr+Or0 offset=5, " OR " (space1,space2)
License+License0 offset=9, "AGPL-3.0+"
```

## Testing

Run the tests with:

$ bundle exec rake
$ bundle exec rspec

## Contributing

Expand Down
2 changes: 0 additions & 2 deletions lib/spdx.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# frozen_string_literal: true

require "spdx/version"
require "fuzzy_match"
require "spdx_parser"
require "json"
require_relative "exception"
require_relative "license"

# Fuzzy matcher for licenses to SPDX standard licenses
module Spdx
def self.names
(licenses.keys + licenses.map { |_k, v| v["name"] }).sort
Expand Down
2 changes: 1 addition & 1 deletion lib/spdx/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Spdx
VERSION = "3.0.0"
VERSION = "3.0.1"
end
3 changes: 1 addition & 2 deletions spdx.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.version = Spdx::VERSION
spec.authors = ["Tidelift, Inc."]
spec.email = ["[email protected]"]
spec.summary = "A SPDX license normalizer"
spec.summary = "A SPDX license parser"
spec.homepage = "https://github.com/librariesio/spdx"
spec.license = "MIT"

Expand All @@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "fuzzy_match", "~> 2.1"
spec.add_dependency "treetop", "~> 1.6"
spec.add_development_dependency "bundler"
spec.add_development_dependency "pry"
Expand Down

0 comments on commit 5410c56

Please sign in to comment.