jar-dependencies 0.3.9 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Mavenfile +29 -33
- data/Rakefile +13 -13
- data/Readme.md +79 -79
- data/bin/lock_jars +17 -17
- data/jar-dependencies.gemspec +13 -15
- data/lib/jar_dependencies.rb +107 -98
- data/lib/jars/attach_jars_pom.rb +8 -8
- data/lib/jars/classpath.rb +31 -33
- data/lib/jars/gemspec_artifacts.rb +30 -38
- data/lib/jars/gemspec_pom.rb +2 -2
- data/lib/jars/installer.rb +87 -91
- data/lib/jars/lock.rb +16 -18
- data/lib/jars/lock_down.rb +38 -39
- data/lib/jars/lock_down_pom.rb +14 -11
- data/lib/jars/maven_exec.rb +32 -32
- data/lib/jars/maven_factory.rb +49 -56
- data/lib/jars/maven_settings.rb +16 -24
- data/lib/jars/output_jars_pom.rb +2 -2
- data/lib/jars/post_install_hook.rb +2 -2
- data/lib/jars/setup.rb +1 -1
- data/lib/jars/version.rb +1 -1
- metadata +19 -10
data/lib/jars/lock.rb
CHANGED
@@ -2,59 +2,57 @@ require 'jars/maven_exec'
|
|
2
2
|
|
3
3
|
module Jars
|
4
4
|
class JarDetails < Array
|
5
|
-
|
6
5
|
def scope
|
7
|
-
self[
|
6
|
+
self[-2].to_sym
|
8
7
|
end
|
9
8
|
|
10
9
|
def file
|
11
|
-
file = self[
|
10
|
+
file = self[-1].strip
|
12
11
|
file.empty? ? path : file
|
13
12
|
end
|
14
13
|
|
15
14
|
def group_id
|
16
|
-
self[
|
15
|
+
self[0]
|
17
16
|
end
|
18
17
|
|
19
18
|
def artifact_id
|
20
|
-
self[
|
19
|
+
self[1]
|
21
20
|
end
|
22
21
|
|
23
22
|
def version
|
24
|
-
self[
|
23
|
+
self[-3]
|
25
24
|
end
|
26
25
|
|
27
26
|
def classifier
|
28
|
-
size == 5 ? nil : self[
|
27
|
+
size == 5 ? nil : self[2]
|
29
28
|
end
|
30
29
|
|
31
30
|
def gacv
|
32
|
-
classifier ? self[
|
31
|
+
classifier ? self[0..3] : self[0..2]
|
33
32
|
end
|
34
33
|
|
35
34
|
def path
|
36
35
|
if scope == :system
|
37
36
|
# replace maven like system properties embedded into the string
|
38
|
-
self[
|
39
|
-
ENV_JAVA[
|
37
|
+
self[-1].gsub(/\$\{[a-zA-Z.]+\}/) do |a|
|
38
|
+
ENV_JAVA[a[2..-2]] || a
|
40
39
|
end
|
41
40
|
else
|
42
|
-
File.join(
|
41
|
+
File.join(Jars.home, group_id.gsub(/[.]/, '/'), artifact_id, version, gacv[1..-1].join('-') + '.jar')
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
47
46
|
class Lock
|
48
|
-
|
49
|
-
def initialize( file )
|
47
|
+
def initialize(file)
|
50
48
|
@file = file
|
51
49
|
end
|
52
50
|
|
53
|
-
def process(
|
51
|
+
def process(scope)
|
54
52
|
scope ||= :runtime
|
55
|
-
File.read(
|
56
|
-
next if
|
57
|
-
jar = JarDetails.new(
|
53
|
+
File.read(@file).each_line do |line|
|
54
|
+
next if line !~ /:.+:/
|
55
|
+
jar = JarDetails.new(line.strip.sub(/:jar:/, ':').sub(/:$/, ': ').split(/:/))
|
58
56
|
case scope
|
59
57
|
when :all
|
60
58
|
yield jar
|
@@ -66,7 +64,7 @@ module Jars
|
|
66
64
|
yield jar if jar.scope == :provided
|
67
65
|
when :runtime
|
68
66
|
# jar.scope is maven scope
|
69
|
-
yield jar if jar.scope != :test
|
67
|
+
yield jar if (jar.scope != :test) && (jar.scope != :provided)
|
70
68
|
when :test
|
71
69
|
yield jar
|
72
70
|
end
|
data/lib/jars/lock_down.rb
CHANGED
@@ -6,24 +6,23 @@ require 'jars/gemspec_artifacts'
|
|
6
6
|
|
7
7
|
module Jars
|
8
8
|
class LockDown
|
9
|
-
|
10
9
|
attr_reader :debug, :verbose
|
11
10
|
|
12
|
-
def initialize(
|
11
|
+
def initialize(debug, verbose)
|
13
12
|
@debug = debug
|
14
13
|
@verbose = verbose
|
15
14
|
end
|
16
15
|
|
17
16
|
def maven_new
|
18
|
-
factory = MavenFactory.new(
|
19
|
-
pom = File.expand_path(
|
20
|
-
m = factory.maven_new(
|
21
|
-
m[
|
22
|
-
m[
|
23
|
-
m[
|
24
|
-
jarfile = File.expand_path(
|
25
|
-
m[
|
26
|
-
attach_jar_coordinates_from_bundler_dependencies(
|
17
|
+
factory = MavenFactory.new({}, @debug, @verbose)
|
18
|
+
pom = File.expand_path('../lock_down_pom.rb', __FILE__)
|
19
|
+
m = factory.maven_new(pom)
|
20
|
+
m['jruby.plugins.version'] = Jars::JRUBY_PLUGINS_VERSION
|
21
|
+
m['dependency.plugin.version'] = Jars::DEPENDENCY_PLUGIN_VERSION
|
22
|
+
m['jars.basedir'] = File.expand_path(basedir)
|
23
|
+
jarfile = File.expand_path(Jars.jarfile)
|
24
|
+
m['jars.jarfile'] = jarfile if File.exist?(jarfile)
|
25
|
+
attach_jar_coordinates_from_bundler_dependencies(m)
|
27
26
|
m
|
28
27
|
end
|
29
28
|
private :maven_new
|
@@ -33,28 +32,28 @@ module Jars
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def basedir
|
36
|
-
File.expand_path(
|
35
|
+
File.expand_path('.')
|
37
36
|
end
|
38
37
|
|
39
|
-
def attach_jar_coordinates_from_bundler_dependencies(
|
38
|
+
def attach_jar_coordinates_from_bundler_dependencies(maven)
|
40
39
|
load_path = $LOAD_PATH.dup
|
41
40
|
require 'bundler'
|
42
|
-
#TODO make this group a commandline option
|
43
|
-
Bundler.setup(
|
44
|
-
maven.property(
|
41
|
+
# TODO: make this group a commandline option
|
42
|
+
Bundler.setup('default')
|
43
|
+
maven.property('jars.bundler', true)
|
45
44
|
done = []
|
46
45
|
index = 0
|
47
|
-
cwd = File.expand_path(
|
48
|
-
Gem.loaded_specs.each do |
|
46
|
+
cwd = File.expand_path('.')
|
47
|
+
Gem.loaded_specs.each do |_name, spec|
|
49
48
|
# if gemspec is local then include all dependencies
|
50
|
-
maven.attach_jars(
|
49
|
+
maven.attach_jars(spec, cwd == spec.full_gem_path)
|
51
50
|
end
|
52
51
|
rescue Exception => e
|
53
52
|
case e.class.to_s
|
54
53
|
when 'LoadError'
|
55
54
|
if Jars.verbose?
|
56
55
|
warn e.message
|
57
|
-
warn
|
56
|
+
warn 'no bundler found - ignore Gemfile if exists'
|
58
57
|
end
|
59
58
|
when 'Bundler::GemfileNotFound'
|
60
59
|
# do nothing then as we have bundler but no Gemfile
|
@@ -66,41 +65,41 @@ module Jars
|
|
66
65
|
raise e
|
67
66
|
end
|
68
67
|
ensure
|
69
|
-
$LOAD_PATH.replace(
|
68
|
+
$LOAD_PATH.replace(load_path)
|
70
69
|
end
|
71
70
|
|
72
|
-
def lock_down(
|
73
|
-
vendor_dir = File.expand_path(
|
74
|
-
out = File.expand_path(
|
75
|
-
tree = File.expand_path(
|
76
|
-
maven.property(
|
77
|
-
maven.property(
|
78
|
-
maven.property(
|
79
|
-
maven.property(
|
80
|
-
maven.property(
|
81
|
-
maven.property(
|
71
|
+
def lock_down(options = {})
|
72
|
+
vendor_dir = File.expand_path(options[:vendor_dir]) if options[:vendor_dir]
|
73
|
+
out = File.expand_path('.jars.output')
|
74
|
+
tree = File.expand_path('.jars.tree')
|
75
|
+
maven.property('jars.outputFile', out)
|
76
|
+
maven.property('maven.repo.local', Jars.local_maven_repo)
|
77
|
+
maven.property('jars.home', vendor_dir) if vendor_dir
|
78
|
+
maven.property('jars.lock', File.expand_path(Jars.lock))
|
79
|
+
maven.property('jars.force', options[:force] == true)
|
80
|
+
maven.property('jars.update', options[:update]) if options[:update]
|
82
81
|
# tell not to use Jars.lock as part of POM when running mvn
|
83
|
-
maven.property(
|
82
|
+
maven.property('jars.skip.lock', true)
|
84
83
|
|
85
|
-
args = [
|
86
|
-
if options[
|
87
|
-
args += [
|
84
|
+
args = ['gem:jars-lock']
|
85
|
+
if options[:tree]
|
86
|
+
args += ['dependency:tree', '-P -gemfile.lock', '-DoutputFile=' + tree]
|
88
87
|
end
|
89
88
|
|
90
89
|
puts
|
91
90
|
puts '-- jar root dependencies --'
|
92
91
|
puts
|
93
|
-
status = maven.exec(
|
92
|
+
status = maven.exec(*args)
|
94
93
|
exit 1 unless status
|
95
|
-
if File.
|
94
|
+
if File.exist?(tree)
|
96
95
|
puts
|
97
96
|
puts '-- jar dependency tree --'
|
98
97
|
puts
|
99
|
-
puts File.read(
|
98
|
+
puts File.read(tree)
|
100
99
|
puts
|
101
100
|
end
|
102
101
|
puts
|
103
|
-
puts File.read(
|
102
|
+
puts File.read(out).gsub(/#{File.dirname(out)}\//, '')
|
104
103
|
puts
|
105
104
|
ensure
|
106
105
|
FileUtils.rm_f out
|
data/lib/jars/lock_down_pom.rb
CHANGED
@@ -1,27 +1,30 @@
|
|
1
1
|
# this file is maven DSL and used by maven via jars/lock_down.rb
|
2
2
|
|
3
|
-
basedir(
|
3
|
+
basedir(ENV_JAVA['jars.basedir'])
|
4
4
|
|
5
|
-
eval(
|
5
|
+
eval(File.read(File.join(File.dirname(__FILE__), 'attach_jars_pom.rb')))
|
6
6
|
|
7
|
-
jfile = ENV_JAVA[
|
8
|
-
jarfile(
|
7
|
+
jfile = ENV_JAVA['jars.jarfile']
|
8
|
+
jarfile(jfile) if jfile
|
9
9
|
|
10
10
|
# need to fix the version of this plugin for gem:jars_lock goal
|
11
|
-
jruby_plugin :gem, ENV_JAVA[
|
12
|
-
|
11
|
+
jruby_plugin :gem, ENV_JAVA['jruby.plugins.version']
|
13
12
|
|
14
13
|
# if you use bundler we collect all root jar dependencies
|
15
14
|
# from each gemspec file. otherwise we need to resolve
|
16
15
|
# the gemspec artifact in the maven way
|
17
|
-
unless ENV_JAVA[
|
16
|
+
unless ENV_JAVA['jars.bundler']
|
18
17
|
|
19
|
-
|
18
|
+
begin
|
19
|
+
gemspec
|
20
|
+
rescue
|
21
|
+
nil
|
22
|
+
end
|
20
23
|
|
21
24
|
end
|
22
25
|
|
23
|
-
properties(
|
26
|
+
properties('project.build.sourceEncoding' => 'utf-8')
|
24
27
|
|
25
|
-
plugin :dependency, ENV_JAVA[
|
28
|
+
plugin :dependency, ENV_JAVA['dependency.plugin.version']
|
26
29
|
|
27
|
-
eval(
|
30
|
+
eval(File.read(File.join(File.dirname(__FILE__), 'output_jars_pom.rb')))
|
data/lib/jars/maven_exec.rb
CHANGED
@@ -3,9 +3,8 @@ require 'jars/maven_factory'
|
|
3
3
|
|
4
4
|
module Jars
|
5
5
|
class MavenExec
|
6
|
-
|
7
|
-
|
8
|
-
specs = Dir[ '*.gemspec' ]
|
6
|
+
def find_spec(allow_no_file)
|
7
|
+
specs = Dir['*.gemspec']
|
9
8
|
case specs.size
|
10
9
|
when 0
|
11
10
|
raise 'no gemspec found' unless allow_no_file
|
@@ -19,64 +18,65 @@ module Jars
|
|
19
18
|
|
20
19
|
attr_reader :basedir, :spec, :specfile
|
21
20
|
|
22
|
-
def initialize(
|
21
|
+
def initialize(spec = nil)
|
23
22
|
@options = {}
|
24
|
-
setup(
|
23
|
+
setup(spec)
|
25
24
|
rescue StandardError, LoadError => e
|
26
25
|
# If spec load fails, skip looking for jar-dependencies
|
27
|
-
warn
|
28
|
-
warn e.backtrace.join(
|
26
|
+
warn 'jar-dependencies: ' + e.to_s
|
27
|
+
warn e.backtrace.join("\n") if Jars.verbose?
|
29
28
|
end
|
30
29
|
|
31
|
-
def setup(
|
32
|
-
spec ||= find_spec(
|
30
|
+
def setup(spec = nil, allow_no_file = false)
|
31
|
+
spec ||= find_spec(allow_no_file)
|
33
32
|
|
34
33
|
case spec
|
35
34
|
when String
|
36
|
-
@specfile = File.expand_path(
|
37
|
-
@basedir = File.dirname(
|
38
|
-
Dir.chdir(
|
39
|
-
spec = eval(
|
35
|
+
@specfile = File.expand_path(spec)
|
36
|
+
@basedir = File.dirname(@specfile)
|
37
|
+
Dir.chdir(@basedir) do
|
38
|
+
spec = eval(File.read(@specfile), TOPLEVEL_BINDING, @specfile)
|
40
39
|
end
|
41
40
|
when Gem::Specification
|
42
|
-
if File.
|
41
|
+
if File.exist?(spec.loaded_from)
|
43
42
|
@basedir = spec.gem_dir
|
44
|
-
@specfile = spec.
|
43
|
+
@specfile = spec.loaded_from
|
45
44
|
else
|
46
45
|
# this happens with bundle and local gems
|
47
46
|
# there the spec_file is "not installed" but inside
|
48
47
|
# the gem_dir directory
|
49
|
-
Dir.chdir(
|
50
|
-
setup(
|
48
|
+
Dir.chdir(spec.gem_dir) do
|
49
|
+
setup(nil, true)
|
51
50
|
end
|
52
51
|
end
|
53
52
|
when NilClass
|
54
53
|
else
|
55
|
-
|
54
|
+
Jars.debug('spec must be either String or Gem::Specification. ' +
|
55
|
+
'File an issue on github if you need it.')
|
56
56
|
end
|
57
57
|
@spec = spec
|
58
58
|
end
|
59
59
|
|
60
|
-
def ruby_maven_install_options=(
|
60
|
+
def ruby_maven_install_options=(options)
|
61
61
|
@options = options
|
62
62
|
end
|
63
63
|
|
64
|
-
def resolve_dependencies_list(
|
65
|
-
factory = MavenFactory.new(
|
66
|
-
maven = factory.maven_new(
|
64
|
+
def resolve_dependencies_list(file)
|
65
|
+
factory = MavenFactory.new(@options)
|
66
|
+
maven = factory.maven_new(File.expand_path('../gemspec_pom.rb', __FILE__))
|
67
67
|
|
68
|
-
is_local_file = File.expand_path(
|
69
|
-
maven.attach_jars(
|
68
|
+
is_local_file = File.expand_path(File.dirname(@specfile)) == File.expand_path(Dir.pwd)
|
69
|
+
maven.attach_jars(@spec, is_local_file)
|
70
70
|
|
71
|
-
maven[
|
72
|
-
maven[
|
73
|
-
maven[
|
74
|
-
maven[
|
75
|
-
maven[
|
76
|
-
maven[
|
77
|
-
maven[
|
71
|
+
maven['jars.specfile'] = @specfile.to_s
|
72
|
+
maven['outputAbsoluteArtifactFilename'] = 'true'
|
73
|
+
maven['includeTypes'] = 'jar'
|
74
|
+
maven['outputScope'] = 'true'
|
75
|
+
maven['useRepositoryLayout'] = 'true'
|
76
|
+
maven['outputDirectory'] = Jars.home.to_s
|
77
|
+
maven['outputFile'] = file.to_s
|
78
78
|
|
79
|
-
maven.exec(
|
79
|
+
maven.exec('dependency:copy-dependencies', 'dependency:list')
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
data/lib/jars/maven_factory.rb
CHANGED
@@ -3,78 +3,71 @@ require 'jars/gemspec_artifacts'
|
|
3
3
|
|
4
4
|
module Jars
|
5
5
|
class MavenFactory
|
6
|
-
|
7
6
|
module AttachJars
|
8
|
-
|
9
|
-
def attach_jars( spec, all_dependencies = false )
|
7
|
+
def attach_jars(spec, all_dependencies = false)
|
10
8
|
@index ||= 0
|
11
9
|
@done ||= []
|
12
10
|
|
13
|
-
deps = GemspecArtifacts.new(
|
11
|
+
deps = GemspecArtifacts.new(spec)
|
14
12
|
deps.artifacts.each do |a|
|
15
13
|
# for this gemspec we want to include all artifacts but
|
16
14
|
# for all others we want to exclude provided and test artifacts
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
15
|
+
next unless !@done.include?(a.key) && (all_dependencies || ((a.scope != 'provided') && (a.scope != 'test')))
|
16
|
+
|
17
|
+
# ruby dsl is not working reliably for classifier
|
18
|
+
self["jars.#{@index}"] = a.to_coord_no_classifier
|
19
|
+
if a.exclusions
|
20
|
+
jndex = 0
|
21
|
+
a.exclusions.each do |ex|
|
22
|
+
self["jars.#{@index}.exclusions.#{jndex}"] = ex.to_s
|
23
|
+
jndex += 1
|
27
24
|
end
|
28
|
-
self[ "jars.#{@index}.scope" ] = a.scope if a.scope
|
29
|
-
if a.classifier
|
30
|
-
self[ "jars.#{@index}.classifier" ] = a.classifier
|
31
|
-
end
|
32
|
-
@index += 1
|
33
|
-
@done << a.key
|
34
25
|
end
|
26
|
+
self["jars.#{@index}.scope"] = a.scope if a.scope
|
27
|
+
self["jars.#{@index}.classifier"] = a.classifier if a.classifier
|
28
|
+
@index += 1
|
29
|
+
@done << a.key
|
35
30
|
end
|
36
31
|
end
|
37
32
|
end
|
38
33
|
|
39
34
|
attr_reader :debug, :verbose
|
40
35
|
|
41
|
-
def initialize(
|
36
|
+
def initialize(options = nil, debug = Jars.debug?, verbose = Jars.verbose?)
|
42
37
|
@options = (options || {}).dup
|
43
|
-
@options.delete(
|
38
|
+
@options.delete(:ignore_dependencies)
|
44
39
|
@debug = debug
|
45
40
|
@verbose = verbose
|
46
41
|
@installed_maven = false
|
47
42
|
end
|
48
43
|
|
49
|
-
def maven_new(
|
44
|
+
def maven_new(pom)
|
50
45
|
lazy_load_maven
|
51
|
-
maven = setup(
|
46
|
+
maven = setup(Maven::Ruby::Maven.new)
|
52
47
|
|
53
48
|
maven.extend AttachJars
|
54
|
-
# TODO copy pom to tmp dir in case it is not a real file
|
55
|
-
maven.options[
|
49
|
+
# TODO: copy pom to tmp dir in case it is not a real file
|
50
|
+
maven.options['-f'] = pom
|
56
51
|
maven
|
57
52
|
end
|
58
53
|
|
59
54
|
private
|
60
55
|
|
61
|
-
def setup(
|
56
|
+
def setup(maven)
|
62
57
|
maven.verbose = @verbose
|
63
|
-
if @debug
|
64
|
-
maven.options[ '-X' ] = nil
|
65
|
-
end
|
58
|
+
maven.options['-X'] = nil if @debug
|
66
59
|
if @verbose
|
67
|
-
maven.options[
|
68
|
-
elsif
|
69
|
-
maven.options[
|
60
|
+
maven.options['-e'] = nil
|
61
|
+
elsif !@debug
|
62
|
+
maven.options['--quiet'] = nil
|
70
63
|
end
|
71
|
-
maven[
|
64
|
+
maven['verbose'] = (@debug || @verbose) == true
|
72
65
|
|
73
66
|
if Jars.maven_settings
|
74
|
-
maven.options[
|
67
|
+
maven.options['-s'] = Jars::MavenSettings.effective_settings
|
75
68
|
end
|
76
69
|
|
77
|
-
maven[
|
70
|
+
maven['maven.repo.local'] = java.io.File.new(Jars.local_maven_repo).absolute_path.to_s
|
78
71
|
|
79
72
|
maven
|
80
73
|
end
|
@@ -82,8 +75,8 @@ module Jars
|
|
82
75
|
private
|
83
76
|
|
84
77
|
def lazy_load_maven
|
85
|
-
add_gem_to_load_path(
|
86
|
-
add_gem_to_load_path(
|
78
|
+
add_gem_to_load_path('ruby-maven')
|
79
|
+
add_gem_to_load_path('ruby-maven-libs')
|
87
80
|
if @installed_maven
|
88
81
|
puts
|
89
82
|
puts 'using maven for the first time results in maven'
|
@@ -95,44 +88,44 @@ module Jars
|
|
95
88
|
require 'maven/ruby/maven'
|
96
89
|
end
|
97
90
|
|
98
|
-
def find_spec_via_rubygems(
|
91
|
+
def find_spec_via_rubygems(name, req)
|
99
92
|
require 'rubygems/dependency'
|
100
|
-
dep = Gem::Dependency.new(
|
101
|
-
dep.matching_specs(
|
93
|
+
dep = Gem::Dependency.new(name, req)
|
94
|
+
dep.matching_specs(true).last
|
102
95
|
end
|
103
96
|
|
104
|
-
def add_gem_to_load_path(
|
97
|
+
def add_gem_to_load_path(name)
|
105
98
|
# if the gem is already activated => good
|
106
|
-
return if Gem.loaded_specs[
|
99
|
+
return if Gem.loaded_specs[name]
|
107
100
|
# just install gem if needed and add it to the load_path
|
108
101
|
# and leave activated gems as they are
|
109
|
-
req = requirement(
|
110
|
-
unless spec = find_spec_via_rubygems(
|
111
|
-
spec = install_gem(
|
102
|
+
req = requirement(name)
|
103
|
+
unless spec = find_spec_via_rubygems(name, req)
|
104
|
+
spec = install_gem(name, req)
|
112
105
|
end
|
113
106
|
unless spec
|
114
107
|
raise "failed to resolve gem '#{name}' if you're using Bundler add it as a dependency"
|
115
108
|
end
|
116
|
-
path = File.join(
|
117
|
-
$LOAD_PATH << path unless $LOAD_PATH.include?(
|
109
|
+
path = File.join(spec.full_gem_path, spec.require_path)
|
110
|
+
$LOAD_PATH << path unless $LOAD_PATH.include?(path)
|
118
111
|
end
|
119
112
|
|
120
|
-
def requirement(
|
121
|
-
jars = Gem.loaded_specs[
|
113
|
+
def requirement(name)
|
114
|
+
jars = Gem.loaded_specs['jar-dependencies']
|
122
115
|
dep = jars.nil? ? nil : jars.dependencies.detect { |d| d.name == name }
|
123
|
-
dep.nil? ? Gem::Requirement.create(
|
116
|
+
dep.nil? ? Gem::Requirement.create('>0') : dep.requirement
|
124
117
|
end
|
125
118
|
|
126
|
-
def install_gem(
|
119
|
+
def install_gem(name, req)
|
127
120
|
@installed_maven = true
|
128
121
|
puts "Installing gem '#{name}' . . ."
|
129
122
|
require 'rubygems/dependency_installer'
|
130
|
-
inst = Gem::DependencyInstaller.new(
|
131
|
-
inst.install(
|
123
|
+
inst = Gem::DependencyInstaller.new(@options ||= {})
|
124
|
+
inst.install(name, req).first
|
132
125
|
rescue => e
|
133
126
|
if Jars.verbose?
|
134
|
-
warn
|
135
|
-
warn e.backtrace.join(
|
127
|
+
warn e.inspect.to_s
|
128
|
+
warn e.backtrace.join("\n")
|
136
129
|
end
|
137
130
|
raise "there was an error installing '#{name} (#{req})' #{@options[:domain]}. please install it manually: #{e.inspect}"
|
138
131
|
end
|