license_finder 4.0.2 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -2
- data/CHANGELOG.md +16 -1
- data/CONTRIBUTING.md +23 -5
- data/Gemfile +0 -1
- data/README.md +6 -1
- data/Rakefile +2 -2
- data/ci/pipelines/pipeline.yml.erb +1 -1
- data/ci/pipelines/release.yml +14 -23
- data/ci/scripts/pushscript.sh +1 -2
- data/ci/scripts/run-rubocop.sh +1 -1
- data/ci/scripts/updateChangelog.sh +77 -0
- data/ci/tasks/build.yml +1 -1
- data/ci/tasks/update-changelog.yml +15 -0
- data/lib/license_finder/cli/base.rb +19 -13
- data/lib/license_finder/cli/main.rb +54 -37
- data/lib/license_finder/cli/makes_decisions.rb +3 -2
- data/lib/license_finder/configuration.rb +68 -15
- data/lib/license_finder/core.rb +17 -7
- data/lib/license_finder/decisions_factory.rb +11 -0
- data/lib/license_finder/license/templates/SimplifiedBSD.txt +1 -1
- data/lib/license_finder/license_aggregator.rb +11 -6
- data/lib/license_finder/logger.rb +2 -2
- data/lib/license_finder/package.rb +18 -16
- data/lib/license_finder/package_manager.rb +40 -47
- data/lib/license_finder/package_managers/bower.rb +8 -4
- data/lib/license_finder/package_managers/bundler.rb +8 -5
- data/lib/license_finder/package_managers/carthage.rb +4 -4
- data/lib/license_finder/package_managers/cocoa_pods.rb +2 -2
- data/lib/license_finder/package_managers/conan.rb +1 -1
- data/lib/license_finder/package_managers/gradle.rb +1 -1
- data/lib/license_finder/package_managers/maven.rb +1 -3
- data/lib/license_finder/package_managers/mix.rb +8 -4
- data/lib/license_finder/package_managers/npm.rb +5 -1
- data/lib/license_finder/package_managers/pip.rb +2 -2
- data/lib/license_finder/package_managers/rebar.rb +4 -4
- data/lib/license_finder/package_managers/yarn.rb +2 -2
- data/lib/license_finder/{packages → package_utils}/activation.rb +0 -0
- data/lib/license_finder/{package_managers → package_utils}/conan_info_parser.rb +1 -1
- data/lib/license_finder/{package_managers → package_utils}/gradle_dependency_finder.rb +0 -0
- data/lib/license_finder/{packages → package_utils}/license_files.rb +1 -1
- data/lib/license_finder/{packages → package_utils}/licensing.rb +1 -1
- data/lib/license_finder/{package_managers → package_utils}/maven_dependency_finder.rb +0 -0
- data/lib/license_finder/{packages → package_utils}/possible_license_file.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/bower_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/bundler_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/carthage_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/cocoa_pods_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/conan_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/go_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/gradle_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/maven_package.rb +0 -0
- data/lib/license_finder/packages/merged_package.rb +42 -0
- data/lib/license_finder/{package_managers → packages}/mix_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/npm_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/nuget_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/pip_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/rebar_package.rb +0 -0
- data/lib/license_finder/packages/yarn_package.rb +7 -0
- data/lib/license_finder/project_finder.rb +1 -1
- data/lib/license_finder/reports/csv_report.rb +1 -0
- data/lib/license_finder/reports/merged_report.rb +2 -0
- data/lib/license_finder/reports/templates/html_report.erb +8 -0
- data/lib/license_finder/reports/templates/markdown_report.erb +7 -0
- data/lib/license_finder/scanner.rb +38 -0
- data/lib/license_finder/version.rb +1 -1
- data/license_finder.gemspec +9 -2
- metadata +37 -101
- data/ci/tasks/get-version-and-tag.yml +0 -20
- data/features/features/cli/cli_spec.rb +0 -63
- data/features/features/configure/add_dependencies_spec.rb +0 -54
- data/features/features/configure/approve_dependencies_spec.rb +0 -61
- data/features/features/configure/assign_licenses_spec.rb +0 -35
- data/features/features/configure/blacklist_licenses_spec.rb +0 -30
- data/features/features/configure/ignore_dependencies_spec.rb +0 -35
- data/features/features/configure/ignore_groups_spec.rb +0 -46
- data/features/features/configure/name_project_spec.rb +0 -33
- data/features/features/configure/set_project_path_spec.rb +0 -17
- data/features/features/configure/whitelist_licenses_spec.rb +0 -38
- data/features/features/package_managers/bower_spec.rb +0 -14
- data/features/features/package_managers/carthage_spec.rb +0 -14
- data/features/features/package_managers/cocoapods_spec.rb +0 -14
- data/features/features/package_managers/conan_spec.rb +0 -11
- data/features/features/package_managers/dep_spec.rb +0 -15
- data/features/features/package_managers/glide_spec.rb +0 -26
- data/features/features/package_managers/godep_spec.rb +0 -17
- data/features/features/package_managers/govendor_spec.rb +0 -15
- data/features/features/package_managers/gradle_spec.rb +0 -34
- data/features/features/package_managers/gvt_spec.rb +0 -14
- data/features/features/package_managers/maven_spec.rb +0 -22
- data/features/features/package_managers/mix_spec.rb +0 -16
- data/features/features/package_managers/npm_spec.rb +0 -14
- data/features/features/package_managers/nuget_spec.rb +0 -14
- data/features/features/package_managers/pip_spec.rb +0 -14
- data/features/features/package_managers/rebar_spec.rb +0 -14
- data/features/features/package_managers/yarn_spec.rb +0 -14
- data/features/features/report/composite_spec.rb +0 -28
- data/features/features/report/csv_spec.rb +0 -18
- data/features/features/report/diff_spec.rb +0 -203
- data/features/features/report/html_spec.rb +0 -51
- data/features/features/report/java_groups_spec.rb +0 -11
- data/features/features/report/subproject_spec.rb +0 -63
- data/features/fixtures/Cartfile +0 -1
- data/features/fixtures/Podfile +0 -3
- data/features/fixtures/alternate-build-file-gradle/build-alt.gradle +0 -16
- data/features/fixtures/alternate-build-file-gradle/settings.gradle +0 -1
- data/features/fixtures/build.gradle +0 -16
- data/features/fixtures/conanfile.txt +0 -11
- data/features/fixtures/file-based-libs-gradle/build.gradle +0 -16
- data/features/fixtures/file-based-libs-gradle/libs/data.json-0.2.3.jar +0 -0
- data/features/fixtures/gopath/src/github.com/pivotal/foo/Godeps/Godeps.json +0 -16
- data/features/fixtures/gopath/src/github.com/pivotal/foo/Godeps/Readme +0 -5
- data/features/fixtures/gopath/src/github.com/pivotal/foo/foo.go +0 -6
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.lock +0 -14
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.toml +0 -7
- data/features/fixtures/gopath_dep/src/foo-dep/bar/bar.go +0 -10
- data/features/fixtures/gopath_dep/src/foo-dep/foo.go +0 -7
- data/features/fixtures/gopath_dep/src/foo-dep/vendor/a/b/LICENSE +0 -1
- data/features/fixtures/gopath_glide/src/glide.lock +0 -9
- data/features/fixtures/gopath_glide/src/glide.yaml +0 -6
- data/features/fixtures/gopath_glide_without_src/glide.lock +0 -9
- data/features/fixtures/gopath_glide_without_src/glide.yaml +0 -6
- data/features/fixtures/gopath_govendor/src/vendor/vendor.json +0 -19
- data/features/fixtures/gopath_gvt/src/vendor/manifest +0 -22
- data/features/fixtures/gradle-wrapper/build.gradle +0 -16
- data/features/fixtures/gradle-wrapper/gradlew +0 -8
- data/features/fixtures/gradle-wrapper/gradlew.bat +0 -9
- data/features/fixtures/maven-wrapper/mvnw +0 -3
- data/features/fixtures/maven-wrapper/mvnw.cmd +0 -7
- data/features/fixtures/maven-wrapper/pom.xml +0 -37
- data/features/fixtures/mix.exs +0 -22
- data/features/fixtures/multi-module-gradle/build.gradle +0 -12
- data/features/fixtures/multi-module-gradle/module1/build.gradle +0 -3
- data/features/fixtures/multi-module-gradle/module2/build.gradle +0 -3
- data/features/fixtures/multi-module-gradle/settings.gradle +0 -1
- data/features/fixtures/nuget/.nuget/.keep +0 -0
- data/features/fixtures/nuget/Fun.Test/packages.config +0 -4
- data/features/fixtures/nuget/Fun/packages.config +0 -5
- data/features/fixtures/pom.xml +0 -19
- data/features/fixtures/rebar.config +0 -12
- data/features/fixtures/single-module-gradle/build.gradle +0 -16
- data/features/support/feature_helper.rb +0 -15
- data/features/support/testing_dsl.rb +0 -564
- data/lib/license_finder/package_managers/merged_package.rb +0 -95
- data/license_finder-2.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc4eb2dc999e63e0e940edc1adaba70c722f53b8
|
4
|
+
data.tar.gz: e2439059250e4ec5e0db823bd911f5ddb360a772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6b05a9967e640c0c56423d062a3a4ae279217a51758be4f88ac4feae8d271222add27f586664bf79c8ae621cfda9495e40df7a500fa50650aa749bb0f8a58b0
|
7
|
+
data.tar.gz: 0f6365ebe0ad2fc32ead860a0b1a55dc29bf138f4c45e3d412e281f00ff26fa7cbbf154bd9c4ce1fcf2336682b29c25a6ae538d911e0f8281c94249cc9d08c0b
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#Layout Cops
|
2
2
|
IndentHeredoc:
|
3
3
|
Enabled: false
|
4
|
+
EmptyLinesAroundArguments:
|
5
|
+
Enabled: false
|
4
6
|
|
5
7
|
#Linting Cops
|
6
8
|
AmbiguousRegexpLiteral:
|
@@ -8,7 +10,7 @@ AmbiguousRegexpLiteral:
|
|
8
10
|
|
9
11
|
# Metrics Cops
|
10
12
|
AbcSize:
|
11
|
-
Max:
|
13
|
+
Max: 35
|
12
14
|
BlockLength:
|
13
15
|
Enabled: false # TODO: enable and refactor long methods
|
14
16
|
# ExcludedMethods: ['describe', 'context', 'it', 'shared_examples'] # uncomment once enabled
|
@@ -43,7 +45,7 @@ MethodMissing:
|
|
43
45
|
Enabled: false
|
44
46
|
ModuleFunction:
|
45
47
|
Enabled: false
|
46
|
-
|
48
|
+
EnforcedStyle: extend_self
|
47
49
|
AllCops:
|
48
50
|
Include:
|
49
51
|
- 'bin/license_finder'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# [4.0.2] / 2017-11-16
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
|
5
|
+
* Fixed --quiet not being available on the report task
|
6
|
+
* Fixed --recursive not being available on the action_items task
|
7
|
+
|
8
|
+
# [4.0.1] / 2017-11-14
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
* Add missing toml dependency to gemspec
|
13
|
+
|
1
14
|
# [4.0.0] / 2017-11-10
|
2
15
|
|
3
16
|
### Changed
|
@@ -497,7 +510,9 @@ Bugfixes:
|
|
497
510
|
* Fix blow up if there's not `ignore_groups` setting in the config file.
|
498
511
|
|
499
512
|
|
500
|
-
[Unreleased]: https://github.com/pivotal/LicenseFinder/compare/
|
513
|
+
[Unreleased]: https://github.com/pivotal/LicenseFinder/compare/v4.0.2...HEAD
|
514
|
+
[4.0.2]: https://github.com/pivotal/LicenseFinder/compare/v4.0.1...v4.0.2
|
515
|
+
[4.0.1]: https://github.com/pivotal/LicenseFinder/compare/v4.0.0...v4.0.1
|
501
516
|
[4.0.0]: https://github.com/pivotal/LicenseFinder/compare/v3.1.0...v4.0.0
|
502
517
|
[3.1.0]: https://github.com/pivotal/LicenseFinder/compare/v3.0.4...v3.1.0
|
503
518
|
[3.0.4]: https://github.com/pivotal/LicenseFinder/compare/v3.0.2...v3.0.4
|
data/CONTRIBUTING.md
CHANGED
@@ -10,23 +10,41 @@
|
|
10
10
|
|
11
11
|
## Running Tests
|
12
12
|
|
13
|
-
You can use the [LicenseFinder docker image](https://hub.docker.com/r/licensefinder/license_finder/) to run the tests.
|
13
|
+
You can use the [LicenseFinder docker image](https://hub.docker.com/r/licensefinder/license_finder/) to run the tests by using the `dlf` script.
|
14
|
+
There are 2 sets of tests to run in order to confirm that License Finder is working as intended:
|
14
15
|
|
15
16
|
```
|
16
|
-
|
17
|
+
./dlf rake spec
|
18
|
+
./dlf bundle exec rake features
|
19
|
+
```
|
20
|
+
|
21
|
+
The `spec` task runs all the unit test and the `features` task will run all the feature test.
|
22
|
+
Note that the feature test needs to be wrapped in `bundle exec`, or else it
|
23
|
+
will use the gem version installed inside the docker image.
|
24
|
+
|
25
|
+
## Useful Tips
|
17
26
|
|
18
|
-
|
27
|
+
To build the docker image simply call `docker build .` or explicitly pass the `Dockerfile`. Prebuilt versions of the
|
28
|
+
dockerfile can also be found on [Dockerhub](https://hub.docker.com/r/licensefinder/license_finder/tags/).
|
19
29
|
|
20
|
-
|
21
|
-
$ rake
|
30
|
+
To launch the docker image and interact with it via bash:
|
22
31
|
```
|
32
|
+
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -l
|
33
|
+
|
34
|
+
```
|
35
|
+
`-v $PWD:/scan` will mount the current working directory to the /scan path.
|
23
36
|
|
24
37
|
## Adding Package Managers
|
25
38
|
|
26
39
|
There are a few steps to adding a new package manager.
|
40
|
+
The main things which need to be implemented are mentioned in [Package Manager](https://github.com/pivotal/LicenseFinder/blob/master/lib/license_finder/package_manager.rb).
|
41
|
+
|
27
42
|
[Here](https://github.com/pivotal/LicenseFinder/compare/v2.0.0...v2.0.1) is how
|
28
43
|
support was added for `rebar`, an `erlang` package manager.
|
29
44
|
|
45
|
+
There are feature tests and unit tests for each currently supported package manager.
|
46
|
+
* [Feature test example](https://github.com/pivotal/LicenseFinder/blob/master/features/features/package_managers/gvt_spec.rb)
|
47
|
+
* [Unit test example](https://github.com/pivotal/LicenseFinder/blob/master/spec/lib/license_finder/package_managers/gvt_spec.rb)
|
30
48
|
|
31
49
|
## Adding Licenses
|
32
50
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -143,6 +143,11 @@ You can better understand the way this script works by looking at its source, bu
|
|
143
143
|
reference it will mount your current directory at the path `/scan` and run any commands
|
144
144
|
passed to it from that directory.
|
145
145
|
|
146
|
+
Note that the docker image will run the gem which is installed within it.
|
147
|
+
So the docker image tagged `4.0.2` will run *License Finder Version 4.0.2*
|
148
|
+
|
149
|
+
See the [contibuting guide](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md) for information on development.
|
150
|
+
|
146
151
|
### Activation
|
147
152
|
|
148
153
|
`license_finder` will find and include packages for all supported
|
@@ -394,7 +399,7 @@ downloadLicenses {
|
|
394
399
|
}
|
395
400
|
```
|
396
401
|
|
397
|
-
### Conan
|
402
|
+
### Conan Projects
|
398
403
|
|
399
404
|
`license_finder` supports Conan. You need to have the following lines in your conanfile.txt for `license_finder` to retrieve dependencies' licenses.
|
400
405
|
Ensure that `conan install` does not generate an error.
|
data/Rakefile
CHANGED
@@ -35,8 +35,8 @@ desc 'Check for non-Ruby development dependencies.'
|
|
35
35
|
task :check_dependencies do
|
36
36
|
require './lib/license_finder'
|
37
37
|
satisfied = true
|
38
|
-
LicenseFinder::
|
39
|
-
satisfied = false unless package_manager.installed?(LicenseFinder::Logger.new(
|
38
|
+
LicenseFinder::Scanner::PACKAGE_MANAGERS.each do |package_manager|
|
39
|
+
satisfied = false unless package_manager.installed?(LicenseFinder::Logger.new(LicenseFinder::Logger::MODE_INFO))
|
40
40
|
end
|
41
41
|
STDOUT.flush
|
42
42
|
exit 1 unless satisfied
|
data/ci/pipelines/release.yml
CHANGED
@@ -6,14 +6,6 @@ resources:
|
|
6
6
|
private_key: ((CfOslBotPrivateKey))
|
7
7
|
branch: master
|
8
8
|
|
9
|
-
- name: lf-dockerfile
|
10
|
-
type: git
|
11
|
-
source:
|
12
|
-
uri: git@github.com:pivotal/LicenseFinder.git
|
13
|
-
private_key: ((CfOslBotPrivateKey))
|
14
|
-
branch: master
|
15
|
-
paths: ["Dockerfile"]
|
16
|
-
|
17
9
|
- name: lf-image
|
18
10
|
type: docker-image
|
19
11
|
source:
|
@@ -27,16 +19,9 @@ resources:
|
|
27
19
|
source:
|
28
20
|
owner: pivotal
|
29
21
|
repository: LicenseFinder
|
30
|
-
access_token: ((
|
22
|
+
access_token: ((GithubApiRootToken))
|
31
23
|
|
32
24
|
jobs:
|
33
|
-
- name: docker
|
34
|
-
plan:
|
35
|
-
- get: lf-dockerfile
|
36
|
-
trigger: true
|
37
|
-
- put: lf-image
|
38
|
-
params:
|
39
|
-
build: lf-dockerfile
|
40
25
|
|
41
26
|
- name: release
|
42
27
|
plan:
|
@@ -44,9 +29,18 @@ jobs:
|
|
44
29
|
- get: lf-image
|
45
30
|
params:
|
46
31
|
save: true
|
47
|
-
-
|
32
|
+
- get: lf-release
|
33
|
+
- task: update-changelog
|
48
34
|
image: lf-image
|
49
|
-
|
35
|
+
params:
|
36
|
+
GIT_USERNAME: ((GithubApiUser))
|
37
|
+
GIT_EMAIL: ((GithubApiEmail))
|
38
|
+
file: lf-git/ci/tasks/update-changelog.yml
|
39
|
+
- put: lf-image
|
40
|
+
params:
|
41
|
+
build: lf-git
|
42
|
+
tag: version/version.txt
|
43
|
+
tag_as_latest: true
|
50
44
|
- task: build-and-push-gem
|
51
45
|
image: lf-image
|
52
46
|
params:
|
@@ -54,13 +48,10 @@ jobs:
|
|
54
48
|
file: lf-git/ci/tasks/build-and-push-gem.yml
|
55
49
|
- put: lf-git
|
56
50
|
params:
|
57
|
-
repository: lf-git
|
51
|
+
repository: lf-git-changed
|
58
52
|
tag: version/tag.txt
|
59
|
-
- put: lf-image
|
60
|
-
params:
|
61
|
-
load: lf-image
|
62
|
-
tag: version/version.txt
|
63
53
|
- put: lf-release
|
64
54
|
params:
|
65
55
|
name: version/tag.txt
|
66
56
|
tag: version/tag.txt
|
57
|
+
body: version/changelog.txt
|
data/ci/scripts/pushscript.sh
CHANGED
data/ci/scripts/run-rubocop.sh
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
git clone lf-git lf-git-changed
|
6
|
+
|
7
|
+
CHANGELOG_FILE="CHANGELOG.md"
|
8
|
+
COMMIT_URL="https://github.com/pivotal/LicenseFinder/commit/"
|
9
|
+
|
10
|
+
TAGS=( "Added" "ADDED" "Fixed" "FIXED" "Changed" "CHANGED" "Deprecated" "DEPRECATED" "Removed" "REMOVED" "Security" "SECURITY" )
|
11
|
+
CONTRIBUTORS=( "Shane Lattanzio" "Daniil Kouznetsov" "Andy Shen" "Li Tai" "Ryan Collins" "Vikram Yadav" )
|
12
|
+
|
13
|
+
OLD="v$(cat ./lf-release/version)"
|
14
|
+
VERSION="$(ruby -r ./lf-git-changed/lib/license_finder/version.rb -e "puts LicenseFinder::VERSION")"
|
15
|
+
VERSION_TAG="v$VERSION"
|
16
|
+
|
17
|
+
# Add version title information
|
18
|
+
LOG=$(echo "# [$VERSION] / $(date +%Y-%m-%d)\n")
|
19
|
+
|
20
|
+
cd lf-git-changed
|
21
|
+
|
22
|
+
for ((i = 0; i < ${#TAGS[@]}; i++)); do
|
23
|
+
if [[ $i -gt 0 ]]; then
|
24
|
+
TAG_COMPARE=$(echo "${TAGS[$i]}" | grep -qi "${TAGS[$i - 1]}" && echo same || echo different)
|
25
|
+
HEADER_EXISTS=$(echo "$LOG" | grep -qi "${TAGS[$i - 1]}" && echo exists || echo dne)
|
26
|
+
fi
|
27
|
+
|
28
|
+
GIT_LOG=$'\n'$(git log "$OLD"...HEAD --pretty=format:"%H%n%s - [%h]($COMMIT_URL%H) - %an%n%n"| grep -E "\[${TAGS[$i]}\] .*" | sort | sed -e "s/\[${TAGS[$i]}\]/\*/g")
|
29
|
+
|
30
|
+
# Only add section information if it has content
|
31
|
+
if [[ $i -ne $[${#TAGS[@]}-1] && $GIT_LOG =~ "." && $i -gt 0 && "$TAG_COMPARE" == "same" && "$HEADER_EXISTS" == "exists" ]]; then
|
32
|
+
LOG="$LOG""$GIT_LOG\n"
|
33
|
+
elif [[ $GIT_LOG =~ "." ]]; then
|
34
|
+
if [[ $i -gt 0 && "$TAG_COMPARE" == "same" && "$HEADER_EXISTS" == "dne" ]]; then
|
35
|
+
LOG="$LOG"$'\n'$(echo "### ${TAGS[$i - 1]}")"$GIT_LOG\n"
|
36
|
+
else
|
37
|
+
LOG="$LOG"$'\n'$(echo "### ${TAGS[$i]}")"$GIT_LOG\n"
|
38
|
+
fi
|
39
|
+
fi
|
40
|
+
done
|
41
|
+
|
42
|
+
# Strip Pivotal contributors
|
43
|
+
for ((i = 0; i < ${#CONTRIBUTORS[@]}; i++)); do
|
44
|
+
LOG=$(echo "$LOG" | sed -e "s/-* ${CONTRIBUTORS[$i]}//g")
|
45
|
+
done
|
46
|
+
|
47
|
+
# Prepend new version information at the top of the file
|
48
|
+
echo -e "$LOG\n$(cat $CHANGELOG_FILE)" > $CHANGELOG_FILE
|
49
|
+
|
50
|
+
# Append version hyperlink to the end of the file
|
51
|
+
echo -e "[$VERSION]: https://github.com/pivotal/LicenseFinder/compare/$OLD...$VERSION_TAG" >> $CHANGELOG_FILE
|
52
|
+
|
53
|
+
git config --global user.email $GIT_EMAIL
|
54
|
+
git config --global user.name $GIT_USERNAME
|
55
|
+
|
56
|
+
git add $CHANGELOG_FILE
|
57
|
+
git commit -m "Update changelog for version: $VERSION"
|
58
|
+
|
59
|
+
echo "New version: $VERSION"
|
60
|
+
echo "Current version: $OLD"
|
61
|
+
|
62
|
+
if [ "$VERSION" == "$OLD" ]; then
|
63
|
+
echo "Error: Version in version.rb is identical to latest release on github"
|
64
|
+
exit 1
|
65
|
+
fi
|
66
|
+
|
67
|
+
body=$(cat "$CHANGELOG_FILE" | sed -n "/# \[$VERSION\]/,/# \[[\d\.]*/p" | sed '$d' | tail -n +2)
|
68
|
+
|
69
|
+
echo "$VERSION_TAG" > ../version/tag.txt
|
70
|
+
echo "$VERSION" > ../version/version.txt
|
71
|
+
echo "$body" > ../version/changelog.txt
|
72
|
+
|
73
|
+
echo "Tag: $VERSION_TAG"
|
74
|
+
echo "Version: $VERSION"
|
75
|
+
echo "Body: $body"
|
76
|
+
|
77
|
+
exit 0
|
data/ci/tasks/build.yml
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
image_resource:
|
3
|
+
type: docker-image
|
4
|
+
source:
|
5
|
+
repository: licensefinder/license_finder
|
6
|
+
tag: latest
|
7
|
+
platform: linux
|
8
|
+
inputs:
|
9
|
+
- name: lf-git
|
10
|
+
- name: lf-release
|
11
|
+
outputs:
|
12
|
+
- name: version
|
13
|
+
- name: lf-git-changed
|
14
|
+
run:
|
15
|
+
path: lf-git/ci/scripts/updateChangelog.sh
|
@@ -7,21 +7,21 @@ module LicenseFinder
|
|
7
7
|
desc: 'Path to the project. Defaults to current working directory.'
|
8
8
|
class_option :decisions_file,
|
9
9
|
desc: 'Where decisions are saved. Defaults to doc/dependency_decisions.yml.'
|
10
|
+
class_option :log_directory,
|
11
|
+
desc: 'Where logs are saved. Defaults to ./lf_logs/$PROJECT/$PACKAGE_MANAGER.log'
|
10
12
|
|
11
13
|
no_commands do
|
12
14
|
def decisions
|
13
|
-
|
15
|
+
@decisions ||= DecisionsFactory.decisions(config.decisions_file_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def config
|
19
|
+
@config ||= Configuration.with_optional_saved_config(license_finder_config)
|
14
20
|
end
|
15
21
|
end
|
16
22
|
|
17
23
|
private
|
18
24
|
|
19
|
-
def license_finder
|
20
|
-
@lf ||= LicenseFinder::Core.new(license_finder_config)
|
21
|
-
fail "Project path '#{@lf.config.project_path}' does not exist!" unless @lf.config.valid_project_path?
|
22
|
-
@lf
|
23
|
-
end
|
24
|
-
|
25
25
|
def fail(message)
|
26
26
|
say(message) && exit(1)
|
27
27
|
end
|
@@ -41,23 +41,29 @@ module LicenseFinder
|
|
41
41
|
:mix_command,
|
42
42
|
:mix_deps_dir,
|
43
43
|
:save,
|
44
|
-
:prepare
|
44
|
+
:prepare,
|
45
|
+
:prepare_no_fail,
|
46
|
+
:log_directory,
|
47
|
+
:format,
|
48
|
+
:columns,
|
49
|
+
:aggregate_paths,
|
50
|
+
:recursive
|
45
51
|
).merge(
|
46
|
-
logger:
|
52
|
+
logger: logger_mode
|
47
53
|
)
|
48
54
|
end
|
49
55
|
|
50
|
-
def
|
56
|
+
def logger_mode
|
51
57
|
quiet = LicenseFinder::Logger::MODE_QUIET
|
52
58
|
debug = LicenseFinder::Logger::MODE_DEBUG
|
53
59
|
info = LicenseFinder::Logger::MODE_INFO
|
54
60
|
mode = extract_options(quiet, debug)
|
55
61
|
if mode[quiet]
|
56
|
-
|
62
|
+
quiet
|
57
63
|
elsif mode[debug]
|
58
|
-
|
64
|
+
debug
|
59
65
|
else
|
60
|
-
|
66
|
+
info
|
61
67
|
end
|
62
68
|
end
|
63
69
|
|
@@ -5,7 +5,6 @@ require 'license_finder/package_delta'
|
|
5
5
|
require 'license_finder/license_aggregator'
|
6
6
|
require 'license_finder/project_finder'
|
7
7
|
require 'license_finder/logger'
|
8
|
-
|
9
8
|
module LicenseFinder
|
10
9
|
module CLI
|
11
10
|
class Main < Base
|
@@ -18,9 +17,6 @@ module LicenseFinder
|
|
18
17
|
'csv' => CsvReport
|
19
18
|
}.freeze
|
20
19
|
|
21
|
-
class_option :format, desc: 'The desired output format.', default: 'text', enum: FORMATS.keys
|
22
|
-
class_option :columns, type: :array, desc: "For text or CSV reports, which columns to print. Pick from: #{CsvReport::AVAILABLE_COLUMNS}", default: %w[name version licenses]
|
23
|
-
class_option :save, desc: "Save report to a file. Default: 'license_report.csv' in project root.", lazy_default: 'license_report'
|
24
20
|
class_option :go_full_version, desc: 'Whether dependency version should include full version. Only meaningful if used with a Go project. Defaults to false.'
|
25
21
|
class_option :gradle_include_groups, desc: 'Whether dependency name should include group id. Only meaningful if used with a Java/gradle project. Defaults to false.'
|
26
22
|
class_option :gradle_command,
|
@@ -35,6 +31,13 @@ module LicenseFinder
|
|
35
31
|
class_option :mix_deps_dir, desc: "Path to Mix dependencies directory. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'deps'."
|
36
32
|
|
37
33
|
# Method options which are shared between report and action_item
|
34
|
+
def self.format_option
|
35
|
+
method_option :format,
|
36
|
+
desc: 'Emit detailed info about what LicenseFinder is doing',
|
37
|
+
default: 'text',
|
38
|
+
enum: FORMATS.keys
|
39
|
+
end
|
40
|
+
|
38
41
|
def self.shared_options
|
39
42
|
method_option :debug,
|
40
43
|
aliases: '-d',
|
@@ -48,19 +51,39 @@ module LicenseFinder
|
|
48
51
|
default: false,
|
49
52
|
required: false
|
50
53
|
|
51
|
-
method_option :
|
52
|
-
|
54
|
+
method_option :prepare_no_fail,
|
55
|
+
type: :boolean,
|
56
|
+
desc: 'Prepares the project first for license_finder but carries on despite any potential failures',
|
57
|
+
default: false,
|
58
|
+
required: false
|
53
59
|
|
54
|
-
method_option :
|
55
|
-
|
60
|
+
method_option :recursive,
|
61
|
+
aliases: '-r',
|
62
|
+
type: :boolean,
|
63
|
+
default: false,
|
64
|
+
desc: 'Recursively runs License Finder on all sub-projects'
|
65
|
+
|
66
|
+
method_option :aggregate_paths,
|
67
|
+
aliases: '-a',
|
68
|
+
type: :array,
|
69
|
+
desc: "Generate a single report for multiple projects. Ex: --aggregate_paths='path/to/project1' 'path/to/project2'"
|
56
70
|
|
57
|
-
method_option :quiet,
|
71
|
+
method_option :quiet,
|
72
|
+
aliases: '-q',
|
73
|
+
type: :boolean,
|
74
|
+
desc: 'Silences progress report',
|
75
|
+
required: false
|
76
|
+
|
77
|
+
method_option :columns,
|
78
|
+
desc: "For text or CSV reports, which columns to print. Pick from: #{CsvReport::AVAILABLE_COLUMNS}",
|
79
|
+
type: :array
|
58
80
|
end
|
59
81
|
|
60
82
|
desc 'action_items', 'List unapproved dependencies (the default action for `license_finder`)'
|
61
83
|
shared_options
|
84
|
+
format_option
|
62
85
|
def action_items
|
63
|
-
finder = LicenseAggregator.new(
|
86
|
+
finder = LicenseAggregator.new(config, aggregate_paths)
|
64
87
|
any_packages = finder.any_packages?
|
65
88
|
unapproved = finder.unapproved
|
66
89
|
blacklisted = finder.blacklisted
|
@@ -95,20 +118,13 @@ module LicenseFinder
|
|
95
118
|
|
96
119
|
desc 'report', "Print a report of the project's dependencies to stdout"
|
97
120
|
shared_options
|
121
|
+
format_option
|
122
|
+
method_option :save, desc: "Save report to a file. Default: 'license_report.csv' in project root.", lazy_default: 'license_report'
|
98
123
|
|
99
124
|
def report
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
if aggregate_paths && !aggregate_paths.empty?
|
105
|
-
finder = LicenseAggregator.new(license_finder_config, aggregate_paths)
|
106
|
-
report = MergedReport.new(finder.dependencies, options)
|
107
|
-
else
|
108
|
-
run_prepare_phase if prepare?
|
109
|
-
report = report_of(license_finder.acknowledged)
|
110
|
-
end
|
111
|
-
save? ? save_report(report, options[:save]) : say(report)
|
125
|
+
finder = LicenseAggregator.new(config, aggregate_paths)
|
126
|
+
report = report_of(finder.dependencies)
|
127
|
+
save? ? save_report(report, config.save_file) : say(report)
|
112
128
|
end
|
113
129
|
|
114
130
|
desc 'version', 'Print the version of LicenseFinder'
|
@@ -117,11 +133,13 @@ module LicenseFinder
|
|
117
133
|
end
|
118
134
|
|
119
135
|
desc 'diff OLDFILE NEWFILE', 'Command to view the differences between two generated reports (csv).'
|
136
|
+
format_option
|
137
|
+
method_option :save, desc: "Save report to a file. Default: 'license_report.csv' in project root.", lazy_default: 'license_report'
|
120
138
|
def diff(file1, file2)
|
121
139
|
f1 = IO.read(file1)
|
122
140
|
f2 = IO.read(file2)
|
123
141
|
report = DiffReport.new(Diff.compare(f1, f2))
|
124
|
-
save? ? save_report(report,
|
142
|
+
save? ? save_report(report, config.save_file) : say(report)
|
125
143
|
end
|
126
144
|
|
127
145
|
subcommand 'dependencies', Dependencies, 'Add or remove dependencies that your package managers are not aware of'
|
@@ -135,11 +153,17 @@ module LicenseFinder
|
|
135
153
|
|
136
154
|
private
|
137
155
|
|
156
|
+
def check_valid_project_path
|
157
|
+
raise "Project path '#{config.project_path}' does not exist!" unless config.valid_project_path?
|
158
|
+
end
|
159
|
+
|
138
160
|
def aggregate_paths
|
139
|
-
|
140
|
-
aggregate_paths =
|
161
|
+
check_valid_project_path
|
162
|
+
aggregate_paths = config.aggregate_paths
|
163
|
+
project_path = config.project_path || Pathname.pwd
|
164
|
+
aggregate_paths = ProjectFinder.new(project_path).find_projects if config.recursive
|
141
165
|
return aggregate_paths unless aggregate_paths.nil? || aggregate_paths.empty?
|
142
|
-
[
|
166
|
+
[config.project_path] unless config.project_path.nil?
|
143
167
|
end
|
144
168
|
|
145
169
|
def save_report(content, file_name)
|
@@ -149,20 +173,13 @@ module LicenseFinder
|
|
149
173
|
end
|
150
174
|
|
151
175
|
def report_of(content)
|
152
|
-
report = FORMATS[
|
153
|
-
report
|
176
|
+
report = FORMATS[config.format] || FORMATS['text']
|
177
|
+
report = MergedReport if report == CsvReport && config.aggregate_paths
|
178
|
+
report.of(content, columns: config.columns, project_name: decisions.project_name || config.project_path.basename.to_s)
|
154
179
|
end
|
155
180
|
|
156
181
|
def save?
|
157
|
-
!!
|
158
|
-
end
|
159
|
-
|
160
|
-
def prepare?
|
161
|
-
options[:prepare]
|
162
|
-
end
|
163
|
-
|
164
|
-
def run_prepare_phase
|
165
|
-
license_finder.prepare_projects
|
182
|
+
!!config.save_file
|
166
183
|
end
|
167
184
|
end
|
168
185
|
end
|