license_finder 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +8 -0
  3. data/features/cli.feature +11 -1
  4. data/features/html_report.feature +1 -1
  5. data/features/ignore_bundle_groups.feature +15 -2
  6. data/features/step_definitions/approve_dependencies_steps.rb +1 -1
  7. data/features/step_definitions/cli_steps.rb +17 -1
  8. data/features/step_definitions/html_report_steps.rb +1 -1
  9. data/features/step_definitions/ignore_bundle_groups_steps.rb +18 -2
  10. data/features/step_definitions/non_bundler_steps.rb +4 -4
  11. data/features/step_definitions/rails_rake_steps.rb +1 -1
  12. data/features/step_definitions/set_license_steps.rb +2 -2
  13. data/features/step_definitions/shared_steps.rb +4 -12
  14. data/features/step_definitions/whitelist_steps.rb +33 -2
  15. data/features/whitelist.feature +19 -1
  16. data/lib/license_finder.rb +4 -0
  17. data/lib/license_finder/bundle.rb +3 -1
  18. data/lib/license_finder/bundled_gem.rb +1 -1
  19. data/lib/license_finder/bundled_gem_saver.rb +35 -12
  20. data/lib/license_finder/cli.rb +75 -4
  21. data/lib/license_finder/configuration.rb +12 -5
  22. data/lib/license_finder/dependency_manager.rb +1 -2
  23. data/lib/license_finder/license/new_bsd.rb +19 -0
  24. data/license_finder.gemspec +3 -2
  25. data/readme.md +47 -1
  26. data/release.md +7 -2
  27. data/spec/lib/license_finder/bundled_gem_saver_spec.rb +131 -84
  28. data/spec/lib/license_finder/cli_spec.rb +78 -6
  29. data/spec/lib/license_finder/configuration_spec.rb +38 -6
  30. data/spec/lib/license_finder/dependency_manager_spec.rb +1 -1
  31. data/spec/lib/license_finder/license/new_bsd_spec.rb +28 -0
  32. data/spec/lib/license_finder_spec.rb +1 -1
  33. data/spec/spec_helper.rb +0 -1
  34. metadata +6 -6
@@ -59,14 +59,46 @@ module LicenseFinder
59
59
  end
60
60
  end
61
61
 
62
- describe "#ignore_groups" do
63
- it "should default to an empty array" do
64
- config.ignore_groups.should == []
62
+ describe "#save" do
63
+ let(:tmp_yml) { '.tmp.configuration_spec.yml' }
64
+
65
+ before do
66
+ Configuration.stub(:config_file_path).and_return(tmp_yml)
67
+ config.whitelist = ['my_gem']
68
+ config.ignore_groups = ['other_group', 'test']
69
+ end
70
+
71
+ after do
72
+ File.delete(tmp_yml)
73
+ end
74
+
75
+ it "writes the whitelist to the yaml file" do
76
+ config.save
77
+
78
+ yaml = YAML.load(File.read(tmp_yml))
79
+
80
+ yaml["whitelist"].should include("my_gem")
65
81
  end
66
82
 
67
- it "should always return symbolized versions of the ignore groups" do
68
- config.ignore_groups = %w[test development]
69
- config.ignore_groups.should == [:test, :development]
83
+ it "writes the ignored bundler groups to the yaml file" do
84
+ config.save
85
+
86
+ yaml = YAML.load(File.read(tmp_yml))
87
+
88
+ yaml["ignore_groups"].should include("other_group")
89
+ yaml["ignore_groups"].should include("test")
90
+ end
91
+
92
+ it "doesn't write duplicate entries" do
93
+ config.whitelist << 'my_gem'
94
+ config.ignore_groups << 'test'
95
+
96
+ config.save
97
+
98
+ yaml = YAML.load(File.read(tmp_yml))
99
+
100
+ yaml["whitelist"].count("my_gem").should == 1
101
+ yaml["ignore_groups"].count("test").should == 1
70
102
  end
71
103
  end
72
104
  end
@@ -22,7 +22,7 @@ module LicenseFinder
22
22
  double(:gem1, save_as_dependency: cur1),
23
23
  double(:gem2, save_as_dependency: cur2)
24
24
  ]
25
- Bundle.stub(:current_gems) { current_gems }
25
+ LicenseFinder.stub(:current_gems) { current_gems }
26
26
 
27
27
  described_class.sync_with_bundler
28
28
  Dependency.all.map(&:name).should =~ [cur1, cur2, man1].map(&:name)
@@ -18,6 +18,34 @@ modification, are permitted provided that the following conditions are met:
18
18
  names of its contributors may be used to endorse or promote products
19
19
  derived from this software without specific prior written permission.
20
20
 
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ DISCLAIMED. IN NO EVENT SHALL Johnny %$#!.43298432, Guitar BE LIABLE FOR ANY
25
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ LICENSE
32
+
33
+ license.should be_matches
34
+ end
35
+
36
+ it "should match with the alternate wording of third clause" do
37
+ license = LicenseFinder::License::NewBSD.new <<-LICENSE
38
+ Redistribution and use in source and binary forms, with or without
39
+ modification, are permitted provided that the following conditions are met:
40
+ * Redistributions of source code must retain the above copyright
41
+ notice, this list of conditions and the following disclaimer.
42
+ * Redistributions in binary form must reproduce the above copyright
43
+ notice, this list of conditions and the following disclaimer in the
44
+ documentation and/or other materials provided with the distribution.
45
+ * The names of its contributors may not be used to endorse or promote
46
+ products derived from this software without specific prior written
47
+ permission.
48
+
21
49
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
50
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
51
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -49,7 +49,7 @@ describe LicenseFinder do
49
49
 
50
50
  describe "#ignore_groups" do
51
51
  it "should load a ignore_groups list from license_finder.yml" do
52
- LicenseFinder.config.ignore_groups.should == [:test, :development]
52
+ LicenseFinder.config.ignore_groups.should == ["test", "development"]
53
53
  end
54
54
 
55
55
  it "should load an empty ignore_groups list from license_finder.yml when there are no ignore groups" do
@@ -2,7 +2,6 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
4
  require 'license_finder'
5
-
6
5
  require 'rspec'
7
6
 
8
7
  Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each do |file|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Maine
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2013-07-09 00:00:00.000000000 Z
18
+ date: 2013-07-16 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -60,7 +60,7 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: sqlite3
63
+ name: rake
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '>='
@@ -74,13 +74,13 @@ dependencies:
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
- name: rspec
77
+ name: sqlite3
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- type: :development
83
+ type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
@@ -88,7 +88,7 @@ dependencies:
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  - !ruby/object:Gem::Dependency
91
- name: rake
91
+ name: rspec
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '>='