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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86ddc134de3304378496bf70a06b5c0b1d356c497f8efc2d05302374e558e855
4
- data.tar.gz: 14ad79c931803710aac2010d337eb22d865e158804c48bdd93ba8fdd2919c7ed
3
+ metadata.gz: 816046036a98b7c44fd1c211886443bf60f92c7726245b81878ca20db36cd934
4
+ data.tar.gz: 1f4116b96839c2223cb2204cd58739967d990deaa7979757ad1d57cc69d24be4
5
5
  SHA512:
6
- metadata.gz: 8811aa0cd2824b2c0b865d84ecfa6e1dbec978fb413e905f121dad77373ee7e022a84a5cd231628f8e8303b5290fd7d7800755fbac057a72a23dd5415e44f157
7
- data.tar.gz: d3b0f87a9fb1fb2a1055749ef942d682a75df96cdc39f3bda3f2bf2f1f4cd59d7f9c2c40dc1426605c4497a123312606c587f651eee19c756497123a383ee384
6
+ metadata.gz: a9072fa5c7ff0c084662598811629f4df2771f606b29392fed8050056e5b67c39a60f6502109a40190730323c0bb27da3b66b04a6c1c106b0939e335adff90f4
7
+ data.tar.gz: d8b9bb473167363dbaa484fd8c9b280a2757c1753b23cdcfbe0928c75cd350f3b3c906e535c60668b4bf4ddf4a31485eaaff7c5c8413e88c2ff1de1cf897d70f
data/.rubocop.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  Style/ClassAndModuleChildren:
2
- Exclude:
3
- - "lib/rubygems/commands/license_command.rb"
2
+ Enabled: false
4
3
 
5
- Metrics/LineLength:
6
- Max: 110
4
+ Metrics:
5
+ Enabled: false
data/gem-license.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'gem-license'
5
- spec.version = '0.1.0'
5
+ spec.version = '0.2.0'
6
6
  spec.authors = ['Matt Carey']
7
7
  spec.email = ['matthew.b.carey@gmail.com']
8
8
 
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-license
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Carey