license_finder 2.1.0.rc6 → 2.1.0.rc7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +6 -0
- data/Rakefile +3 -24
- data/lib/license_finder/logger.rb +27 -1
- data/lib/license_finder/package_manager.rb +31 -2
- data/lib/license_finder/package_managers/bower.rb +4 -0
- data/lib/license_finder/package_managers/bundler.rb +4 -0
- data/lib/license_finder/package_managers/cocoa_pods.rb +4 -0
- data/lib/license_finder/package_managers/go_dep.rb +4 -0
- data/lib/license_finder/package_managers/go_vendor.rb +9 -1
- data/lib/license_finder/package_managers/go_workspace.rb +6 -3
- data/lib/license_finder/package_managers/gradle.rb +4 -0
- data/lib/license_finder/package_managers/maven.rb +4 -0
- data/lib/license_finder/package_managers/npm.rb +4 -0
- data/lib/license_finder/package_managers/pip.rb +4 -0
- data/lib/license_finder/package_managers/rebar.rb +4 -0
- data/lib/license_finder/version.rb +1 -1
- data/license_finder.gemspec +1 -0
- data/spec/fixtures/all_pms/.envrc +1 -0
- data/spec/fixtures/all_pms/vendor/.gitkeep +0 -0
- data/spec/fixtures/npm-recursive-dependencies/npm-list.json +5158 -0
- data/spec/fixtures/npm-recursive-dependencies/package.json +15 -0
- data/spec/lib/license_finder/package_manager_spec.rb +40 -0
- data/spec/lib/license_finder/package_managers/go_vendor_spec.rb +16 -2
- data/spec/lib/license_finder/package_managers/go_workspace_spec.rb +13 -0
- data/spec/support/shared_examples_for_package_manager.rb +28 -5
- metadata +19 -2
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "asdf",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"author": "",
|
10
|
+
"license": "BSD-2-Clause",
|
11
|
+
"dependencies": {
|
12
|
+
"pui-react-alerts": "3.0.0-alpha.2",
|
13
|
+
"pui-react-media": "3.0.0-alpha.2"
|
14
|
+
}
|
15
|
+
}
|
@@ -18,5 +18,45 @@ module LicenseFinder
|
|
18
18
|
])
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
describe "#package_management_command" do
|
23
|
+
it "defaults to nil" do
|
24
|
+
expect(LicenseFinder::PackageManager.package_management_command).to be_nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".installed?" do
|
29
|
+
context "package_management_command is nil" do
|
30
|
+
before do
|
31
|
+
allow(LicenseFinder::PackageManager).to receive(:package_management_command).and_return(nil)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "returns true" do
|
35
|
+
expect(LicenseFinder::PackageManager.installed?).to be_truthy
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "package_management_command exists" do
|
40
|
+
before do
|
41
|
+
allow(LicenseFinder::PackageManager).to receive(:package_management_command).and_return("foobar")
|
42
|
+
allow(LicenseFinder::PackageManager).to receive(:command_exists?).with("foobar").and_return(true)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "returns true" do
|
46
|
+
expect(LicenseFinder::PackageManager.installed?).to be_truthy
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "package_management_command does not exist" do
|
51
|
+
before do
|
52
|
+
allow(LicenseFinder::PackageManager).to receive(:package_management_command).and_return("foobar")
|
53
|
+
allow(LicenseFinder::PackageManager).to receive(:command_exists?).with("foobar").and_return(false)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns false" do
|
57
|
+
expect(LicenseFinder::PackageManager.installed?).to be_falsey
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
21
61
|
end
|
22
62
|
end
|
@@ -5,11 +5,25 @@ module LicenseFinder
|
|
5
5
|
describe GoVendor do
|
6
6
|
include FakeFS::SpecHelpers
|
7
7
|
|
8
|
-
let(:project_path) { '/app' }
|
9
|
-
let(:options) { {} }
|
10
8
|
let(:logger) { double(:logger, active: nil) }
|
11
9
|
subject { GoVendor.new(options.merge(project_path: Pathname(project_path), logger: logger)) }
|
12
10
|
|
11
|
+
before do
|
12
|
+
allow(logger).to receive(:installed)
|
13
|
+
allow(logger).to receive(:active)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'package manager' do
|
17
|
+
before do
|
18
|
+
FileUtils.mkdir_p File.join(fixture_path('all_pms'), 'vendor')
|
19
|
+
end
|
20
|
+
|
21
|
+
it_behaves_like "a PackageManager"
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:project_path) { '/app' }
|
25
|
+
let(:options) { {} }
|
26
|
+
|
13
27
|
context 'when there are go files' do
|
14
28
|
before do
|
15
29
|
FileUtils.mkdir_p project_path
|
@@ -7,6 +7,19 @@ module LicenseFinder
|
|
7
7
|
let(:project_path) { '/Users/pivotal/workspace/loggregator'}
|
8
8
|
subject { GoWorkspace.new(options.merge(project_path: Pathname(project_path), logger: logger)) }
|
9
9
|
|
10
|
+
before do
|
11
|
+
allow(logger).to receive(:installed)
|
12
|
+
allow(logger).to receive(:active)
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'package manager' do
|
16
|
+
before do
|
17
|
+
allow_any_instance_of(GoDep).to receive(:active?).and_return(false)
|
18
|
+
end
|
19
|
+
|
20
|
+
it_behaves_like "a PackageManager"
|
21
|
+
end
|
22
|
+
|
10
23
|
describe '#go_list' do
|
11
24
|
|
12
25
|
let(:go_list_output) {
|
@@ -8,6 +8,7 @@ module LicenseFinder
|
|
8
8
|
context "logging" do
|
9
9
|
it "logs when it checks for active-ness" do
|
10
10
|
logger = double(:logger)
|
11
|
+
expect(logger).to receive(:installed)
|
11
12
|
expect(logger).to receive(:active)
|
12
13
|
|
13
14
|
subject = described_class.new logger: logger, project_path: all_pms
|
@@ -16,13 +17,35 @@ module LicenseFinder
|
|
16
17
|
end
|
17
18
|
|
18
19
|
describe '.active?' do
|
19
|
-
|
20
|
-
|
20
|
+
context 'package manager is installed' do
|
21
|
+
before do
|
22
|
+
allow(described_class).to receive(:installed?).and_return(true)
|
23
|
+
allow_any_instance_of(described_class).to receive(:has_go_files?).and_return(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'is true when package manager file exists' do
|
27
|
+
expect(described_class.new(project_path: all_pms)).to be_active
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'is false without a package manager file' do
|
31
|
+
no_pms = fixture_path("not/a/path")
|
32
|
+
expect(described_class.new(project_path: no_pms)).to_not be_active
|
33
|
+
end
|
21
34
|
end
|
22
35
|
|
23
|
-
|
24
|
-
|
25
|
-
|
36
|
+
context 'package manager is not installed' do
|
37
|
+
before do
|
38
|
+
allow(described_class).to receive(:installed?).and_return(false)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is false when package manager file exists' do
|
42
|
+
expect(described_class.new(project_path: all_pms)).to_not be_active
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'is false without a package manager file' do
|
46
|
+
no_pms = fixture_path("not/a/path")
|
47
|
+
expect(described_class.new(project_path: no_pms)).to_not be_active
|
48
|
+
end
|
26
49
|
end
|
27
50
|
end
|
28
51
|
end
|
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: 2.1.0.
|
4
|
+
version: 2.1.0.rc7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Maine
|
@@ -20,7 +20,7 @@ authors:
|
|
20
20
|
autorequire:
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
|
-
date: 2016-03-
|
23
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
@@ -78,6 +78,20 @@ dependencies:
|
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: colorize
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: capybara
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -379,6 +393,7 @@ files:
|
|
379
393
|
- spec/fixtures/all_pms/pom.xml
|
380
394
|
- spec/fixtures/all_pms/rebar.config
|
381
395
|
- spec/fixtures/all_pms/requirements.txt
|
396
|
+
- spec/fixtures/all_pms/vendor/.gitkeep
|
382
397
|
- spec/fixtures/composite/Gemfile
|
383
398
|
- spec/fixtures/composite/nested_project/.envrc
|
384
399
|
- spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Godeps.json
|
@@ -397,6 +412,8 @@ files:
|
|
397
412
|
- spec/fixtures/license_names/Mit-License
|
398
413
|
- spec/fixtures/license_names/README.rdoc
|
399
414
|
- spec/fixtures/nested_gem/vendor/LICENSE
|
415
|
+
- spec/fixtures/npm-recursive-dependencies/npm-list.json
|
416
|
+
- spec/fixtures/npm-recursive-dependencies/package.json
|
400
417
|
- spec/fixtures/utf8_gem/README
|
401
418
|
- spec/lib/license_finder/cli/approvals_spec.rb
|
402
419
|
- spec/lib/license_finder/cli/blacklist_spec.rb
|