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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deriving_license (0.1.1)
4
+ deriving_license (0.1.2)
5
5
  gemnasium-parser
6
6
 
7
7
  GEM
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'deriving_license'
3
- s.version = '0.1.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"]
@@ -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
- remote = /#{d.name}/.match( `gem list #{d.name}` ) ? "" : "-r "
25
-
26
- print "Determining license for #{d.name}#{remote.empty? ? "" : " (remote call required)"}..."; STDOUT.flush
27
- spec = eval `gem specification #{remote}#{d.name} --ruby`
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deriving_license
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: