license_finder 0.4.1 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. data/.gitignore +2 -1
  2. data/.rspec +1 -0
  3. data/{MIT-LICENSE → LICENSE} +1 -1
  4. data/README.markdown +125 -75
  5. data/Rakefile +9 -0
  6. data/features/rake_tasks/action_items.feature +13 -0
  7. data/features/rake_tasks/action_items_ok.feature +20 -0
  8. data/features/rake_tasks/generate_dependencies.feature +31 -0
  9. data/features/rake_tasks/init.feature +19 -0
  10. data/features/step_definitions/steps.rb +131 -0
  11. data/files/license_finder.yml +3 -2
  12. data/lib/license_finder.rb +29 -0
  13. data/lib/license_finder/dependency.rb +13 -14
  14. data/lib/license_finder/dependency_list.rb +23 -5
  15. data/lib/license_finder/finder.rb +6 -19
  16. data/lib/license_finder/gem_spec_details.rb +11 -3
  17. data/lib/license_finder/license_file.rb +21 -7
  18. data/lib/templates/ISC-body +2 -0
  19. data/lib/templates/LGPL-body +165 -0
  20. data/license_finder.gemspec +11 -16
  21. data/spec/fixtures/ISC-LICENSE +10 -0
  22. data/spec/fixtures/isc_licensed_gem/LICENSE +10 -0
  23. data/spec/fixtures/lgpl_licensed_gem/LICENSE +165 -0
  24. data/spec/{dependency_list_spec.rb → lib/license_finder/dependency_list_spec.rb} +26 -23
  25. data/spec/lib/license_finder/dependency_spec.rb +53 -0
  26. data/spec/{file_parser_spec.rb → lib/license_finder/file_parser_spec.rb} +0 -0
  27. data/spec/lib/license_finder/finder_spec.rb +36 -0
  28. data/spec/{gem_spec_details_spec.rb → lib/license_finder/gem_spec_details_spec.rb} +25 -8
  29. data/spec/{license_file_spec.rb → lib/license_finder/license_file_spec.rb} +38 -22
  30. data/spec/lib/license_finder_spec.rb +82 -0
  31. metadata +100 -32
  32. data/lib/license_finder/version.rb +0 -3
  33. data/spec/dependency_spec.rb +0 -57
  34. data/spec/finder_spec.rb +0 -64
@@ -13,7 +13,7 @@ describe LicenseFinder::LicenseFile do
13
13
  it "includes file path" do
14
14
  subject.to_hash['file_name'].should == 'license/path'
15
15
  end
16
-
16
+
17
17
  it "does not include file text by default" do
18
18
  subject.to_hash['text'].should be_nil
19
19
  end
@@ -22,7 +22,7 @@ describe LicenseFinder::LicenseFile do
22
22
  subject.include_license_text = true
23
23
  subject.to_hash['text'].should == 'file text'
24
24
  end
25
-
25
+
26
26
  it "includes data about license" do
27
27
  subject.to_hash.should have_key 'body_type'
28
28
  subject.to_hash.should have_key 'header_type'
@@ -33,26 +33,26 @@ describe LicenseFinder::LicenseFile do
33
33
 
34
34
  context "with MIT like license" do
35
35
  before do
36
- stub(IO).read { File.read(File.join(File.dirname(__FILE__), '/fixtures/MIT-LICENSE')) }
37
- stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '/fixtures/MIT-LICENSE')) }
36
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '../../fixtures/MIT-LICENSE')) }
37
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '../../fixtures/MIT-LICENSE')) }
38
38
  end
39
39
 
40
40
  its(:body_type) { should == 'mit' }
41
41
  its(:header_type) { should == 'mit' }
42
42
  its(:disclaimer_of_liability) { should == 'mit: THE AUTHORS OR COPYRIGHT HOLDERS' }
43
43
  end
44
-
44
+
45
45
  context "with MIT reference in README" do
46
46
  before do
47
- stub(IO).read { File.read(File.join(File.dirname(__FILE__), '/fixtures/README-with-MIT-LICENSE')) }
48
- stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '/fixtures/README-with-MIT-LICENSE')) }
47
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '../../fixtures/README-with-MIT-LICENSE')) }
48
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '../../fixtures/README-with-MIT-LICENSE')) }
49
49
  end
