organization_license_audit 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/organization-license-audit +1 -0
- data/lib/organization_license_audit/version.rb +1 -1
- data/lib/organization_license_audit.rb +22 -9
- data.tar.gz.sig +2 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad3ee51ea481dc2f0edd109e9ef064c68fe35c2
|
4
|
+
data.tar.gz: db9c9733ff2e99f535f52e87121d8b7c441dba5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d46391b9cbafe88db3a50dc40ace5a3663368743f778b08d4a8385e498a74dad93501c93d8d4067d0e006e59384059c02732945ad77b3d639d9021d11645c2f7
|
7
|
+
data.tar.gz: 7cb299769d973b388d9ba7645fd016ac51451c5e08dabe241f0d23fcf16a1c4573202e84527778a031cd582d6642367260d0c9bc7b047108d0506716d69cc433
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -31,6 +31,7 @@ BANNER
|
|
31
31
|
options[:csv] = separator
|
32
32
|
end
|
33
33
|
parser.on("--ignore-gems", "Ignore repos that have a %{repo}.gemspec") { options[:ignore_gems] = true }
|
34
|
+
parser.on("--without TYPES", String, "Do not run for bundler/npm dependencies (comma separated)") { |without| options[:without] = without.split(",") }
|
34
35
|
parser.on("-w", "--whitelist=LICENSES", String, "Comma separated list of licenses") { |whitelist| options[:whitelist] = whitelist.split(",") }
|
35
36
|
parser.on("-h", "--help", "Show this.") { puts parser; exit }
|
36
37
|
parser.on("-v", "--version", "Show Version"){ puts OrganizationLicenseAudit::VERSION; exit}
|
@@ -6,6 +6,8 @@ module OrganizationLicenseAudit
|
|
6
6
|
BUNDLE_PATH = "vendor/bundle"
|
7
7
|
RESULT_LINE = /(^[a-z_\d-]+), ([^,]+), (.+)/
|
8
8
|
APPROVAL_HEADING = "Dependencies that need approval"
|
9
|
+
NPM_PACKAGE_FILE = "package.json"
|
10
|
+
BUNDLER_PACKAGE_FILE = "Gemfile"
|
9
11
|
|
10
12
|
class << self
|
11
13
|
def run(options)
|
@@ -92,7 +94,7 @@ module OrganizationLicenseAudit
|
|
92
94
|
in_temp_dir do
|
93
95
|
raise "Clone failed" unless sh("git clone #{repo.clone_url} --depth 1 --quiet").first
|
94
96
|
Dir.chdir repo.name do
|
95
|
-
|
97
|
+
audit_project(bundle_cache_dir, options)
|
96
98
|
end
|
97
99
|
end
|
98
100
|
rescue Exception => e
|
@@ -102,11 +104,13 @@ module OrganizationLicenseAudit
|
|
102
104
|
end
|
103
105
|
|
104
106
|
def audit_project(bundle_cache_dir, options)
|
105
|
-
|
106
|
-
|
107
|
-
|
107
|
+
with_clean_env do
|
108
|
+
bundled = prepare_bundler bundle_cache_dir, options
|
109
|
+
prepare_npm options
|
110
|
+
whitelist_licences options[:whitelist]
|
108
111
|
|
109
|
-
|
112
|
+
sh "#{combined_gem_path if bundled}license_finder --quiet"
|
113
|
+
end
|
110
114
|
end
|
111
115
|
|
112
116
|
def whitelist_licences(licenses)
|
@@ -117,16 +121,16 @@ module OrganizationLicenseAudit
|
|
117
121
|
end
|
118
122
|
end
|
119
123
|
|
120
|
-
def prepare_bundler(bundle_cache_dir)
|
121
|
-
|
124
|
+
def prepare_bundler(bundle_cache_dir, options)
|
125
|
+
with_or_without "bundler", BUNDLER_PACKAGE_FILE, options do
|
122
126
|
use_cache_dir_to_bundle(bundle_cache_dir)
|
123
127
|
raise "Failed to bundle" unless sh("bundle --path #{BUNDLE_PATH} --quiet").first
|
124
128
|
true
|
125
129
|
end
|
126
130
|
end
|
127
131
|
|
128
|
-
def prepare_npm
|
129
|
-
|
132
|
+
def prepare_npm(options)
|
133
|
+
with_or_without "npm", NPM_PACKAGE_FILE, options do
|
130
134
|
sh "npm install --quiet"
|
131
135
|
end
|
132
136
|
end
|
@@ -177,5 +181,14 @@ module OrganizationLicenseAudit
|
|
177
181
|
end
|
178
182
|
[$?.success?, output]
|
179
183
|
end
|
184
|
+
|
185
|
+
def with_or_without(thing, file, options)
|
186
|
+
return unless File.exist?(file)
|
187
|
+
if (options[:without] || []).include?(thing)
|
188
|
+
File.unlink(file)
|
189
|
+
else
|
190
|
+
yield
|
191
|
+
end
|
192
|
+
end
|
180
193
|
end
|
181
194
|
end
|
data.tar.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
�Z����z���~I�y��� o����)��/]�m����BӣdX��u����}��Ir\O�ݏm���LO�D�Q'����ZWӍ�ck��L+����Ե�8�,�.�]f,Y�gL���c���m�b�=�̷3�zk&p���*Ɏ��,Hk�a§�DZ��N��o���]�08U�i�e�'��b�
|
2
|
+
�o��d}�Zx�7�u�Q�X����.�4K[
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|