cocoapods-gitlab_license_report 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +142 -0
- data/LICENSE +22 -0
- data/README.md +23 -0
- data/Rakefile +22 -0
- data/cocoapods-gitlab_license_report.gemspec +25 -0
- data/lib/cocoapods-gitlab_license_report.rb +45 -0
- data/lib/cocoapods-gitlab_license_report/report_generator.rb +39 -0
- data/lib/cocoapods-gitlab_license_report/version.rb +3 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/reports/licenses.json +1 -0
- data/spec/license_report_spec.rb +57 -0
- data/spec/report_generator_spec.rb +57 -0
- data/spec/spec_helper.rb +100 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a384e05fdfe00a27a66564092f5aeb449ed9f50fc71e2e3250a4b404ee74ea2
|
4
|
+
data.tar.gz: df0cc2779e57d08bc92d8af4d1e99b611b2b5dd90250859908d2182016e8291b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d1af2f4496ada8c6e431a5a40e7cf0ed5c344a33e52626798ff902b94f1c580ee723ae5eef8547d228cc63a6b7fbbc327adf3d2bc47dd8a5eb325baf46fd1ac
|
7
|
+
data.tar.gz: 9d1bcc82badbf732e56eada6237979be96ab258515dfc893270f73381cf587c7b18e6e7ed2f7eb533d4eb9b8e84b1bbecc714f46974a4cf4141f6df5f0243a32
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-gitlab_license_report (1.0.0)
|
5
|
+
cocoapods
|
6
|
+
license_finder
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
CFPropertyList (3.0.2)
|
12
|
+
activesupport (5.2.4.4)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
addressable (2.7.0)
|
18
|
+
public_suffix (>= 2.0.2, < 5.0)
|
19
|
+
algoliasearch (1.27.5)
|
20
|
+
httpclient (~> 2.8, >= 2.8.3)
|
21
|
+
json (>= 1.5.1)
|
22
|
+
atomos (0.1.3)
|
23
|
+
bacon (1.2.0)
|
24
|
+
claide (1.0.3)
|
25
|
+
cocoapods (1.10.0)
|
26
|
+
addressable (~> 2.6)
|
27
|
+
claide (>= 1.0.2, < 2.0)
|
28
|
+
cocoapods-core (= 1.10.0)
|
29
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
30
|
+
cocoapods-downloader (>= 1.4.0, < 2.0)
|
31
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
32
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
33
|
+
cocoapods-trunk (>= 1.4.0, < 2.0)
|
34
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
35
|
+
colored2 (~> 3.1)
|
36
|
+
escape (~> 0.0.4)
|
37
|
+
fourflusher (>= 2.3.0, < 3.0)
|
38
|
+
gh_inspector (~> 1.0)
|
39
|
+
molinillo (~> 0.6.6)
|
40
|
+
nap (~> 1.0)
|
41
|
+
ruby-macho (~> 1.4)
|
42
|
+
xcodeproj (>= 1.19.0, < 2.0)
|
43
|
+
cocoapods-core (1.10.0)
|
44
|
+
activesupport (> 5.0, < 6)
|
45
|
+
addressable (~> 2.6)
|
46
|
+
algoliasearch (~> 1.0)
|
47
|
+
concurrent-ruby (~> 1.1)
|
48
|
+
fuzzy_match (~> 2.0.4)
|
49
|
+
nap (~> 1.0)
|
50
|
+
netrc (~> 0.11)
|
51
|
+
public_suffix
|
52
|
+
typhoeus (~> 1.0)
|
53
|
+
cocoapods-deintegrate (1.0.4)
|
54
|
+
cocoapods-downloader (1.4.0)
|
55
|
+
cocoapods-plugins (1.0.0)
|
56
|
+
nap
|
57
|
+
cocoapods-search (1.0.0)
|
58
|
+
cocoapods-trunk (1.5.0)
|
59
|
+
nap (>= 0.8, < 2.0)
|
60
|
+
netrc (~> 0.11)
|
61
|
+
cocoapods-try (1.2.0)
|
62
|
+
colored2 (3.1.2)
|
63
|
+
concurrent-ruby (1.1.7)
|
64
|
+
diff-lcs (1.4.4)
|
65
|
+
escape (0.0.4)
|
66
|
+
ethon (0.12.0)
|
67
|
+
ffi (>= 1.3.0)
|
68
|
+
ffi (1.13.1)
|
69
|
+
fourflusher (2.3.1)
|
70
|
+
fuzzy_match (2.0.4)
|
71
|
+
gh_inspector (1.1.3)
|
72
|
+
httpclient (2.8.3)
|
73
|
+
i18n (1.8.5)
|
74
|
+
concurrent-ruby (~> 1.0)
|
75
|
+
json (2.3.1)
|
76
|
+
license_finder (6.9.0)
|
77
|
+
bundler
|
78
|
+
rubyzip (>= 1, < 3)
|
79
|
+
thor (~> 1.0.1)
|
80
|
+
tomlrb (~> 1.3.0)
|
81
|
+
with_env (= 1.1.0)
|
82
|
+
xml-simple (~> 1.1.5)
|
83
|
+
metaclass (0.0.4)
|
84
|
+
minitest (5.14.2)
|
85
|
+
mocha (0.11.4)
|
86
|
+
metaclass (~> 0.0.1)
|
87
|
+
mocha-on-bacon (0.2.1)
|
88
|
+
mocha (>= 0.9.8)
|
89
|
+
molinillo (0.6.6)
|
90
|
+
nanaimo (0.3.0)
|
91
|
+
nap (1.1.0)
|
92
|
+
netrc (0.11.0)
|
93
|
+
prettybacon (0.0.2)
|
94
|
+
bacon (~> 1.2)
|
95
|
+
public_suffix (4.0.6)
|
96
|
+
rake (13.0.1)
|
97
|
+
rspec (3.9.0)
|
98
|
+
rspec-core (~> 3.9.0)
|
99
|
+
rspec-expectations (~> 3.9.0)
|
100
|
+
rspec-mocks (~> 3.9.0)
|
101
|
+
rspec-core (3.9.3)
|
102
|
+
rspec-support (~> 3.9.3)
|
103
|
+
rspec-expectations (3.9.3)
|
104
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
105
|
+
rspec-support (~> 3.9.0)
|
106
|
+
rspec-mocks (3.9.1)
|
107
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
+
rspec-support (~> 3.9.0)
|
109
|
+
rspec-support (3.9.4)
|
110
|
+
ruby-macho (1.4.0)
|
111
|
+
rubyzip (2.3.0)
|
112
|
+
thor (1.0.1)
|
113
|
+
thread_safe (0.3.6)
|
114
|
+
tomlrb (1.3.0)
|
115
|
+
typhoeus (1.4.0)
|
116
|
+
ethon (>= 0.9.0)
|
117
|
+
tzinfo (1.2.7)
|
118
|
+
thread_safe (~> 0.1)
|
119
|
+
with_env (1.1.0)
|
120
|
+
xcodeproj (1.19.0)
|
121
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
122
|
+
atomos (~> 0.1.3)
|
123
|
+
claide (>= 1.0.2, < 2.0)
|
124
|
+
colored2 (~> 3.1)
|
125
|
+
nanaimo (~> 0.3.0)
|
126
|
+
xml-simple (1.1.5)
|
127
|
+
|
128
|
+
PLATFORMS
|
129
|
+
ruby
|
130
|
+
|
131
|
+
DEPENDENCIES
|
132
|
+
bacon
|
133
|
+
bundler (~> 2.0)
|
134
|
+
cocoapods-gitlab_license_report!
|
135
|
+
mocha (~> 0.11.4)
|
136
|
+
mocha-on-bacon
|
137
|
+
prettybacon
|
138
|
+
rake
|
139
|
+
rspec
|
140
|
+
|
141
|
+
BUNDLED WITH
|
142
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Fabio Pelosin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# CocoaPods Acknowledgements
|
2
|
+
|
3
|
+
A CocoaPods plugin that generates a Gitlab compatible report of all the installed library licenses.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
Install via `gem install cocoapods-gitlab_license_report` you need to be using at least CocoaPods `0.36` and add `plugin 'cocoapods-gitlab_license_report'` to your `Podfile`. See below for examples:
|
8
|
+
|
9
|
+
### Example usage
|
10
|
+
|
11
|
+
``` ruby
|
12
|
+
plugin 'cocoapods-gitlab_license_report', :report_path => 'relative_path'
|
13
|
+
```
|
14
|
+
|
15
|
+
The default `report_path` is: `reports/licenses.json`
|
16
|
+
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
plugin 'cocoapods-gitlab_license_report', :report_path => 'relative_path', :exclude => ['pod_name1', 'pod_name2']
|
20
|
+
```
|
21
|
+
|
22
|
+
Exclude pods pod_name1 and pod_name2 from the license report.
|
23
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
def specs(dir)
|
4
|
+
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
5
|
+
end
|
6
|
+
|
7
|
+
task :bootstrap, :use_bundle_dir? do |t, args|
|
8
|
+
if args[:use_bundle_dir?]
|
9
|
+
sh "bundle install --path ./travis_bundle_dir"
|
10
|
+
else
|
11
|
+
sh "bundle install"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
namespace :spec do
|
16
|
+
desc "Runs all the specs"
|
17
|
+
task :ci do
|
18
|
+
sh "bundle exec bacon #{specs('**')}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
task :default => "spec:ci"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-gitlab_license_report/version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cocoapods-gitlab_license_report"
|
8
|
+
spec.version = CocoaPodsGitlabLicenseReport::VERSION
|
9
|
+
spec.authors = ["Fabio Gallonetto"]
|
10
|
+
spec.summary = %q{CocoaPods plugin that generates an license report for gitlab license scanner}
|
11
|
+
#spec.homepage = "https://git.curve.tools/dev-tools/cocoapods-gitlab_license_report"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_runtime_dependency 'cocoapods'
|
20
|
+
spec.add_runtime_dependency 'license_finder'
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module CocoaPodsGitlabLicenseReport
|
2
|
+
require 'cocoapods-gitlab_license_report/report_generator'
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'set'
|
5
|
+
|
6
|
+
class PostInstallHookHandler
|
7
|
+
def initialize(context, options, generator = nil)
|
8
|
+
@context = context
|
9
|
+
@options = options
|
10
|
+
@generator = generator || ReportGenerator.new(@context)
|
11
|
+
end
|
12
|
+
|
13
|
+
def handle!
|
14
|
+
Pod::UI.section 'Generating Gitlab licenses report' do
|
15
|
+
|
16
|
+
report_path = @options["report_path"] || 'reports/licenses.json'
|
17
|
+
excluded_pods = Set.new(@options["exclude"])
|
18
|
+
|
19
|
+
sandbox = @context.sandbox if defined? @context.sandbox
|
20
|
+
sandbox ||= Pod::Sandbox.new(@context.sandbox_root)
|
21
|
+
|
22
|
+
installed_specs = @context.umbrella_targets.flat_map(&:specs).map(&:root).uniq
|
23
|
+
licenses_report = @generator.generate(installed_specs, excluded_pods, context.sandbox)
|
24
|
+
|
25
|
+
Dir.mkdir File.dirname(report_path) unless File.exist? File.dirname(report_path)
|
26
|
+
File.write(report_path, licenses_report.to_json)
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Pod::HooksManager.register('cocoapods-gitlab_license_report', :post_install) do |context, user_options|
|
33
|
+
|
34
|
+
# Until CocoaPods provides a HashWithIndifferentAccess, normalize the hash keys here.
|
35
|
+
# See https://github.com/CocoaPods/CocoaPods/issues/3354
|
36
|
+
|
37
|
+
user_options.inject({}) do |normalized_hash, (key, value)|
|
38
|
+
normalized_hash[key.to_s] = value
|
39
|
+
normalized_hash
|
40
|
+
end
|
41
|
+
|
42
|
+
handler = PostInstallHookHandler.new(context, user_options)
|
43
|
+
handler.handle!
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'license_finder'
|
3
|
+
|
4
|
+
module CocoaPodsGitlabLicenseReport
|
5
|
+
class ReportGenerator
|
6
|
+
def initialize(sandbox)
|
7
|
+
@sandbox = sandbox
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate(specs, excluded)
|
11
|
+
|
12
|
+
dependencies = []
|
13
|
+
licenses = {}
|
14
|
+
|
15
|
+
specs.reject { |s| excluded.include? s.name }.each do |s|
|
16
|
+
license_name = s.license
|
17
|
+
license_name = license_name[:type] if license_name.is_a?(Hash)
|
18
|
+
license = LicenseFinder::License.find_by_name(license_name)
|
19
|
+
|
20
|
+
dependencies << { :name => s.name,
|
21
|
+
:version => s.version.to_s || "0.0",
|
22
|
+
:package_manager => "cocoapods",
|
23
|
+
:path => @sandbox.manifest_path,
|
24
|
+
:licenses => [license_name] }
|
25
|
+
|
26
|
+
licenses[license_name] = { :id => license_name,
|
27
|
+
:name => license_name,
|
28
|
+
:url => license.url || "" }
|
29
|
+
end
|
30
|
+
|
31
|
+
{
|
32
|
+
:version => "2.1",
|
33
|
+
:licenses => licenses.values.sort_by {|v| v[:id]},
|
34
|
+
:dependencies => dependencies
|
35
|
+
}
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-gitlab_license_report'
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":"2.1","licenses":[{"id":"Apache 2.0","name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.txt"},{"id":"MIT","name":"MIT","url":"http://opensource.org/licenses/mit-license"}],"dependencies":[{"name":"monkeylib","version":"1.0","package_manager":"cocoapods","path":"/Users/dune/Development/cocoapods-gitlab-license_scanning/tmp/Pods/Manifest.lock","licenses":["MIT"]},{"name":"BananaLib","version":"2.0","package_manager":"cocoapods","path":"/Users/dune/Development/cocoapods-gitlab-license_scanning/tmp/Pods/Manifest.lock","licenses":["Apache 2.0"]}]}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path('../spec_helper.rb', __FILE__)
|
2
|
+
require 'xcodeproj'
|
3
|
+
|
4
|
+
describe CocoaPodsGitlabLicenseReport do
|
5
|
+
|
6
|
+
UmbrellaTargetDescription = Pod::Installer::PostInstallHooksContext::UmbrellaTargetDescription
|
7
|
+
PostInstallHookHandler = CocoaPodsGitlabLicenseReport::PostInstallHookHandler
|
8
|
+
|
9
|
+
before do
|
10
|
+
@sandbox = temporary_sandbox
|
11
|
+
@spec1 = SpecHelper.spec1
|
12
|
+
@spec2 = SpecHelper.spec2
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe PostInstallHookHandler do
|
17
|
+
before do
|
18
|
+
@target_description = UmbrellaTargetDescription.new(@project, [@target], [@spec1, @spec2], :ios, '8.0', 'Pods-MyApp')
|
19
|
+
@hook_context = Pod::Installer::PostInstallHooksContext.new(@sandbox, @sandbox.root, nil, [@target_description])
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'Registers as cocoapods post_install hook' do
|
23
|
+
expect_any_instance_of(PostInstallHookHandler).to receive(:initialize).with(@hook_context, {})
|
24
|
+
expect_any_instance_of(PostInstallHookHandler).to receive(:handle!)
|
25
|
+
Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-gitlab_license_report' => {}})
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'Passes options from the plugin def' do
|
29
|
+
options = {:opt1 => "val1", :opt2 => "val2"}
|
30
|
+
expect_any_instance_of(PostInstallHookHandler).to receive(:initialize).with(@hook_context, options)
|
31
|
+
expect_any_instance_of(PostInstallHookHandler).to receive(:handle!)
|
32
|
+
Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-gitlab_license_report' => options})
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# it 'generates a settings plist when specified' do
|
37
|
+
# settings_bundle = SpecHelper.temporary_directory + 'Settings.bundle'
|
38
|
+
# settings_plist_path = settings_bundle + 'Pods-MyApp-settings-metadata.plist'
|
39
|
+
# FileUtils.mkdir(settings_bundle)
|
40
|
+
# resource_group = @project.main_group.new_group('Resources')
|
41
|
+
# resource_group.new_file(settings_bundle)
|
42
|
+
#
|
43
|
+
# CocoaPodsAcknowledgements.expects(:save_metadata).with(@plist_content, @plist_path, @project, @sandbox, @target.uuid).once
|
44
|
+
# CocoaPodsAcknowledgements.expects(:save_metadata).with(@settings_plist_content, settings_plist_path.to_s, @project, @sandbox, @target.uuid).once
|
45
|
+
# Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => { :settings_bundle => true }})
|
46
|
+
# FileUtils.rm_rf(settings_bundle)
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# it "generates acknowledgement plists to only specified targets" do
|
50
|
+
# CocoaPodsAcknowledgements.expects(:save_metadata).with(@plist_content, @plist_path, @project, @sandbox, @target.uuid).once
|
51
|
+
# Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => { targets: ['MyApp'] }})
|
52
|
+
#
|
53
|
+
# CocoaPodsAcknowledgements.expects(:save_metadata).never
|
54
|
+
# Pod::HooksManager.run(:post_install, @hook_context, { 'cocoapods-acknowledgements' => { targets: ['TheOtherTarget'] }})
|
55
|
+
# end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path('../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe ReportGenerator = CocoaPodsGitlabLicenseReport::ReportGenerator do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@spec1 = SpecHelper.spec1
|
7
|
+
@spec2 = SpecHelper.spec2
|
8
|
+
@sandbox = temporary_sandbox
|
9
|
+
allow(@sandbox).to receive(:manifest_path).and_return('/path/to/Podfile.lock')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'generates metadata' do
|
13
|
+
result = ReportGenerator.new(@sandbox).generate([@spec1, @spec2], [])
|
14
|
+
expect(result).to eq({
|
15
|
+
:version => "2.1",
|
16
|
+
:licenses => [{ :id => 'Apache 2.0', :name => 'Apache 2.0', :url => "http://www.apache.org/licenses/LICENSE-2.0.txt"},
|
17
|
+
{ :id => 'MIT', :name => 'MIT', :url => "http://opensource.org/licenses/mit-license"}],
|
18
|
+
:dependencies => [{
|
19
|
+
:name => "monkeylib",
|
20
|
+
:version => '1.0',
|
21
|
+
:package_manager => "cocoapods",
|
22
|
+
:path => "/path/to/Podfile.lock",
|
23
|
+
:licenses => ['MIT']
|
24
|
+
}, {
|
25
|
+
:name => "BananaLib",
|
26
|
+
:version => '2.0',
|
27
|
+
:package_manager => "cocoapods",
|
28
|
+
:path => "/path/to/Podfile.lock",
|
29
|
+
:licenses => ['Apache 2.0']
|
30
|
+
}]
|
31
|
+
})
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'generates empty if specs is empty' do
|
35
|
+
result = ReportGenerator.new(@sandbox).generate([], [])
|
36
|
+
expect(result).to eq({
|
37
|
+
:version => "2.1",
|
38
|
+
:licenses => [],
|
39
|
+
:dependencies => []
|
40
|
+
})
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'does not include metadata for excluded specs' do
|
44
|
+
result = ReportGenerator.new(@sandbox).generate([@spec1, @spec2], [@spec1.name])
|
45
|
+
expect(result).to eq({
|
46
|
+
:version => "2.1",
|
47
|
+
:licenses => [{ :id => 'Apache 2.0', :name => 'Apache 2.0', :url => "http://www.apache.org/licenses/LICENSE-2.0.txt"}],
|
48
|
+
:dependencies => [{
|
49
|
+
:name => "BananaLib",
|
50
|
+
:version => '2.0',
|
51
|
+
:package_manager => "cocoapods",
|
52
|
+
:path => "/path/to/Podfile.lock",
|
53
|
+
:licenses => ['Apache 2.0']
|
54
|
+
}]
|
55
|
+
})
|
56
|
+
end
|
57
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'cocoapods'
|
8
|
+
|
9
|
+
require 'cocoapods_plugin'
|
10
|
+
|
11
|
+
#-----------------------------------------------------------------------------#
|
12
|
+
|
13
|
+
module Pod
|
14
|
+
|
15
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
16
|
+
#
|
17
|
+
UI.disable_wrap = true
|
18
|
+
|
19
|
+
# Redirects the messages to an internal store.
|
20
|
+
#
|
21
|
+
module UI
|
22
|
+
@output = ''
|
23
|
+
@warnings = ''
|
24
|
+
|
25
|
+
class << self
|
26
|
+
attr_accessor :output
|
27
|
+
attr_accessor :warnings
|
28
|
+
|
29
|
+
def puts(message = '')
|
30
|
+
@output << "#{message}\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
def warn(message = '', actions = [])
|
34
|
+
@warnings << "#{message}\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
def print(message)
|
38
|
+
@output << message
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module SpecHelper
|
45
|
+
def self.temporary_directory
|
46
|
+
ROOT + 'tmp'
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.spec1
|
50
|
+
Pod::Specification.new do |s|
|
51
|
+
s.name = 'monkeylib'
|
52
|
+
s.version = '1.0'
|
53
|
+
s.authors = {
|
54
|
+
'CocoaPods' => 'email@cocoapods.org'
|
55
|
+
}
|
56
|
+
s.social_media_url = 'https://twitter.com/CocoaPods'
|
57
|
+
s.homepage = 'https://github.com/CocoaPods/monkeylib'
|
58
|
+
s.license = {
|
59
|
+
:type => 'MIT',
|
60
|
+
:file => 'LICENSE',
|
61
|
+
:text => 'Permission is hereby granted ...'
|
62
|
+
}
|
63
|
+
s.summary = 'A lib to do monkey things'
|
64
|
+
s.description = <<EOF
|
65
|
+
## What is it
|
66
|
+
A lib to do monkey things
|
67
|
+
## Why?
|
68
|
+
Why not?
|
69
|
+
EOF
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.spec2
|
74
|
+
Pod::Specification.new do |s|
|
75
|
+
s.name = 'BananaLib'
|
76
|
+
s.version = '2.0'
|
77
|
+
s.authors = 'Banana Corp', { 'Monkey Boy' => 'monkey@banana-corp.local' }
|
78
|
+
s.homepage = 'http://banana-corp.local/banana-lib.html'
|
79
|
+
s.summary = 'Chunky bananas!'
|
80
|
+
s.description = 'Full of chunky bananas.'
|
81
|
+
s.source = { :git => 'http://banana-corp.local/banana-lib.git', :tag => 'v1.0' }
|
82
|
+
s.license = 'Apache 2.0'
|
83
|
+
s.source_files = 'Classes/*.{h,m,d}', 'Vendor', 'framework/Source/*.h'
|
84
|
+
s.resources = "Resources/*", "Resources/Images.xcassets"
|
85
|
+
s.vendored_framework = 'BananaFramework.framework'
|
86
|
+
s.vendored_library = 'libBananaStaticLib.a'
|
87
|
+
s.preserve_paths = 'preserve_me.txt'
|
88
|
+
s.public_header_files = 'Classes/Banana.h', 'framework/Source/MoreBanana.h'
|
89
|
+
s.module_map = 'Banana.modulemap'
|
90
|
+
|
91
|
+
s.prefix_header_file = 'Classes/BananaLib.pch'
|
92
|
+
s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-framework SystemConfiguration' }
|
93
|
+
s.dependency 'monkey', '~> 1.0.1', '< 1.0.9'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def temporary_sandbox
|
99
|
+
Pod::Sandbox.new(SpecHelper.temporary_directory + 'Pods')
|
100
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-gitlab_license_report
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabio Gallonetto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: license_finder
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- ".gitignore"
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- LICENSE
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- cocoapods-gitlab_license_report.gemspec
|
96
|
+
- lib/cocoapods-gitlab_license_report.rb
|
97
|
+
- lib/cocoapods-gitlab_license_report/report_generator.rb
|
98
|
+
- lib/cocoapods-gitlab_license_report/version.rb
|
99
|
+
- lib/cocoapods_plugin.rb
|
100
|
+
- reports/licenses.json
|
101
|
+
- spec/license_report_spec.rb
|
102
|
+
- spec/report_generator_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
homepage:
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubygems_version: 3.0.3
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: CocoaPods plugin that generates an license report for gitlab license scanner
|
127
|
+
test_files:
|
128
|
+
- spec/license_report_spec.rb
|
129
|
+
- spec/report_generator_spec.rb
|
130
|
+
- spec/spec_helper.rb
|