50
50
 
51
51
  its(:body_type) { should == 'other' }
52
52
  its(:header_type) { should == 'mit' }
53
53
  its(:disclaimer_of_liability) { should == 'other' }
54
54
  end
55
-
55
+
56
56
  context "with MIT url in README" do
57
57
  before do
58
58
  stub(IO).read { 'MIT Licence (http://www.opensource.org/licenses/mit-license.html)' }
@@ -62,7 +62,7 @@ describe LicenseFinder::LicenseFile do
62
62
  its(:body_type) { should == 'mit' }
63
63
  its(:disclaimer_of_liability) { should == 'mit: THE AUTHORS OR COPYRIGHT HOLDERS' }
64
64
  end
65
-
65
+
66
66
  context "with ruby url in README" do
67
67
  before do
68
68
  stub(IO).read { "Same as Ruby's \n\nhttp://www.ruby-lang.org/en/LICENSE.txt" }
@@ -73,12 +73,10 @@ describe LicenseFinder::LicenseFile do
73
73
  its(:disclaimer_of_liability) { should == 'other' }
74
74
  end
75
75
 
76
-
77
-
78
76
  context "with Apache like license" do
79
77
  before do
80
- stub(IO).read { File.read(File.join(File.dirname(__FILE__), '/fixtures/APACHE-2-LICENSE')) }
81
- stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '/fixtures/APACHE-2-LICENSE')) }
78
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '../..//fixtures/APACHE-2-LICENSE')) }
79
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '../..//fixtures/APACHE-2-LICENSE')) }
82
80
  end
83
81
 
84
82
  its(:body_type) { should == 'apache' }
@@ -86,13 +84,31 @@ describe LicenseFinder::LicenseFile do
86
84
 
87
85
  context "with GPLv2 like license" do
88
86
  before do
89
- stub(IO).read { File.read(File.join(File.dirname(__FILE__), '/fixtures/GPLv2')) }
90
- stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '/fixtures/GPLv2')) }
87
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '../..//fixtures/GPLv2')) }
88
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '../..//fixtures/GPLv2')) }
91
89
  end
92
90
 
93
91
  its(:body_type) { should == 'gplv2' }
94
92
  end
95
-
93
+
94
+ context "with LGPL like license" do
95
+ before do
96
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'templates', 'LGPL-body')) }
97
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'templates', 'LGPL-body')) }
98
+ end
99
+
100
+ its(:body_type) { should == 'lgpl' }
101
+ end
102
+
103
+ context "with an ISC license" do
104
+ before do
105
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'ISC-LICENSE')) }
106
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'ISC-LICENSE')) }
107
+ end
108
+
109
+ its(:body_type) { should == 'isc' }
110
+ end
111
+
96
112
  context "with another license" do
97
113
  before do
98
114
  stub(IO).read { "a non-standard license" }
@@ -103,31 +119,31 @@ describe LicenseFinder::LicenseFile do
103
119
  its(:header_type) { should == 'other' }
104
120
  its(:disclaimer_of_liability) { should == 'other' }
105
121
  end
106
-
122
+
107
123
  context "with variation in disclaimer of liability" do
108
124
  before do
109
- stub(IO).read { File.read('spec/fixtures/MIT-LICENSE-with-varied-disclaimer') }
110
- stub(IO).binread { File.read('spec/fixtures/MIT-LICENSE-with-varied-disclaimer') }
125
+ stub(IO).read { File.read(File.join(File.dirname(__FILE__), '../../../fixtures/MIT-LICENSE-with-varied-disclaimer')) }
126
+ stub(IO).binread { File.read(File.join(File.dirname(__FILE__), '../../../spec/fixtures/MIT-LICENSE-with-varied-disclaimer')) }
111
127
  end
112
128
 
113
129
  its(:body_type) { should == 'mit' }
114
130
  its(:header_type) { should == 'mit' }
115
131
  its(:disclaimer_of_liability) { should == 'mit: THE AUTHORS' }
