deriving_license 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/deriving_license.gemspec +1 -1
- data/lib/deriving_license.rb +7 -5
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/deriving_license.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'deriving_license'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.2'
|
4
4
|
s.summary = "Deriving Licence finds the license agreements for all gems in your Gemfile"
|
5
5
|
s.description = "Deriving Licence finds the license agreements for all gems in your Gemfile if included in your project, or in a Gemfile passed to the included binary"
|
6
6
|
s.authors = ["Tom Allen"]
|
data/lib/deriving_license.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "gemnasium/parser"
|
2
|
+
require "bundler"
|
2
3
|
|
3
4
|
class DerivingLicense
|
4
5
|
def self.run(path=nil)
|
@@ -21,12 +22,13 @@ class DerivingLicense
|
|
21
22
|
licenses = Hash.new(0)
|
22
23
|
gemfile.dependencies.each do |d|
|
23
24
|
# See if it's installed locally, and if not add -r to call
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
Bundler.with_clean_env do # This gets out of the bundler context.
|
26
|
+
remote = /#{d.name}/.match( `BUNDLE_GEMFILE=#{path}; gem list #{d.name}` ) ? "" : "-r "
|
27
|
+
print "Determining license for #{d.name}#{remote.empty? ? "" : " (remote call required)"}..."; STDOUT.flush
|
28
|
+
@spec = eval `gem specification #{remote}#{d.name} --ruby`
|
29
|
+
end
|
28
30
|
print "DONE\n"; STDOUT.flush
|
29
|
-
spec.licenses.each{ |l| licenses[l]+=1 }
|
31
|
+
@spec.licenses.each{ |l| licenses[l]+=1 }
|
30
32
|
end
|
31
33
|
licenses
|
32
34
|
end
|