spdx 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57eb1d8fa593ee4d8502733dd5257f050a5a421e8e272036517f146a362f1eea
4
- data.tar.gz: e6d33c4be673643a9e052df93fcac4d41a3c8c809fca6293482979f0ffb62fb1
3
+ metadata.gz: 6b14167134c0066ee60871b43ae1c92508f21f923ff46c6bc71a14a556b3ed73
4
+ data.tar.gz: dcb5aa6f11173a6f88cd036911e1f97211043a8f012984fc8bc0a40311f4886b
5
5
  SHA512:
6
- metadata.gz: 29d8dd9dd27711bc077d2a6828cfa58a8f378a5bcd2e6a0b3915fc070e2561b03b412f7683027985d50624a013310d6e4bdd4f053e3646c4fb659d4675553fd6
7
- data.tar.gz: 03ea3f99549c654a817c53077f584feaacd4a85200f008e987a7aebac684435974269ab6edac88a22d253d78f4dd9171ab12f6713c9241a5cf153966ae8b7863
6
+ metadata.gz: e4d00a4d70c1e83b0d5c2f3703c7037fa0f28febf7d1990b6a1e685a3237b4127cc2645e093592809c33eaff33940d83a690e14dedb0f3b19f38263de975ecaf
7
+ data.tar.gz: 0a64315cec604a279b1f8be2f1d646341e9e9a62471cb3e4d9a2bfdf4fe15a307403ecc8fe8a182a67114731a05c333e25e0a424016bae0e920151a9c69b4fc0
data/lib/spdx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spdx
4
- VERSION = "4.0.0"
4
+ VERSION = "4.0.1"
5
5
  end
data/lib/spdx_parser.rb CHANGED
@@ -11,6 +11,7 @@ class SpdxParser
11
11
  SKIP_PARENS = ["NONE", "NOASSERTION", ""].freeze
12
12
 
13
13
  def self.parse(data)
14
+ data ||= ""
14
15
  parse_tree(data)
15
16
  end
16
17
 
data/spec/spdx_spec.rb CHANGED
@@ -4,6 +4,28 @@ require "spec_helper"
4
4
 
5
5
  describe Spdx do
6
6
  context "spdx parsing" do
7
+ context "parse" do
8
+ it "handles bad input" do
9
+ expect { Spdx.parse(nil) }.to raise_error(SpdxGrammar::SpdxParseError)
10
+ expect { Spdx.parse("") }.to raise_error(SpdxGrammar::SpdxParseError)
11
+ end
12
+ it "parses into respective classes" do
13
+ expect(Spdx.parse("MIT")).to be_an_instance_of(SpdxGrammar::License)
14
+ expect(Spdx.parse("MIT AND Apache-2.0")).to be_an_instance_of(SpdxGrammar::LogicalAnd)
15
+ expect(Spdx.parse("(MIT AND Apache-2.0)")).to be_an_instance_of(SpdxGrammar::LogicalAnd)
16
+ expect(Spdx.parse("MIT OR Apache-2.0")).to be_an_instance_of(SpdxGrammar::LogicalOr)
17
+ expect(Spdx.parse("MIT AND Apache-2.0").left).to be_an_instance_of(SpdxGrammar::License)
18
+ expect(Spdx.parse("MIT AND Apache-2.0").right).to be_an_instance_of(SpdxGrammar::License)
19
+ expect(Spdx.parse("MIT+")).to be_an_instance_of(SpdxGrammar::LicensePlus)
20
+ expect(Spdx.parse("LicenseRef-MIT-style-1")).to be_an_instance_of(SpdxGrammar::LicenseRef)
21
+ expect(Spdx.parse("DocumentRef-something-1:LicenseRef-MIT-style-1")).to be_an_instance_of(SpdxGrammar::DocumentRef)
22
+ expect(Spdx.parse("GPL-2.0-only WITH Classpath-exception-2.0")).to be_an_instance_of(SpdxGrammar::With)
23
+ expect(Spdx.parse("GPL-2.0-only WITH Classpath-exception-2.0").license).to be_an_instance_of(SpdxGrammar::License)
24
+ expect(Spdx.parse("GPL-2.0-only WITH Classpath-exception-2.0").exception).to be_an_instance_of(SpdxGrammar::LicenseException)
25
+ expect(Spdx.parse("NONE")).to be_an_instance_of(SpdxGrammar::None)
26
+ expect(Spdx.parse("NOASSERTION")).to be_an_instance_of(SpdxGrammar::NoAssertion)
27
+ end
28
+ end
7
29
  context "valid?" do
8
30
  it "returns false for invalid spdx" do
9
31
  expect(Spdx.valid?("AND AND")).to be false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spdx
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tidelift, Inc.
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 3.1.2
150
+ rubygems_version: 3.0.8
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: A SPDX license parser