116
132
  end
117
-
133
+
118
134
  context "with empty license file" do
119
135
  before do
120
136
  stub(IO).read { "" }
121
137
  stub(IO).binread { "" }
122
138
  end
123
-
139
+
124
140
  describe "#to_hash" do
125
141
  it "is safe" do
126
142
  lambda { subject.to_hash }.should_not raise_error
127
143
  end
128
144
  end
129
145
  end
130
-
146
+
131
147
  describe "with variations on MIT header" do
132
148
  before do
133
149
  stub(IO).read { '(The MIT License)' }
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+
3
+ describe LicenseFinder do
4
+ describe ".config" do
5
+ let(:config) do
6
+ {
7
+ 'whitelist' => %w(MIT Apache),
8
+ 'ignore_groups' => %w(test development)
9
+ }
10
+ end
11
+
12
+ before do
13
+ stub(File).exists?('./config/license_finder.yml') { true }
14
+ stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join { config.to_yaml }
15
+ end
16
+
17
+ after do
18
+ LicenseFinder.instance_variable_set(:@config, nil)
19
+ end
20
+
21
+ it "should handle a missing configuration file" do
22
+ stub(File).exists?('./config/license_finder.yml') { false }
23
+ dont_allow(File).open('./config/license_finder.yml')
24
+
25
+ LicenseFinder.config.whitelist.should == []
26
+ LicenseFinder.config.ignore_groups.should == []
27
+ LicenseFinder.config.dependencies_dir.should == '.'
28
+ end
29
+
30
+ it "should load the configuration exactly once" do
31
+ mock(File).open('./config/license_finder.yml').stub!.readlines.stub!.join { config.to_yaml }
32
+
33
+ LicenseFinder.config.whitelist
34
+
35
+ dont_allow(File).open('./config/license_finder.yml')
36
+
37
+ LicenseFinder.config.whitelist
38
+ end
39
+
40
+ describe "#whitelist" do
41
+ it "should load a whitelist from license_finder.yml" do
42
+ LicenseFinder.config.whitelist.should =~ %w(MIT Apache)
43
+ end
44
+
45
+ it "should load an empty whitelist from license_finder.yml when there are no whitelist items" do
46
+ stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join { config.merge('whitelist' => nil).to_yaml }
47
+
48
+ LicenseFinder.config.whitelist.should =~ []
49
+ end
50
+ end
51
+
52
+ describe "#ignore_groups" do
53
+ it "should load a ignore_groups list from license_finder.yml" do
54
+ LicenseFinder.config.ignore_groups.should == [:test, :development]
55
+ end
56
+
57
+ it "should load an empty ignore_groups list from license_finder.yml when there are no ignore groups" do
58
+ stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join { config.merge('ignore_groups' => nil).to_yaml }
59
+
60
+ LicenseFinder.config.ignore_groups.should == []
61
+ end
62
+ end
63
+
64
+ describe "#dependencies_dir" do
65
+ it 'should allow the dependencies file directory to be configured' do
66
+ stub(File).open('./config/license_finder.yml').stub!.readlines.stub!.join { config.merge('dependencies_file_dir' => './elsewhere').to_yaml }
67
+
68
+ config = LicenseFinder.config
69
+ config.dependencies_dir.should == './elsewhere'
70
+ config.dependencies_yaml.should == './elsewhere/dependencies.yml'
71
+ config.dependencies_text.should == './elsewhere/dependencies.txt'
72
+ end
73
+
74
+ it 'should default the dependency files when the directory is not provided' do
75
+ config = LicenseFinder.config
76
+ config.dependencies_dir.should == '.'
77
+ config.dependencies_yaml.should == './dependencies.yml'
78
+ config.dependencies_text.should == './dependencies.txt'
79
+ end
80
+ end
81
+ end
82
+ end
metadata CHANGED
@@ -1,32 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jacob Maine
9
+ - Matthew Kane Parker
10
+ - Ian Lesperance
11
+ - David Edwards
9
12
  autorequire:
10
13
  bindir: bin
11
14
  cert_chain: []
