license_finder 3.0.4 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +56 -0
- data/CHANGELOG.md +29 -2
- data/CONTRIBUTING.md +5 -1
- data/Dockerfile +33 -10
- data/Gemfile +2 -2
- data/README.md +27 -5
- data/Rakefile +15 -21
- data/ci/pipelines/pipeline.yml.erb +40 -6
- data/ci/pipelines/release.yml +11 -5
- data/ci/scripts/containerize-tests.sh +16 -0
- data/ci/scripts/run-rubocop.sh +8 -0
- data/ci/scripts/run-tests.sh +22 -0
- data/ci/scripts/test.ps1 +81 -0
- data/ci/tasks/build-windows.yml +6 -0
- data/ci/tasks/build.yml +2 -2
- data/ci/tasks/rubocop.yml +13 -0
- data/features/features/cli/cli_spec.rb +8 -8
- data/features/features/configure/add_dependencies_spec.rb +7 -7
- data/features/features/configure/approve_dependencies_spec.rb +15 -15
- data/features/features/configure/assign_licenses_spec.rb +4 -4
- data/features/features/configure/blacklist_licenses_spec.rb +3 -3
- data/features/features/configure/ignore_dependencies_spec.rb +3 -3
- data/features/features/configure/ignore_groups_spec.rb +4 -4
- data/features/features/configure/name_project_spec.rb +4 -4
- data/features/features/configure/set_project_path_spec.rb +2 -2
- data/features/features/configure/whitelist_licenses_spec.rb +4 -4
- data/features/features/package_managers/bower_spec.rb +3 -3
- data/features/features/package_managers/carthage_spec.rb +14 -0
- data/features/features/package_managers/cocoapods_spec.rb +3 -3
- data/features/features/package_managers/conan_spec.rb +11 -0
- data/features/features/package_managers/dep_spec.rb +15 -0
- data/features/features/package_managers/glide_spec.rb +14 -0
- data/features/features/package_managers/govendor_spec.rb +15 -0
- data/features/features/package_managers/gradle_spec.rb +1 -1
- data/features/features/package_managers/gvt_spec.rb +14 -0
- data/features/features/package_managers/maven_spec.rb +2 -3
- data/features/features/package_managers/mix_spec.rb +16 -0
- data/features/features/package_managers/npm_spec.rb +3 -3
- data/features/features/package_managers/nuget_spec.rb +4 -4
- data/features/features/package_managers/pip_spec.rb +2 -2
- data/features/features/package_managers/rebar_spec.rb +3 -3
- data/features/features/package_managers/yarn_spec.rb +14 -0
- data/features/features/report/composite_spec.rb +1 -1
- data/features/features/report/csv_spec.rb +3 -3
- data/features/features/report/diff_spec.rb +20 -10
- data/features/features/report/html_spec.rb +10 -10
- data/features/features/report/subproject_spec.rb +15 -4
- data/features/fixtures/Cartfile +1 -0
- data/features/fixtures/Podfile +1 -1
- data/features/fixtures/alternate-build-file-gradle/build-alt.gradle +5 -15
- data/features/fixtures/build.gradle +5 -15
- data/features/fixtures/conanfile.txt +11 -0
- data/features/fixtures/file-based-libs-gradle/build.gradle +5 -7
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.lock +9 -0
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.toml +7 -0
- data/features/fixtures/gopath_dep/src/foo-dep/bar/bar.go +10 -0
- data/features/fixtures/gopath_dep/src/foo-dep/foo.go +7 -0
- data/features/fixtures/gopath_glide/src/glide.lock +9 -0
- data/features/fixtures/gopath_glide/src/glide.yaml +6 -0
- data/features/fixtures/gopath_govendor/src/vendor/vendor.json +19 -0
- data/features/fixtures/gopath_gvt/src/vendor/manifest +22 -0
- data/features/fixtures/gradle-wrapper/build.gradle +5 -15
- data/features/fixtures/gradle-wrapper/gradlew +6 -1
- data/features/fixtures/gradle-wrapper/gradlew.bat +9 -1
- data/features/fixtures/mix.exs +22 -0
- data/features/fixtures/multi-module-gradle/build.gradle +7 -15
- data/features/fixtures/single-module-gradle/build.gradle +5 -15
- data/features/support/testing_dsl.rb +155 -43
- data/lib/license_finder.rb +4 -3
- data/lib/license_finder/cli.rb +0 -3
- data/lib/license_finder/cli/approvals.rb +3 -3
- data/lib/license_finder/cli/base.rb +11 -8
- data/lib/license_finder/cli/blacklist.rb +7 -7
- data/lib/license_finder/cli/dependencies.rb +8 -8
- data/lib/license_finder/cli/ignored_dependencies.rb +4 -4
- data/lib/license_finder/cli/ignored_groups.rb +4 -4
- data/lib/license_finder/cli/licenses.rb +2 -2
- data/lib/license_finder/cli/main.rb +59 -39
- data/lib/license_finder/cli/makes_decisions.rb +2 -2
- data/lib/license_finder/cli/patched_thor.rb +6 -7
- data/lib/license_finder/cli/project_name.rb +5 -6
- data/lib/license_finder/cli/whitelist.rb +7 -7
- data/lib/license_finder/configuration.rb +15 -4
- data/lib/license_finder/core.rb +20 -4
- data/lib/license_finder/decision_applier.rb +0 -1
- data/lib/license_finder/decisions.rb +12 -14
- data/lib/license_finder/diff.rb +33 -31
- data/lib/license_finder/license.rb +13 -9
- data/lib/license_finder/license/definitions.rb +55 -55
- data/lib/license_finder/license/none_matcher.rb +1 -1
- data/lib/license_finder/license/template.rb +1 -1
- data/lib/license_finder/license/text.rb +0 -1
- data/lib/license_finder/license_aggregator.rb +1 -0
- data/lib/license_finder/logger.rb +18 -61
- data/lib/license_finder/package.rb +25 -11
- data/lib/license_finder/package_delta.rb +3 -6
- data/lib/license_finder/package_manager.rb +77 -34
- data/lib/license_finder/package_managers/bower.rb +8 -8
- data/lib/license_finder/package_managers/bower_package.rb +12 -12
- data/lib/license_finder/package_managers/bundler.rb +21 -9
- data/lib/license_finder/package_managers/bundler_package.rb +1 -1
- data/lib/license_finder/package_managers/carthage.rb +66 -0
- data/lib/license_finder/package_managers/carthage_package.rb +16 -0
- data/lib/license_finder/package_managers/cocoa_pods.rb +13 -13
- data/lib/license_finder/package_managers/cocoa_pods_package.rb +1 -1
- data/lib/license_finder/package_managers/conan.rb +26 -0
- data/lib/license_finder/package_managers/conan_info_parser.rb +74 -0
- data/lib/license_finder/package_managers/conan_package.rb +17 -0
- data/lib/license_finder/package_managers/dep.rb +33 -0
- data/lib/license_finder/package_managers/glide.rb +30 -0
- data/lib/license_finder/package_managers/{go_vendor.rb → go_15vendorexperiment.rb} +19 -24
- data/lib/license_finder/package_managers/go_dep.rb +15 -12
- data/lib/license_finder/package_managers/go_package.rb +15 -13
- data/lib/license_finder/package_managers/go_workspace.rb +39 -34
- data/lib/license_finder/package_managers/govendor.rb +32 -0
- data/lib/license_finder/package_managers/gradle.rb +16 -16
- data/lib/license_finder/package_managers/gradle_package.rb +8 -8
- data/lib/license_finder/package_managers/gvt.rb +61 -0
- data/lib/license_finder/package_managers/maven.rb +17 -18
- data/lib/license_finder/package_managers/maven_package.rb +4 -6
- data/lib/license_finder/package_managers/merged_package.rb +25 -2
- data/lib/license_finder/package_managers/mix.rb +51 -0
- data/lib/license_finder/package_managers/mix_package.rb +7 -0
- data/lib/license_finder/package_managers/npm.rb +8 -32
- data/lib/license_finder/package_managers/npm_package.rb +51 -48
- data/lib/license_finder/package_managers/nuget.rb +30 -40
- data/lib/license_finder/package_managers/pip.rb +11 -11
- data/lib/license_finder/package_managers/pip_package.rb +8 -8
- data/lib/license_finder/package_managers/rebar.rb +11 -11
- data/lib/license_finder/package_managers/yarn.rb +62 -0
- data/lib/license_finder/packages/activation.rb +2 -2
- data/lib/license_finder/packages/license_files.rb +6 -6
- data/lib/license_finder/packages/licensing.rb +8 -10
- data/lib/license_finder/packages/manual_package.rb +2 -2
- data/lib/license_finder/project_finder.rb +6 -5
- data/lib/license_finder/report.rb +1 -0
- data/lib/license_finder/reports/csv_report.rb +4 -4
- data/lib/license_finder/reports/diff_report.rb +2 -2
- data/lib/license_finder/reports/erb_report.rb +2 -4
- data/lib/license_finder/reports/html_report.rb +2 -2
- data/lib/license_finder/reports/markdown_report.rb +1 -1
- data/lib/license_finder/reports/merged_report.rb +1 -1
- data/lib/license_finder/reports/text_report.rb +3 -5
- data/lib/license_finder/shared_helpers/cmd.rb +11 -0
- data/lib/license_finder/version.rb +1 -1
- data/license_finder-2.1.2.gem +0 -0
- data/license_finder.gemspec +38 -38
- metadata +84 -118
- data/ci/scripts/test.sh +0 -26
- data/ci/tasks/create-source-archives.yml +0 -23
- data/spec/dummy_app/Gemfile +0 -6
- data/spec/fixtures/all_pms/.envrc +0 -1
- data/spec/fixtures/all_pms/.nuget/.keep +0 -0
- data/spec/fixtures/all_pms/Gemfile +0 -0
- data/spec/fixtures/all_pms/Godeps/Godeps.json +0 -0
- data/spec/fixtures/all_pms/Podfile +0 -0
- data/spec/fixtures/all_pms/bower.json +0 -0
- data/spec/fixtures/all_pms/build.gradle +0 -0
- data/spec/fixtures/all_pms/package.json +0 -0
- data/spec/fixtures/all_pms/pom.xml +0 -0
- data/spec/fixtures/all_pms/rebar.config +0 -0
- data/spec/fixtures/all_pms/requirements.txt +0 -0
- data/spec/fixtures/all_pms/vendor/.gitkeep +0 -0
- data/spec/fixtures/composite/Gemfile +0 -0
- data/spec/fixtures/composite/nested_project/.envrc +0 -8
- data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Godeps.json +0 -16
- data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Readme +0 -5
- data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/foo.go +0 -6
- data/spec/fixtures/composite/not_a_project/DONTREADME.md +0 -0
- data/spec/fixtures/composite/project1/Gemfile +0 -0
- data/spec/fixtures/composite/project2/package.json +0 -0
- data/spec/fixtures/config/license_finder.yml +0 -5
- data/spec/fixtures/license_directory/COPYING +0 -1
- data/spec/fixtures/license_directory/LICENSE/MIT.txt +0 -1
- data/spec/fixtures/license_directory/LICENSE/lib/unrelated.txt +0 -2
- data/spec/fixtures/license_names/COPYING.txt +0 -1
- data/spec/fixtures/license_names/LICENSE +0 -1
- data/spec/fixtures/license_names/Licence.rdoc +0 -1
- data/spec/fixtures/license_names/Mit-License +0 -1
- data/spec/fixtures/license_names/README.rdoc +0 -1
- data/spec/fixtures/nested_gem/vendor/LICENSE +0 -1
- data/spec/fixtures/npm-circular-dependencies/npm-list.json +0 -5339
- data/spec/fixtures/npm-circular-dependencies/package.json +0 -5
- data/spec/fixtures/npm-circular-licenses/npm-list.json +0 -7597
- data/spec/fixtures/npm-circular-licenses/package.json +0 -23
- data/spec/fixtures/npm-licenses-string/npm-list.json +0 -7597
- data/spec/fixtures/npm-licenses-string/package.json +0 -23
- data/spec/fixtures/npm-recursive-dependencies/npm-list.json +0 -5158
- data/spec/fixtures/npm-recursive-dependencies/package.json +0 -15
- data/spec/fixtures/npm-stack-too-deep/npm-list.json +0 -13464
- data/spec/fixtures/npm-stack-too-deep/package.json +0 -5
- data/spec/fixtures/utf8_gem/README +0 -210
- data/spec/lib/license_finder/cli/approvals_spec.rb +0 -71
- data/spec/lib/license_finder/cli/blacklist_spec.rb +0 -58
- data/spec/lib/license_finder/cli/dependencies_spec.rb +0 -73
- data/spec/lib/license_finder/cli/ignored_dependencies_spec.rb +0 -47
- data/spec/lib/license_finder/cli/ignored_groups_spec.rb +0 -40
- data/spec/lib/license_finder/cli/licenses_spec.rb +0 -60
- data/spec/lib/license_finder/cli/main_spec.rb +0 -243
- data/spec/lib/license_finder/cli/project_name_spec.rb +0 -40
- data/spec/lib/license_finder/cli/whitelist_spec.rb +0 -58
- data/spec/lib/license_finder/configuration_spec.rb +0 -115
- data/spec/lib/license_finder/core_spec.rb +0 -54
- data/spec/lib/license_finder/decision_applier_spec.rb +0 -219
- data/spec/lib/license_finder/decisions_spec.rb +0 -408
- data/spec/lib/license_finder/diff_spec.rb +0 -129
- data/spec/lib/license_finder/license/definitions_spec.rb +0 -177
- data/spec/lib/license_finder/license_aggregator_spec.rb +0 -61
- data/spec/lib/license_finder/license_spec.rb +0 -106
- data/spec/lib/license_finder/package_delta_spec.rb +0 -18
- data/spec/lib/license_finder/package_manager_spec.rb +0 -62
- data/spec/lib/license_finder/package_managers/bower_package_spec.rb +0 -71
- data/spec/lib/license_finder/package_managers/bower_spec.rb +0 -39
- data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +0 -35
- data/spec/lib/license_finder/package_managers/bundler_spec.rb +0 -56
- data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +0 -48
- data/spec/lib/license_finder/package_managers/cocoa_pods_spec.rb +0 -59
- data/spec/lib/license_finder/package_managers/go_dep_spec.rb +0 -126
- data/spec/lib/license_finder/package_managers/go_package_spec.rb +0 -33
- data/spec/lib/license_finder/package_managers/go_vendor_spec.rb +0 -144
- data/spec/lib/license_finder/package_managers/go_workspace_spec.rb +0 -286
- data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +0 -80
- data/spec/lib/license_finder/package_managers/gradle_spec.rb +0 -180
- data/spec/lib/license_finder/package_managers/maven_package_spec.rb +0 -63
- data/spec/lib/license_finder/package_managers/maven_spec.rb +0 -128
- data/spec/lib/license_finder/package_managers/merged_package_spec.rb +0 -60
- data/spec/lib/license_finder/package_managers/npm_package_spec.rb +0 -57
- data/spec/lib/license_finder/package_managers/npm_spec.rb +0 -253
- data/spec/lib/license_finder/package_managers/nuget_package_spec.rb +0 -9
- data/spec/lib/license_finder/package_managers/nuget_spec.rb +0 -157
- data/spec/lib/license_finder/package_managers/pip_package_spec.rb +0 -87
- data/spec/lib/license_finder/package_managers/pip_spec.rb +0 -47
- data/spec/lib/license_finder/package_managers/rebar_package_spec.rb +0 -24
- data/spec/lib/license_finder/package_managers/rebar_spec.rb +0 -50
- data/spec/lib/license_finder/package_spec.rb +0 -179
- data/spec/lib/license_finder/packages/activation_spec.rb +0 -41
- data/spec/lib/license_finder/packages/license_files_spec.rb +0 -46
- data/spec/lib/license_finder/packages/licensing_spec.rb +0 -1
- data/spec/lib/license_finder/packages/possible_license_file_spec.rb +0 -38
- data/spec/lib/license_finder/project_finder_spec.rb +0 -33
- data/spec/lib/license_finder/reports/csv_report_spec.rb +0 -70
- data/spec/lib/license_finder/reports/diff_report_spec.rb +0 -56
- data/spec/lib/license_finder/reports/html_report_spec.rb +0 -101
- data/spec/lib/license_finder/reports/markdown_report_spec.rb +0 -45
- data/spec/lib/license_finder/reports/merged_report_spec.rb +0 -21
- data/spec/lib/license_finder/reports/text_report_spec.rb +0 -43
- data/spec/spec_helper.rb +0 -27
- data/spec/support/shared_examples_for_package_manager.rb +0 -52
- data/spec/support/stdout_helpers.rb +0 -31
- data/spec/support/test_fixtures.rb +0 -7
@@ -1,20 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
maven {
|
4
|
-
url 'https://plugins.gradle.org/m2/'
|
5
|
-
}
|
6
|
-
}
|
7
|
-
|
8
|
-
dependencies {
|
9
|
-
classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.12.1'
|
10
|
-
}
|
1
|
+
plugins {
|
2
|
+
id 'com.github.hierynomus.license' version '0.14.0' apply false
|
11
3
|
}
|
12
4
|
|
13
5
|
allprojects {
|
14
|
-
|
15
|
-
|
6
|
+
apply plugin: 'java'
|
7
|
+
apply plugin: 'license'
|
16
8
|
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
repositories {
|
10
|
+
mavenCentral()
|
11
|
+
}
|
20
12
|
}
|
@@ -1,3 +1,7 @@
|
|
1
|
+
plugins {
|
2
|
+
id 'com.github.hierynomus.license' version '0.14.0'
|
3
|
+
}
|
4
|
+
|
1
5
|
apply plugin: 'java'
|
2
6
|
|
3
7
|
sourceCompatibility = 1.5
|
@@ -8,19 +12,5 @@ repositories {
|
|
8
12
|
}
|
9
13
|
|
10
14
|
dependencies {
|
11
|
-
compile
|
12
|
-
}
|
13
|
-
|
14
|
-
buildscript {
|
15
|
-
repositories {
|
16
|
-
maven {
|
17
|
-
url 'https://plugins.gradle.org/m2/'
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
dependencies {
|
22
|
-
classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.12.1'
|
23
|
-
}
|
15
|
+
compile 'junit:junit:4.11'
|
24
16
|
}
|
25
|
-
|
26
|
-
apply plugin: 'license'
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'delegate'
|
2
|
+
require 'English'
|
2
3
|
|
3
4
|
module LicenseFinder
|
4
5
|
module TestingDSL
|
5
6
|
class User
|
6
|
-
def run_license_finder(path = nil, options='')
|
7
|
+
def run_license_finder(path = nil, options = '')
|
7
8
|
if path
|
8
9
|
execute_command_in_path("license_finder --quiet #{options}", Paths.project("my_app/#{path}"))
|
9
10
|
else
|
@@ -11,11 +12,11 @@ module LicenseFinder
|
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
|
-
def create_empty_project(name =
|
15
|
+
def create_empty_project(name = 'my_app')
|
15
16
|
EmptyProject.create(name)
|
16
17
|
end
|
17
18
|
|
18
|
-
def create_ruby_app(name =
|
19
|
+
def create_ruby_app(name = 'my_app')
|
19
20
|
BundlerProject.create(name)
|
20
21
|
end
|
21
22
|
|
@@ -48,7 +49,7 @@ module LicenseFinder
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def seeing_something_like?(regex)
|
51
|
-
@output =~ regex
|
52
|
+
!!(@output =~ regex)
|
52
53
|
end
|
53
54
|
|
54
55
|
def receiving_exit_code?(code)
|
@@ -74,23 +75,21 @@ module LicenseFinder
|
|
74
75
|
|
75
76
|
attr_reader :name
|
76
77
|
|
77
|
-
def self.create(name =
|
78
|
+
def self.create(name = 'my_app')
|
78
79
|
project = new(name)
|
79
80
|
project.add_dep
|
80
81
|
project.install
|
81
82
|
project
|
82
83
|
end
|
83
84
|
|
84
|
-
def initialize(name =
|
85
|
+
def initialize(name = 'my_app')
|
85
86
|
@name = name
|
86
87
|
project_dir.make
|
87
88
|
end
|
88
89
|
|
89
|
-
def add_dep
|
90
|
-
end
|
90
|
+
def add_dep; end
|
91
91
|
|
92
|
-
def install
|
93
|
-
end
|
92
|
+
def install; end
|
94
93
|
|
95
94
|
def project_dir
|
96
95
|
Paths.project(name)
|
@@ -107,21 +106,21 @@ module LicenseFinder
|
|
107
106
|
|
108
107
|
class PipProject < Project
|
109
108
|
def add_dep
|
110
|
-
add_to_file(
|
109
|
+
add_to_file('requirements.txt', 'rsa==3.1.4')
|
111
110
|
end
|
112
111
|
|
113
112
|
def install
|
114
|
-
shell_out(
|
113
|
+
shell_out('pip install -r requirements.txt --user')
|
115
114
|
end
|
116
115
|
end
|
117
116
|
|
118
117
|
class NpmProject < Project
|
119
118
|
def add_dep
|
120
|
-
add_to_file(
|
119
|
+
add_to_file('package.json', '{"dependencies" : {"http-server": "0.6.1"}}')
|
121
120
|
end
|
122
121
|
|
123
122
|
def install
|
124
|
-
shell_out(
|
123
|
+
shell_out('npm install 2>/dev/null')
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
@@ -131,17 +130,24 @@ module LicenseFinder
|
|
131
130
|
end
|
132
131
|
|
133
132
|
def install
|
134
|
-
shell_out(
|
133
|
+
shell_out('bower install --allow-root 2>/dev/null')
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
class YarnProject < Project
|
138
|
+
def add_dep
|
139
|
+
add_to_file('yarn.lock', '')
|
140
|
+
add_to_file('package.json', '{"dependencies" : {"http-server": "0.6.1"}}')
|
135
141
|
end
|
136
142
|
end
|
137
143
|
|
138
144
|
class MavenProject < Project
|
139
145
|
def add_dep
|
140
|
-
install_fixture(
|
146
|
+
install_fixture('pom.xml')
|
141
147
|
end
|
142
148
|
|
143
149
|
def install
|
144
|
-
shell_out(
|
150
|
+
shell_out('mvn install')
|
145
151
|
end
|
146
152
|
end
|
147
153
|
|
@@ -183,7 +189,7 @@ module LicenseFinder
|
|
183
189
|
def install
|
184
190
|
orig_gopath = ENV['GOPATH']
|
185
191
|
ENV['GOPATH'] = "#{project_dir}/gopath"
|
186
|
-
shell_out(
|
192
|
+
shell_out('godep restore')
|
187
193
|
ENV['GOPATH'] = orig_gopath
|
188
194
|
end
|
189
195
|
|
@@ -192,6 +198,74 @@ module LicenseFinder
|
|
192
198
|
end
|
193
199
|
end
|
194
200
|
|
201
|
+
class GlideProject < Project
|
202
|
+
def add_dep
|
203
|
+
clone('gopath_glide')
|
204
|
+
end
|
205
|
+
|
206
|
+
def install
|
207
|
+
orig_gopath = ENV['GOPATH']
|
208
|
+
ENV['GOPATH'] = "#{project_dir}/gopath_glide"
|
209
|
+
shell_out('glide install')
|
210
|
+
ENV['GOPATH'] = orig_gopath
|
211
|
+
end
|
212
|
+
|
213
|
+
def shell_out(command)
|
214
|
+
ProjectDir.new(Paths.root.join('tmp', 'projects', 'my_app', 'gopath_glide', 'src')).shell_out(command)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
class GvtProject < Project
|
219
|
+
def add_dep
|
220
|
+
clone('gopath_gvt')
|
221
|
+
end
|
222
|
+
|
223
|
+
def install
|
224
|
+
orig_gopath = ENV['GOPATH']
|
225
|
+
ENV['GOPATH'] = "#{project_dir}/gopath_gvt"
|
226
|
+
shell_out('gvt restore')
|
227
|
+
ENV['GOPATH'] = orig_gopath
|
228
|
+
end
|
229
|
+
|
230
|
+
def shell_out(command)
|
231
|
+
ProjectDir.new(Paths.root.join('tmp', 'projects', 'my_app', 'gopath_gvt', 'src')).shell_out(command)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class DepProject < Project
|
236
|
+
def add_dep
|
237
|
+
clone('gopath_dep')
|
238
|
+
end
|
239
|
+
|
240
|
+
def install
|
241
|
+
orig_gopath = ENV['GOPATH']
|
242
|
+
ENV['GOPATH'] = "#{project_dir}/gopath_dep"
|
243
|
+
shell_out('dep ensure')
|
244
|
+
ENV['GOPATH'] = orig_gopath
|
245
|
+
end
|
246
|
+
|
247
|
+
def shell_out(command)
|
248
|
+
ProjectDir.new(Paths.root.join('tmp', 'projects', 'my_app', 'gopath_dep', 'src', 'foo-dep')).shell_out(command)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
class GovendorProject < Project
|
253
|
+
def add_dep
|
254
|
+
clone('gopath_govendor')
|
255
|
+
end
|
256
|
+
|
257
|
+
def install
|
258
|
+
orig_gopath = ENV['GOPATH']
|
259
|
+
ENV['GOPATH'] = "#{project_dir}/gopath_govendor"
|
260
|
+
shell_out('govendor sync')
|
261
|
+
ENV['GOPATH'] = orig_gopath
|
262
|
+
end
|
263
|
+
|
264
|
+
def shell_out(command)
|
265
|
+
ProjectDir.new(Paths.root.join('tmp', 'projects', 'my_app', 'gopath_govendor', 'src')).shell_out(command)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
195
269
|
class CompositeProject < Project
|
196
270
|
def add_dep
|
197
271
|
clone('single-module-gradle')
|
@@ -201,21 +275,54 @@ module LicenseFinder
|
|
201
275
|
|
202
276
|
class CocoaPodsProject < Project
|
203
277
|
def add_dep
|
204
|
-
install_fixture(
|
278
|
+
install_fixture('Podfile')
|
205
279
|
end
|
206
280
|
|
207
281
|
def install
|
208
|
-
shell_out(
|
282
|
+
shell_out('pod install --no-integrate')
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
class CarthageProject < Project
|
287
|
+
def add_dep
|
288
|
+
install_fixture('Cartfile')
|
289
|
+
end
|
290
|
+
|
291
|
+
def install
|
292
|
+
shell_out('carthage bootstrap')
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
class ConanProject < Project
|
297
|
+
def add_dep
|
298
|
+
install_fixture('conanfile.txt')
|
299
|
+
end
|
300
|
+
|
301
|
+
def install
|
302
|
+
shell_out('conan install')
|
209
303
|
end
|
210
304
|
end
|
211
305
|
|
212
306
|
class RebarProject < Project
|
213
307
|
def add_dep
|
214
|
-
install_fixture(
|
308
|
+
install_fixture('rebar.config')
|
215
309
|
end
|
216
310
|
|
217
311
|
def install
|
218
|
-
shell_out(
|
312
|
+
shell_out('rebar get-deps')
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
class MixProject < Project
|
317
|
+
def add_dep
|
318
|
+
install_fixture('mix.exs')
|
319
|
+
end
|
320
|
+
|
321
|
+
def install
|
322
|
+
shell_out('mix local.hex --force')
|
323
|
+
shell_out('mix local.rebar --force')
|
324
|
+
shell_out('mix deps.get')
|
325
|
+
shell_out('mix deps.compile')
|
219
326
|
end
|
220
327
|
end
|
221
328
|
|
@@ -232,7 +339,7 @@ module LicenseFinder
|
|
232
339
|
end
|
233
340
|
|
234
341
|
def install
|
235
|
-
shell_out(
|
342
|
+
shell_out('bundle install')
|
236
343
|
end
|
237
344
|
|
238
345
|
def depend_on(gem, bundler_options = {})
|
@@ -247,11 +354,12 @@ module LicenseFinder
|
|
247
354
|
end
|
248
355
|
|
249
356
|
def add_to_gemfile(content)
|
250
|
-
add_to_file(
|
357
|
+
add_to_file('Gemfile', content)
|
251
358
|
end
|
252
359
|
end
|
253
360
|
|
254
|
-
|
361
|
+
# lives adjacent to a BundlerProject, so has a different lifecycle from other Projects and doesn't inherit
|
362
|
+
class GemProject
|
255
363
|
def self.create(name, options)
|
256
364
|
result = new(name)
|
257
365
|
result.define(options)
|
@@ -288,13 +396,13 @@ module LicenseFinder
|
|
288
396
|
|
289
397
|
def gemspec_string(options)
|
290
398
|
dependencies = Array(options[:dependencies]).map do |dep|
|
291
|
-
%
|
399
|
+
%(s.add_dependency "#{dep}")
|
292
400
|
end.join("\n")
|
293
401
|
|
294
402
|
<<-GEMSPEC
|
295
403
|
Gem::Specification.new do |s|
|
296
404
|
s.name = "#{name}"
|
297
|
-
s.version = "#{options[:version] ||
|
405
|
+
s.version = "#{options[:version] || '0.0.0'}"
|
298
406
|
s.license = "#{options.fetch(:license)}"
|
299
407
|
s.author = "license_finder tests"
|
300
408
|
s.summary = "#{options[:summary]}"
|
@@ -307,7 +415,9 @@ module LicenseFinder
|
|
307
415
|
end
|
308
416
|
|
309
417
|
require 'capybara'
|
310
|
-
class HtmlReport < SimpleDelegator
|
418
|
+
class HtmlReport < SimpleDelegator
|
419
|
+
# delegates to the parsed html
|
420
|
+
|
311
421
|
def self.from_string(str)
|
312
422
|
new(Capybara.string(str))
|
313
423
|
end
|
@@ -319,15 +429,15 @@ module LicenseFinder
|
|
319
429
|
end
|
320
430
|
|
321
431
|
def approved?(dep_name)
|
322
|
-
classes_of(dep_name).include?
|
432
|
+
classes_of(dep_name).include? 'approved'
|
323
433
|
end
|
324
434
|
|
325
435
|
def unapproved?(dep_name)
|
326
|
-
classes_of(dep_name).include?
|
436
|
+
classes_of(dep_name).include? 'unapproved'
|
327
437
|
end
|
328
438
|
|
329
439
|
def titled?(title)
|
330
|
-
find(
|
440
|
+
find('h1').has_content? title
|
331
441
|
end
|
332
442
|
|
333
443
|
private
|
@@ -337,7 +447,9 @@ module LicenseFinder
|
|
337
447
|
end
|
338
448
|
end
|
339
449
|
|
340
|
-
class ProjectDir < SimpleDelegator
|
450
|
+
class ProjectDir < SimpleDelegator
|
451
|
+
# delegates to a Pathname
|
452
|
+
|
341
453
|
def shell_out(command, allow_failures = false)
|
342
454
|
Dir.chdir(self) { Shell.run(command, allow_failures) }
|
343
455
|
end
|
@@ -369,22 +481,22 @@ module LicenseFinder
|
|
369
481
|
|
370
482
|
def root
|
371
483
|
# where license_finder is installed
|
372
|
-
ProjectDir.new(Pathname.new(__FILE__).dirname.join(
|
484
|
+
ProjectDir.new(Pathname.new(__FILE__).dirname.join('..', '..').realpath)
|
373
485
|
end
|
374
486
|
|
375
487
|
def fixtures
|
376
|
-
root.join(
|
488
|
+
root.join('features', 'fixtures')
|
377
489
|
end
|
378
490
|
|
379
491
|
def projects
|
380
|
-
root.join(
|
492
|
+
root.join('tmp', 'projects')
|
381
493
|
end
|
382
494
|
|
383
495
|
def my_app
|
384
|
-
root.join(
|
496
|
+
root.join('tmp', 'projects', 'my_app')
|
385
497
|
end
|
386
498
|
|
387
|
-
def project(name =
|
499
|
+
def project(name = 'my_app')
|
388
500
|
ProjectDir.new(projects.join(name))
|
389
501
|
end
|
390
502
|
|
@@ -397,21 +509,21 @@ module LicenseFinder
|
|
397
509
|
end
|
398
510
|
|
399
511
|
module Shell
|
400
|
-
ERROR_MESSAGE_FORMAT = <<
|
512
|
+
ERROR_MESSAGE_FORMAT = <<ERRORFORMAT.freeze
|
401
513
|
Command failed: `%s`
|
402
514
|
output: %s
|
403
515
|
exit: %d
|
404
|
-
|
516
|
+
ERRORFORMAT
|
405
517
|
|
406
518
|
def self.run(command, allow_failures = false)
|
407
519
|
output = `#{command} 2>&1`
|
408
|
-
status =
|
520
|
+
status = $CHILD_STATUS
|
409
521
|
unless status.success? || allow_failures
|
410
|
-
message =
|
411
|
-
raise
|
522
|
+
message = format ERROR_MESSAGE_FORMAT, command, output.chomp, status.exitstatus
|
523
|
+
raise message
|
412
524
|
end
|
413
525
|
|
414
|
-
|
526
|
+
[output, status.exitstatus]
|
415
527
|
end
|
416
528
|
end
|
417
529
|
end
|
data/lib/license_finder.rb
CHANGED
@@ -2,10 +2,11 @@ require 'pathname'
|
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
module LicenseFinder
|
5
|
-
ROOT_PATH = Pathname.new(__FILE__).dirname.join(
|
6
|
-
BIN_PATH = ROOT_PATH.join(
|
5
|
+
ROOT_PATH = Pathname.new(__FILE__).dirname.join('license_finder')
|
6
|
+
BIN_PATH = ROOT_PATH.join('../../bin')
|
7
7
|
end
|
8
8
|
|
9
|
-
require 'license_finder/
|
9
|
+
require 'license_finder/shared_helpers/cmd'
|
10
10
|
|
11
|
+
require 'license_finder/core'
|
11
12
|
require 'license_finder/cli'
|