license_finder 1.1.1-java → 1.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.rdoc +10 -0
- data/Gemfile +1 -1
- data/README.md +363 -0
- data/Rakefile +30 -1
- data/TODO.md +28 -0
- data/bin/license_finder_pip.py +18 -0
- data/db/migrate/201410031451_rename_dependency_license_name.rb +6 -0
- data/features/multiple_licenses.feature +9 -0
- data/features/step_definitions/cli_steps.rb +9 -9
- data/features/step_definitions/cocoapod_steps.rb +1 -1
- data/features/step_definitions/configure_bundler_groups_steps.rb +3 -3
- data/features/step_definitions/configure_whitelist_steps.rb +4 -4
- data/features/step_definitions/gradle_steps.rb +1 -1
- data/features/step_definitions/manually_added_steps.rb +3 -3
- data/features/step_definitions/manually_approved_steps.rb +5 -5
- data/features/step_definitions/manually_assigned_license_steps.rb +4 -4
- data/features/step_definitions/maven_steps.rb +1 -1
- data/features/step_definitions/multiple_licenses_steps.rb +14 -0
- data/features/step_definitions/node_steps.rb +1 -1
- data/features/step_definitions/python_steps.rb +1 -1
- data/features/step_definitions/report_csv_steps.rb +3 -3
- data/features/step_definitions/report_html_steps.rb +5 -5
- data/features/step_definitions/shared_steps.rb +23 -6
- data/lib/license_finder.rb +3 -0
- data/lib/license_finder/cli.rb +13 -34
- data/lib/license_finder/configuration.rb +8 -4
- data/lib/license_finder/dependency_manager.rb +25 -15
- data/lib/license_finder/license.rb +8 -0
- data/lib/license_finder/logger.rb +59 -0
- data/lib/license_finder/package.rb +37 -30
- data/lib/license_finder/package_manager.rb +20 -0
- data/lib/license_finder/package_managers/bower.rb +4 -9
- data/lib/license_finder/package_managers/bower_package.rb +2 -1
- data/lib/license_finder/package_managers/bundler.rb +26 -41
- data/lib/license_finder/package_managers/bundler_package.rb +6 -3
- data/lib/license_finder/package_managers/cocoa_pods.rb +18 -10
- data/lib/license_finder/package_managers/cocoa_pods_package.rb +4 -3
- data/lib/license_finder/package_managers/gradle.rb +7 -11
- data/lib/license_finder/package_managers/gradle_package.rb +2 -7
- data/lib/license_finder/package_managers/maven.rb +5 -9
- data/lib/license_finder/package_managers/maven_package.rb +4 -8
- data/lib/license_finder/package_managers/npm.rb +6 -10
- data/lib/license_finder/package_managers/npm_package.rb +2 -1
- data/lib/license_finder/package_managers/pip.rb +11 -24
- data/lib/license_finder/package_managers/pip_package.rb +2 -1
- data/lib/license_finder/package_saver.rb +2 -2
- data/lib/license_finder/platform.rb +4 -0
- data/lib/license_finder/possible_license_file.rb +4 -0
- data/lib/license_finder/possible_license_files.rb +2 -1
- data/lib/license_finder/reports/detailed_text_report.rb +1 -1
- data/lib/license_finder/reports/formatted_report.rb +1 -1
- data/lib/license_finder/tables/dependency.rb +22 -12
- data/lib/license_finder/yml_to_sql.rb +1 -1
- data/lib/templates/html_report.erb +4 -4
- data/lib/templates/markdown_report.erb +4 -4
- data/lib/templates/text_report.erb +1 -1
- data/license_finder.gemspec +28 -12
- data/spec/lib/license_finder/cli_spec.rb +193 -185
- data/spec/lib/license_finder/configuration_spec.rb +46 -47
- data/spec/lib/license_finder/dependency_manager_spec.rb +48 -44
- data/spec/lib/license_finder/license/definitions_spec.rb +26 -26
- data/spec/lib/license_finder/license_spec.rb +25 -25
- data/spec/lib/license_finder/package_managers/bower_package_spec.rb +33 -17
- data/spec/lib/license_finder/package_managers/bower_spec.rb +35 -35
- data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +20 -15
- data/spec/lib/license_finder/package_managers/bundler_spec.rb +12 -19
- data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +8 -5
- data/spec/lib/license_finder/package_managers/cocoa_pods_spec.rb +20 -22
- data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +8 -5
- data/spec/lib/license_finder/package_managers/gradle_spec.rb +20 -20
- data/spec/lib/license_finder/package_managers/maven_package_spec.rb +8 -5
- data/spec/lib/license_finder/package_managers/maven_spec.rb +18 -18
- data/spec/lib/license_finder/package_managers/npm_package_spec.rb +36 -17
- data/spec/lib/license_finder/package_managers/npm_spec.rb +17 -17
- data/spec/lib/license_finder/package_managers/pip_package_spec.rb +16 -10
- data/spec/lib/license_finder/package_managers/pip_spec.rb +21 -18
- data/spec/lib/license_finder/package_saver_spec.rb +15 -25
- data/spec/lib/license_finder/possible_license_file_spec.rb +5 -4
- data/spec/lib/license_finder/possible_license_files_spec.rb +11 -5
- data/spec/lib/license_finder/reports/detailed_text_report_spec.rb +3 -3
- data/spec/lib/license_finder/reports/html_report_spec.rb +23 -23
- data/spec/lib/license_finder/reports/markdown_report_spec.rb +12 -12
- data/spec/lib/license_finder/reports/reporter_spec.rb +11 -11
- data/spec/lib/license_finder/reports/text_report_spec.rb +3 -3
- data/spec/lib/license_finder/tables/dependency_spec.rb +59 -41
- data/spec/lib/license_finder/yml_to_sql_spec.rb +21 -21
- data/spec/lib/license_finder_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -13
- data/spec/support/shared_examples_for_package.rb +46 -0
- data/spec/support/shared_examples_for_package_manager.rb +15 -0
- metadata +19 -100
- data/readme.md +0 -259
@@ -52,7 +52,7 @@
|
|
52
52
|
<a href='#<%= dependency.name %>'>
|
53
53
|
<%= dependency.name %>
|
54
54
|
</a>
|
55
|
-
(<%= dependency.
|
55
|
+
(<%= dependency.licenses.map(&:name).join(', ') %>)
|
56
56
|
</li>
|
57
57
|
<% end -%>
|
58
58
|
</ul>
|
@@ -66,7 +66,7 @@
|
|
66
66
|
<blockquote class="pull-right">
|
67
67
|
<% if dependency.approved_manually? -%>
|
68
68
|
<p>
|
69
|
-
|
69
|
+
<%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %>
|
70
70
|
manually approved
|
71
71
|
<span class="badge badge-success">✓</span>
|
72
72
|
</p>
|
@@ -79,13 +79,13 @@
|
|
79
79
|
</small>
|
80
80
|
<% elsif dependency.whitelisted? -%>
|
81
81
|
<p>
|
82
|
-
<%= link_to_license(
|
82
|
+
<%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %>
|
83
83
|
whitelisted
|
84
84
|
<span class="badge badge-success">✓</span>
|
85
85
|
</p>
|
86
86
|
<% else -%>
|
87
87
|
<p>
|
88
|
-
<%= link_to_license(
|
88
|
+
<%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %>
|
89
89
|
unapproved
|
90
90
|
<span class="badge badge-important">✗</span>
|
91
91
|
</p>
|
@@ -12,7 +12,7 @@ As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %>. <%= dependencies.size %> to
|
|
12
12
|
<%= unapproved_dependencies.size %> *unapproved*
|
13
13
|
|
14
14
|
<% unapproved_dependencies.each do |dependency| -%>
|
15
|
-
* <a href='#<%= dependency.name %>'><%= dependency.name %></a> (<%= dependency.
|
15
|
+
* <a href='#<%= dependency.name %>'><%= dependency.name %></a> (<%= dependency.licenses.map(&:name) %>)
|
16
16
|
<% end %>
|
17
17
|
<% end -%>
|
18
18
|
|
@@ -25,15 +25,15 @@ As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %>. <%= dependencies.size %> to
|
|
25
25
|
#### <%= dependency.summary %>
|
26
26
|
|
27
27
|
<% if dependency.approved_manually? -%>
|
28
|
-
<%= link_to_license(
|
28
|
+
<%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %> manually approved
|
29
29
|
|
30
30
|
><%= dependency.manual_approval.notes %>
|
31
31
|
|
32
32
|
><cite> <%= dependency.manual_approval.approver %> <%= dependency.manual_approval.safe_created_at.to_date %></cite>
|
33
33
|
<% elsif dependency.whitelisted? -%>
|
34
|
-
<%= link_to_license(
|
34
|
+
<%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %> whitelisted
|
35
35
|
<% else -%>
|
36
|
-
<%= link_to_license(
|
36
|
+
<%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %> _**unapproved**_
|
37
37
|
<% end -%>
|
38
38
|
|
39
39
|
<% if dependency.description -%>
|
data/license_finder.gemspec
CHANGED
@@ -3,18 +3,33 @@ require './lib/license_finder/platform'
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.required_ruby_version = '>= 1.9.3'
|
5
5
|
s.name = "license_finder"
|
6
|
-
s.version = "1.
|
7
|
-
|
6
|
+
s.version = "1.2"
|
7
|
+
|
8
|
+
s.authors = [
|
9
|
+
"Jacob Maine",
|
10
|
+
"Matthew Kane Parker",
|
11
|
+
"Ian Lesperance",
|
12
|
+
"David Edwards",
|
13
|
+
"Paul Meskers",
|
14
|
+
"Brent Wheeldon",
|
15
|
+
"Trevor John",
|
16
|
+
"David Tengdin",
|
17
|
+
"William Ramsey",
|
18
|
+
"David Dening",
|
19
|
+
"Geoff Pleiss",
|
20
|
+
"Mike Chinigo",
|
21
|
+
"Mike Dalessio"
|
22
|
+
]
|
23
|
+
|
8
24
|
s.email = ["commoncode@pivotalabs.com"]
|
9
25
|
s.homepage = "https://github.com/pivotal/LicenseFinder"
|
10
26
|
s.summary = "Audit the OSS licenses of your application's dependencies."
|
11
27
|
|
12
28
|
s.description = <<-DESCRIPTION
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
licenses that fall outside of the whitelist.
|
29
|
+
LicenseFinder works with your package managers to find
|
30
|
+
dependencies, detect the licenses of the packages in them, compare
|
31
|
+
those licenses against a user-defined whitelist, and give you an
|
32
|
+
actionable exception report.
|
18
33
|
DESCRIPTION
|
19
34
|
|
20
35
|
s.license = "MIT"
|
@@ -26,14 +41,15 @@ Gem::Specification.new do |s|
|
|
26
41
|
s.add_dependency "xml-simple"
|
27
42
|
s.add_dependency LicenseFinder::Platform.sqlite_gem
|
28
43
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
44
|
+
s.add_development_dependency "rake"
|
45
|
+
s.add_development_dependency "rspec-its"
|
46
|
+
s.add_development_dependency "xpath"
|
47
|
+
s.add_development_dependency "cucumber"
|
48
|
+
s.add_development_dependency "pry"
|
33
49
|
s.add_development_dependency "rspec", "~> 3"
|
34
50
|
s.add_development_dependency "capybara", "~> 2.0.0"
|
35
51
|
s.add_development_dependency "webmock", "~> 1.13"
|
36
|
-
s.add_development_dependency "cocoapods" if
|
52
|
+
s.add_development_dependency "cocoapods" if LicenseFinder::Platform.darwin?
|
37
53
|
|
38
54
|
s.files = `git ls-files`.split("\n")
|
39
55
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -2,286 +2,294 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module LicenseFinder
|
4
4
|
module CLI
|
5
|
-
|
6
|
-
|
7
|
-
it "adds a dependency" do
|
8
|
-
DependencyManager.should_receive(:manually_add).with("MIT", "js_dep", "1.2.3")
|
5
|
+
context do
|
6
|
+
let!(:dependency_manager) { DependencyManager.new }
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
before do
|
9
|
+
allow(DependencyManager).to receive(:new) { dependency_manager }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe Dependencies do
|
13
|
+
describe "add" do
|
14
|
+
it "adds a dependency" do
|
15
|
+
expect(dependency_manager).to receive(:manually_add).with("MIT", "js_dep", "1.2.3")
|
16
|
+
|
17
|
+
silence_stdout do
|
18
|
+
subject.add("MIT", "js_dep", "1.2.3")
|
19
|
+
end
|
12
20
|
end
|
13
|
-
end
|
14
21
|
|
15
|
-
|
16
|
-
|
22
|
+
it "does not require a version" do
|
23
|
+
expect(dependency_manager).to receive(:manually_add).with("MIT", "js_dep", nil)
|
17
24
|
|
18
|
-
|
19
|
-
|
25
|
+
silence_stdout do
|
26
|
+
subject.add("MIT", "js_dep")
|
27
|
+
end
|
20
28
|
end
|
21
|
-
end
|
22
29
|
|
23
|
-
|
24
|
-
|
25
|
-
|
30
|
+
it "has an --approve option to approve the added dependency" do
|
31
|
+
expect(dependency_manager).to receive(:manually_add).with("MIT", "js_dep", "1.2.3")
|
32
|
+
expect(dependency_manager).to receive(:approve!).with("js_dep", "Julian", "We really need this")
|
26
33
|
|
27
|
-
|
28
|
-
|
34
|
+
silence_stdout do
|
35
|
+
Main.start(["dependencies", "add", "--approve", "--approver", "Julian", "--message", "We really need this", "MIT", "js_dep", "1.2.3"])
|
36
|
+
end
|
29
37
|
end
|
30
38
|
end
|
31
|
-
end
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
describe "remove" do
|
41
|
+
it "removes a dependency" do
|
42
|
+
expect(dependency_manager).to receive(:manually_remove).with("js_dep")
|
43
|
+
silence_stdout do
|
44
|
+
subject.remove("js_dep")
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
41
|
-
end
|
42
49
|
|
43
|
-
|
44
|
-
|
50
|
+
describe Whitelist do
|
51
|
+
let(:config) { LicenseFinder.config }
|
45
52
|
|
46
|
-
|
47
|
-
|
48
|
-
|
53
|
+
describe "list" do
|
54
|
+
it "shows the whitelist of licenses" do
|
55
|
+
expect(config).to receive(:whitelist).and_return([])
|
49
56
|
|
50
|
-
|
51
|
-
|
57
|
+
silence_stdout do
|
58
|
+
subject.list
|
59
|
+
end
|
52
60
|
end
|
53
61
|
end
|
54
|
-
end
|
55
62
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
63
|
+
describe "add" do
|
64
|
+
it "adds the specified license to the whitelist" do
|
65
|
+
expect(config.whitelist).to receive(:push).with("test")
|
66
|
+
expect(config).to receive(:save)
|
67
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
61
68
|
|
62
|
-
|
63
|
-
|
69
|
+
silence_stdout do
|
70
|
+
subject.add("test")
|
71
|
+
end
|
64
72
|
end
|
65
|
-
end
|
66
73
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
74
|
+
it "adds multiple licenses to the whitelist" do
|
75
|
+
expect(config.whitelist).to receive(:push).with("test")
|
76
|
+
expect(config.whitelist).to receive(:push).with("rest")
|
77
|
+
expect(config).to receive(:save)
|
78
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
72
79
|
|
73
|
-
|
74
|
-
|
80
|
+
silence_stdout do
|
81
|
+
subject.add("test", "rest")
|
82
|
+
end
|
75
83
|
end
|
76
84
|
end
|
77
|
-
end
|
78
85
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
describe "remove" do
|
87
|
+
it "removes the specified license from the whitelist" do
|
88
|
+
expect(config).to receive(:save)
|
89
|
+
expect(config.whitelist).to receive(:delete).with("test")
|
90
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
84
91
|
|
85
|
-
|
92
|
+
silence_stdout do
|
86
93
|
|
87
|
-
|
94
|
+
subject.remove("test")
|
95
|
+
end
|
88
96
|
end
|
89
|
-
end
|
90
97
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
98
|
+
it "removes multiple licenses from the whitelist" do
|
99
|
+
expect(config).to receive(:save)
|
100
|
+
expect(config.whitelist).to receive(:delete).with("test")
|
101
|
+
expect(config.whitelist).to receive(:delete).with("rest")
|
102
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
96
103
|
|
97
|
-
|
98
|
-
|
104
|
+
silence_stdout do
|
105
|
+
subject.remove("test", "rest")
|
106
|
+
end
|
99
107
|
end
|
100
108
|
end
|
101
109
|
end
|
102
|
-
end
|
103
110
|
|
104
|
-
|
105
|
-
|
111
|
+
describe ProjectName do
|
112
|
+
let(:config) { LicenseFinder.config }
|
106
113
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
114
|
+
describe "set" do
|
115
|
+
it "sets the project name" do
|
116
|
+
expect(config).to receive(:save)
|
117
|
+
expect(config.project_name).not_to eq("new_project_name")
|
118
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
112
119
|
|
113
|
-
|
114
|
-
|
115
|
-
|
120
|
+
silence_stdout do
|
121
|
+
subject.set("new_project_name")
|
122
|
+
end
|
116
123
|
|
117
|
-
|
124
|
+
expect(config.project_name).to eq("new_project_name")
|
125
|
+
end
|
118
126
|
end
|
119
127
|
end
|
120
|
-
end
|
121
128
|
|
122
|
-
|
123
|
-
|
129
|
+
describe IgnoredBundlerGroups do
|
130
|
+
let(:config) { LicenseFinder.config }
|
124
131
|
|
125
|
-
|
126
|
-
|
127
|
-
|
132
|
+
describe "list" do
|
133
|
+
it "shows the ignored groups in the standard output" do
|
134
|
+
expect(config).to receive(:ignore_groups).and_return(['development'])
|
128
135
|
|
129
|
-
|
136
|
+
expect(capture_stdout { subject.list }).to match /development/
|
137
|
+
end
|
130
138
|
end
|
131
|
-
end
|
132
139
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
140
|
+
describe "add" do
|
141
|
+
it "adds the specified group to the ignored groups list" do
|
142
|
+
expect(config.ignore_groups).to receive(:push).with("test")
|
143
|
+
expect(config).to receive(:save)
|
144
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
138
145
|
|
139
|
-
|
140
|
-
|
146
|
+
silence_stdout do
|
147
|
+
subject.add("test")
|
148
|
+
end
|
141
149
|
end
|
142
150
|
end
|
143
|
-
end
|
144
151
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
152
|
+
describe "remove" do
|
153
|
+
it "removes the specified group from the ignored groups list" do
|
154
|
+
expect(config.ignore_groups).to receive(:delete).with("test")
|
155
|
+
expect(config).to receive(:save)
|
156
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
150
157
|
|
151
|
-
|
152
|
-
|
158
|
+
silence_stdout do
|
159
|
+
subject.remove("test")
|
160
|
+
end
|
153
161
|
end
|
154
162
|
end
|
155
163
|
end
|
156
|
-
end
|
157
164
|
|
158
|
-
|
159
|
-
|
165
|
+
describe IgnoredDependencies do
|
166
|
+
let(:config) { LicenseFinder.config }
|
160
167
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
168
|
+
describe "list" do
|
169
|
+
context "when there is at least one ignored dependency" do
|
170
|
+
it "shows the ignored dependencies" do
|
171
|
+
expect(config).to receive(:ignore_dependencies).and_return(['bundler'])
|
172
|
+
expect(capture_stdout { subject.list }).to match /bundler/
|
173
|
+
end
|
166
174
|
end
|
167
|
-
end
|
168
175
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
176
|
+
context "when there are no ignored dependencies" do
|
177
|
+
it "prints '(none)'" do
|
178
|
+
expect(config).to receive(:ignore_dependencies).and_return([])
|
179
|
+
expect(capture_stdout { subject.list }).to match /\(none\)/
|
180
|
+
end
|
173
181
|
end
|
174
182
|
end
|
175
|
-
end
|
176
183
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
184
|
+
describe "add" do
|
185
|
+
it "adds the specified group to the ignored groups list" do
|
186
|
+
expect(config.ignore_dependencies).to receive(:push).with("test")
|
187
|
+
expect(config).to receive(:save)
|
188
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
182
189
|
|
183
|
-
|
184
|
-
|
190
|
+
silence_stdout do
|
191
|
+
subject.add("test")
|
192
|
+
end
|
185
193
|
end
|
186
194
|
end
|
187
|
-
end
|
188
195
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
196
|
+
describe "remove" do
|
197
|
+
it "removes the specified group from the ignored groups list" do
|
198
|
+
expect(config.ignore_dependencies).to receive(:delete).with("test")
|
199
|
+
expect(config).to receive(:save)
|
200
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
194
201
|
|
195
|
-
|
196
|
-
|
202
|
+
silence_stdout do
|
203
|
+
subject.remove("test")
|
204
|
+
end
|
197
205
|
end
|
198
206
|
end
|
199
207
|
end
|
200
|
-
end
|
201
208
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
+
describe Main do
|
210
|
+
describe "default" do
|
211
|
+
it "checks for action items" do
|
212
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
213
|
+
allow(Dependency).to receive(:unapproved) { [] }
|
214
|
+
silence_stdout do
|
215
|
+
described_class.start([])
|
216
|
+
end
|
209
217
|
end
|
210
218
|
end
|
211
|
-
end
|
212
219
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
220
|
+
describe "#rescan" do
|
221
|
+
it "resyncs with Gemfile" do
|
222
|
+
expect(dependency_manager).to receive(:sync_with_package_managers)
|
223
|
+
allow(Dependency).to receive(:unapproved) { [] }
|
217
224
|
|
218
|
-
|
219
|
-
|
225
|
+
silence_stdout do
|
226
|
+
subject.rescan
|
227
|
+
end
|
220
228
|
end
|
221
229
|
end
|
222
|
-
end
|
223
230
|
|
224
|
-
|
225
|
-
|
226
|
-
|
231
|
+
describe "#license" do
|
232
|
+
it "updates the license on the requested gem" do
|
233
|
+
expect(dependency_manager).to receive(:license!).with("foo_gem", "foo")
|
227
234
|
|
228
|
-
|
229
|
-
|
235
|
+
silence_stdout do
|
236
|
+
subject.license 'foo', 'foo_gem'
|
237
|
+
end
|
230
238
|
end
|
231
239
|
end
|
232
|
-
end
|
233
240
|
|
234
|
-
|
235
|
-
|
236
|
-
|
241
|
+
describe "#approve" do
|
242
|
+
it "approves the requested gem" do
|
243
|
+
expect(dependency_manager).to receive(:approve!).with("foo", nil, nil)
|
237
244
|
|
238
|
-
|
239
|
-
|
245
|
+
silence_stdout do
|
246
|
+
subject.approve 'foo'
|
247
|
+
end
|
240
248
|
end
|
241
|
-
end
|
242
249
|
|
243
|
-
|
244
|
-
|
245
|
-
|
250
|
+
it "approves multiple gem" do
|
251
|
+
expect(dependency_manager).to receive(:approve!).with("foo", nil, nil)
|
252
|
+
expect(dependency_manager).to receive(:approve!).with("bar", nil, nil)
|
246
253
|
|
247
|
-
|
248
|
-
|
254
|
+
silence_stdout do
|
255
|
+
subject.approve 'foo', 'bar'
|
256
|
+
end
|
249
257
|
end
|
250
|
-
end
|
251
258
|
|
252
|
-
|
253
|
-
|
259
|
+
it "raises a warning if no gem was specified" do
|
260
|
+
expect(dependency_manager).not_to receive(:approve!)
|
254
261
|
|
255
|
-
|
256
|
-
|
262
|
+
silence_stdout do
|
263
|
+
expect { subject.approve }.to raise_error(ArgumentError)
|
264
|
+
end
|
257
265
|
end
|
258
|
-
end
|
259
266
|
|
260
|
-
|
261
|
-
|
267
|
+
it "sets approver and approval message" do
|
268
|
+
expect(dependency_manager).to receive(:approve!).with("foo", "Julian", "We really need this")
|
262
269
|
|
263
|
-
|
264
|
-
|
270
|
+
silence_stdout do
|
271
|
+
Main.start(["approve", "--approver", "Julian", "--message", "We really need this", "foo"])
|
272
|
+
end
|
265
273
|
end
|
266
274
|
end
|
267
|
-
end
|
268
275
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
276
|
+
describe "#action_items" do
|
277
|
+
it "reports unapproved dependencies" do
|
278
|
+
allow(Dependency).to receive(:unapproved) { ['one dependency'] }
|
279
|
+
allow(TextReport).to receive(:new) { double(:report, to_s: "a report!") }
|
280
|
+
silence_stdout do
|
281
|
+
allow(subject).to receive(:say)
|
282
|
+
expect(subject).to receive(:say).with(/dependencies/i, :red)
|
283
|
+
expect { subject.action_items }.to raise_error(SystemExit)
|
284
|
+
end
|
277
285
|
end
|
278
|
-
end
|
279
286
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
287
|
+
it "reports that all dependencies are approved" do
|
288
|
+
allow(Dependency).to receive(:unapproved) { [] }
|
289
|
+
silence_stdout do
|
290
|
+
expect(subject).to receive(:say).with(/approved/i, :green)
|
291
|
+
expect { subject.action_items }.to_not raise_error
|
292
|
+
end
|
285
293
|
end
|
286
294
|
end
|
287
295
|
end
|