12
- date: 2012-06-29 00:00:00.000000000 Z
15
+ date: 2012-09-09 00:00:00.000000000 Z
13
16
  dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rails
19
+ requirement: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '3'
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
14
33
  - !ruby/object:Gem::Dependency
15
34
  name: rspec
16
35
  requirement: !ruby/object:Gem::Requirement
17
36
  none: false
18
37
  requirements:
19
- - - ~>
38
+ - - ! '>='
20
39
  - !ruby/object:Gem::Version
21
- version: '2.3'
40
+ version: '0'
22
41
  type: :development
23
42
  prerelease: false
24
43
  version_requirements: !ruby/object:Gem::Requirement
25
44
  none: false
26
45
  requirements:
27
- - - ~>
46
+ - - ! '>='
28
47
  - !ruby/object:Gem::Version
29
- version: '2.3'
48
+ version: '0'
30
49
  - !ruby/object:Gem::Dependency
31
50
  name: rr
32
51
  requirement: !ruby/object:Gem::Requirement
@@ -59,20 +78,59 @@ dependencies:
59
78
  - - ! '>='
60
79
  - !ruby/object:Gem::Version
61
80
  version: '0'
62
- description: Find and display licenses of a project's gem dependencies.
81
+ - !ruby/object:Gem::Dependency
82
+ name: cucumber
83
+ requirement: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ description: Find and display licenses of a project's gem dependencies, so that you
114
+ know what your limitations are when distributing your application.
63
115
  email:
64
- - jacob.maine@gmail.com
116
+ - brent@pivotalabs.com
65
117
  executables:
66
118
  - license_finder
67
119
  extensions: []
68
120
  extra_rdoc_files: []
69
121
  files:
70
122
  - .gitignore
123
+ - .rspec
71
124
  - Gemfile
72
- - MIT-LICENSE
125
+ - LICENSE
73
126
  - README.markdown
74
127
  - Rakefile
75
128
  - bin/license_finder
129
+ - features/rake_tasks/action_items.feature
130
+ - features/rake_tasks/action_items_ok.feature
131
+ - features/rake_tasks/generate_dependencies.feature
132
+ - features/rake_tasks/init.feature
133
+ - features/step_definitions/steps.rb
76
134
  - files/license_finder.yml
77
135
  - lib/license_finder.rb
78
136
  - lib/license_finder/dependency.rb
@@ -82,23 +140,23 @@ files:
82
140
  - lib/license_finder/gem_spec_details.rb
83
141
  - lib/license_finder/license_file.rb
84
142
  - lib/license_finder/railtie.rb
85
- - lib/license_finder/version.rb
86
143
  - lib/tasks/license_finder.rake
87
144
  - lib/templates/Apache-2.0-body
88
145
  - lib/templates/GPL-2.0-body
146
+ - lib/templates/ISC-body
147
+ - lib/templates/LGPL-body
89
148
  - lib/templates/MIT-body
90
149
  - license_finder.gemspec
91
- - spec/dependency_list_spec.rb
92
- - spec/dependency_spec.rb
93
- - spec/file_parser_spec.rb
94
- - spec/finder_spec.rb
95
150
  - spec/fixtures/APACHE-2-LICENSE
96
151
  - spec/fixtures/GPLv2
152
+ - spec/fixtures/ISC-LICENSE
97
153
  - spec/fixtures/MIT-LICENSE
98
154
  - spec/fixtures/MIT-LICENSE-with-varied-disclaimer
99
155
  - spec/fixtures/README-with-MIT-LICENSE
100
156
  - spec/fixtures/apache_licensed_gem/LICENSE
101
157
  - spec/fixtures/gplv2_licensed_gem/LICENSE
158
+ - spec/fixtures/isc_licensed_gem/LICENSE
159
+ - spec/fixtures/lgpl_licensed_gem/LICENSE
102
160
  - spec/fixtures/license_directory/COPYING
103
161
  - spec/fixtures/license_directory/LICENSE/BSD-2-Clause.txt
104
162
  - spec/fixtures/license_directory/LICENSE/GPL-2.0.txt
@@ -121,11 +179,17 @@ files:
121
179
  - spec/fixtures/readme/README
