Skip to content

Commit 5410c56

Browse files
author
Matt Ellis
committed
Update docs, trim dependencies
1 parent eb02506 commit 5410c56

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# [Spdx](http://libraries.io/rubygems/spdx) - A SPDX license normalizer
2-
3-
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.
1+
# [Spdx](http://libraries.io/rubygems/spdx) - A SPDX license parser
42

3+
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
54
## Installation
65

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

2322
```ruby
24-
Spdx.find('Apache 2') # => <SpdxLicenses::License:0x007fa3a2b462c8 @id="Apache-2.0", @name="Apache License 2.0", @osi_approved=true>
23+
Spdx.valid_spdx?("(MIT OR AGPL-3.0+)")
24+
=> true
25+
```
26+
```ruby
27+
Spdx.parse_spdx("(MIT OR AGPL-3.0+)")
28+
=> CompoundExpression+CompoundExpression0 offset=0, "((MIT OR AGPL-3.0+))" (body):
29+
Body offset=1, "(MIT OR AGPL-3.0+)":
30+
CompoundExpression+CompoundExpression0 offset=1, "(MIT OR AGPL-3.0+)" (body):
31+
Body offset=2, "MIT OR AGPL-3.0+":
32+
License+License0 offset=2, "MIT"
33+
LogicalOr+Or0 offset=5, " OR " (space1,space2)
34+
License+License0 offset=9, "AGPL-3.0+"
2535
```
2636

2737
## Testing
2838

2939
Run the tests with:
3040

31-
$ bundle exec rake
41+
$ bundle exec rspec
3242

3343
## Contributing
3444

lib/spdx.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# frozen_string_literal: true
22

33
require "spdx/version"
4-
require "fuzzy_match"
54
require "spdx_parser"
65
require "json"
76
require_relative "exception"
87
require_relative "license"
98

10-
# Fuzzy matcher for licenses to SPDX standard licenses
119
module Spdx
1210
def self.names
1311
(licenses.keys + licenses.map { |_k, v| v["name"] }).sort

lib/spdx/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Spdx
4-
VERSION = "3.0.0"
4+
VERSION = "3.0.1"
55
end

spdx.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
99
spec.version = Spdx::VERSION
1010
spec.authors = ["Tidelift, Inc."]
1111
spec.email = ["support@tidelift.com"]
12-
spec.summary = "A SPDX license normalizer"
12+
spec.summary = "A SPDX license parser"
1313
spec.homepage = "https://github.com/librariesio/spdx"
1414
spec.license = "MIT"
1515

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

21-
spec.add_dependency "fuzzy_match", "~> 2.1"
2221
spec.add_dependency "treetop", "~> 1.6"
2322
spec.add_development_dependency "bundler"
2423
spec.add_development_dependency "pry"

0 commit comments

Comments
 (0)