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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6376a3b06af0b760663b6b6f4d9dda4f920a6eb3
4
- data.tar.gz: 205d9543e0f636ef1992dfdc68b10d8596b2d347
3
+ metadata.gz: 9ad3ee51ea481dc2f0edd109e9ef064c68fe35c2
4
+ data.tar.gz: db9c9733ff2e99f535f52e87121d8b7c441dba5b
5
5
  SHA512:
6
- metadata.gz: a5ea40e035be68c4c306376628768ffcf0417396ab4e30349253958713120f8b364f9c0eac72f2a84090988722df8355da7b385d0bca8f8125833da40ab8d7bd
7
- data.tar.gz: 270c40199f52268faa665637bab3f08e16a54bb4f73eb8d469a507726fad20b087df626ffdc12d548429c8a0e7503ddbc81c246646bcefacc56cc598babdbd88
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}
@@ -1,3 +1,3 @@
1
1
  module OrganizationLicenseAudit
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -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
- with_clean_env { audit_project(bundle_cache_dir, options) }
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
- bundled = prepare_bundler bundle_cache_dir
106
- prepare_npm
107
- whitelist_licences options[:whitelist]
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
- sh("#{combined_gem_path if bundled}license_finder --quiet")
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
- if File.exist?("Gemfile")
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
- if File.exist?("package.json")
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
- ��5Y~����ֺ!�� ]-�f,0 [xf�����E�_��4ĝ�^��^/(1p&Z�^[����O����0K1���=�kYU���o���ʤ$���țlT��Y�|�₻�Y����p��@Ld��>���x�$̲4�,\��^[������a���c��s �3��� �����$h��(��~�w�`�4J6jBZ�Ѿ���#�� 2���W���p�/���U��[.���ΕE0�
1
+ �Z����z���~I�y��� o����)��/]�m����BӣdX��u����}��Ir\O�ݏm���LO�DQ'����ZWӍ�ck��L+����Ե�8�,�.�]f,YgL���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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: organization_license_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
metadata.gz.sig CHANGED
Binary file