122
180
  - spec/fixtures/readme/Readme.markdown
123
181
  - spec/fixtures/utf8_gem/README
124
- - spec/gem_spec_details_spec.rb
125
- - spec/license_file_spec.rb
182
+ - spec/lib/license_finder/dependency_list_spec.rb
183
+ - spec/lib/license_finder/dependency_spec.rb
184
+ - spec/lib/license_finder/file_parser_spec.rb
185
+ - spec/lib/license_finder/finder_spec.rb
186
+ - spec/lib/license_finder/gem_spec_details_spec.rb
187
+ - spec/lib/license_finder/license_file_spec.rb
188
+ - spec/lib/license_finder_spec.rb
126
189
  - spec/spec_helper.rb
127
- homepage:
128
- licenses: []
190
+ homepage: https://github.com/pivotal/LicenseFinder
191
+ licenses:
192
+ - MIT
129
193
  post_install_message:
130
194
  rdoc_options: []
131
195
  require_paths:
@@ -136,36 +200,35 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
200
  - - ! '>='
137
201
  - !ruby/object:Gem::Version
138
202
  version: '0'
139
- segments:
140
- - 0
141
- hash: 3051374159712377217
142
203
  required_rubygems_version: !ruby/object:Gem::Requirement
143
204
  none: false
144
205
  requirements:
145
206
  - - ! '>='
146
207
  - !ruby/object:Gem::Version
147
208
  version: '0'
148
- segments:
149
- - 0
150
- hash: 3051374159712377217
151
209
  requirements: []
152
- rubyforge_project: license_finder
210
+ rubyforge_project:
153
211
  rubygems_version: 1.8.24
154
212
  signing_key:
155
213
  specification_version: 3
156
- summary: License finding heaven.
214
+ summary: Know your dependencies - and the licenses they are binding your application
215
+ to.
157
216
  test_files:
158
- - spec/dependency_list_spec.rb
159
- - spec/dependency_spec.rb
160
- - spec/file_parser_spec.rb
161
- - spec/finder_spec.rb
217
+ - features/rake_tasks/action_items.feature
218
+ - features/rake_tasks/action_items_ok.feature
219
+ - features/rake_tasks/generate_dependencies.feature
220
+ - features/rake_tasks/init.feature
221
+ - features/step_definitions/steps.rb
162
222
  - spec/fixtures/APACHE-2-LICENSE
163
223
  - spec/fixtures/GPLv2
224
+ - spec/fixtures/ISC-LICENSE
164
225
  - spec/fixtures/MIT-LICENSE
165
226
  - spec/fixtures/MIT-LICENSE-with-varied-disclaimer
166
227
  - spec/fixtures/README-with-MIT-LICENSE
167
228
  - spec/fixtures/apache_licensed_gem/LICENSE
168
229
  - spec/fixtures/gplv2_licensed_gem/LICENSE
230
+ - spec/fixtures/isc_licensed_gem/LICENSE
231
+ - spec/fixtures/lgpl_licensed_gem/LICENSE
169
232
  - spec/fixtures/license_directory/COPYING
170
233
  - spec/fixtures/license_directory/LICENSE/BSD-2-Clause.txt
171
234
  - spec/fixtures/license_directory/LICENSE/GPL-2.0.txt
@@ -188,6 +251,11 @@ test_files:
188
251
  - spec/fixtures/readme/README
189
252
  - spec/fixtures/readme/Readme.markdown
190
253
  - spec/fixtures/utf8_gem/README
191
- - spec/gem_spec_details_spec.rb
192
- - spec/license_file_spec.rb
254
+ - spec/lib/license_finder/dependency_list_spec.rb
255
+ - spec/lib/license_finder/dependency_spec.rb
256
+ - spec/lib/license_finder/file_parser_spec.rb
257
+ - spec/lib/license_finder/finder_spec.rb
258
+ - spec/lib/license_finder/gem_spec_details_spec.rb
259
+ - spec/lib/license_finder/license_file_spec.rb
260
+ - spec/lib/license_finder_spec.rb
193
261
  - spec/spec_helper.rb