gem-license 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -4
- data/gem-license.gemspec +1 -1
- data/lib/rubygems/commands/license_command.rb +23 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 816046036a98b7c44fd1c211886443bf60f92c7726245b81878ca20db36cd934
|
4
|
+
data.tar.gz: 1f4116b96839c2223cb2204cd58739967d990deaa7979757ad1d57cc69d24be4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9072fa5c7ff0c084662598811629f4df2771f606b29392fed8050056e5b67c39a60f6502109a40190730323c0bb27da3b66b04a6c1c106b0939e335adff90f4
|
7
|
+
data.tar.gz: d8b9bb473167363dbaa484fd8c9b280a2757c1753b23cdcfbe0928c75cd350f3b3c906e535c60668b4bf4ddf4a31485eaaff7c5c8413e88c2ff1de1cf897d70f
|
data/.rubocop.yml
CHANGED
data/gem-license.gemspec
CHANGED
@@ -36,6 +36,11 @@ class Gem::Commands::LicenseCommand < Gem::Command
|
|
36
36
|
license_id_rxp = Regexp.new(Regexp.escape(license_id), Regexp::IGNORECASE)
|
37
37
|
matched_ids = id_list.select { |id| id =~ license_id_rxp }
|
38
38
|
|
39
|
+
if matched_ids.empty?
|
40
|
+
say 'Unable to find a matching SPDX identifier'
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
|
39
44
|
perfect_match = matched_ids.find { |id| id =~ /\A#{license_id_rxp}\Z/i }
|
40
45
|
|
41
46
|
unless perfect_match
|
@@ -72,6 +77,24 @@ class Gem::Commands::LicenseCommand < Gem::Command
|
|
72
77
|
|
73
78
|
def execute
|
74
79
|
id = options[:args].first
|
80
|
+
|
81
|
+
if id.nil?
|
82
|
+
say "USAGE: #{usage}"
|
83
|
+
exit
|
84
|
+
end
|
85
|
+
|
75
86
|
download(id)
|
76
87
|
end
|
88
|
+
|
89
|
+
def description
|
90
|
+
'Fetch a LICENSE based on an SPDX identifier'
|
91
|
+
end
|
92
|
+
|
93
|
+
def arguments
|
94
|
+
'SPDX_IDENTIFIER An identifier from SPDX\'s license list https://spdx.org/licenses/'
|
95
|
+
end
|
96
|
+
|
97
|
+
def usage
|
98
|
+
'gem license SPDX_IDENTIFIER'
|
99
|
+
end
|
77
100
|
end
|