jar-dependencies 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Mavenfile +4 -8
- data/Readme.md +10 -0
- data/jar-dependencies.gemspec +1 -1
- data/lib/jar_dependencies.rb +1 -0
- data/lib/jars/installer.rb +35 -21
- data/lib/jars/maven_exec.rb +1 -1
- data/lib/jars/maven_factory.rb +3 -10
- data/lib/jars/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fce3cb6f86473d79460870d971844bfb91470be
|
4
|
+
data.tar.gz: 87fb942e560b8dfab98597223893d92e5dfad355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20290f1446c65aadd4d19ee7a82f247e69c5cb9015f172ee554b131b7582b9aa14ceae3d1d85921dba95d94ca842a7b2668d570f2484d02fd4c2930548381771
|
7
|
+
data.tar.gz: b19132532e867e06eaa204f9d8aaafec89b65014b2392210f3f1e999035574c8005c5fa40987f8a0ac380443820fd9adf04b818756172592666aace2a6cc373a
|
data/Mavenfile
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
gemfile
|
4
4
|
|
5
|
-
|
6
|
-
repository :id => :mavengems, :url => 'mavengem:http://rubygems.org'
|
7
|
-
extension 'de.saumya.mojo:mavengem-wagon:0.1.0'
|
5
|
+
plugin_repository :id => :maven_gems, :url => 'mavengem:https://rubygems.org'
|
8
6
|
|
9
7
|
jruby_plugin( :minitest, :minispecDirectory => "specs/*_spec.rb" ) do
|
10
8
|
execute_goals(:spec)
|
@@ -19,13 +17,13 @@ ruby_maven = gemfile_profile.dependencies.detect do |d|
|
|
19
17
|
d.artifact_id == 'ruby-maven'
|
20
18
|
end
|
21
19
|
|
22
|
-
properties( 'jruby.versions' => ['1.7.12', '1.7.
|
20
|
+
properties( 'jruby.versions' => ['1.7.12', '1.7.25', '${jruby.version}'
|
23
21
|
].join(','),
|
24
22
|
'jruby.modes' => ['1.9', '2.0', '2.2'].join(','),
|
25
23
|
# just lock the version
|
26
24
|
'bundler.version' => '1.10.6',
|
27
25
|
'ruby-maven.version' => ruby_maven.version,
|
28
|
-
'jruby.version' => '9.0.
|
26
|
+
'jruby.version' => '9.0.5.0',
|
29
27
|
'jruby.plugins.version' => '1.1.3',
|
30
28
|
'push.skip' => true )
|
31
29
|
|
@@ -44,9 +42,7 @@ plugin :invoker, '1.8' do
|
|
44
42
|
'jruby.version' => '${jruby.version}',
|
45
43
|
'jruby.plugins.version' => '${jruby.plugins.version}',
|
46
44
|
'bundler.version' => '${bundler.version}',
|
47
|
-
'ruby-maven.version' => '${ruby-maven.version}'
|
48
|
-
# dump pom for the time being - for travis
|
49
|
-
'polyglot.dump.pom' => 'pom.xml'})
|
45
|
+
'ruby-maven.version' => '${ruby-maven.version}' })
|
50
46
|
end
|
51
47
|
|
52
48
|
distribution_management do
|
data/Readme.md
CHANGED
@@ -128,6 +128,16 @@ since jar-dependencies does not declare ruby-maven as runtime dependency
|
|
128
128
|
setup the project it is needed) it is advicable to have it as
|
129
129
|
development dependency in you Gemfile.
|
130
130
|
|
131
|
+
# proxy and mirror setup
|
132
|
+
|
133
|
+
proxied and mirrors can be setup by the usual configuration of maven itself: [settings.xml](https://maven.apache.org/settings.html) - see the mirrors and proxy sections.
|
134
|
+
|
135
|
+
as jar-dependencies does only deal with jar and all jars need to come from maven central, it is only neccessary to mirror maven-central. an example of such a [settings-example.xml](setting.xml is here).
|
136
|
+
|
137
|
+
you also can add such a settings.xml to your project which jar-dependencies will use instad of the default maven locations. this allows to have a per project configuration and also removes the need to users of your ruby project to dive into maven in case your have company policy to use a local mirror for gem and jar artifacts.
|
138
|
+
|
139
|
+
jar-dependencies itself uses maven **only** for the jars and all gems are managed by rubygems or bundler or your favourit management tool. so any proxy/mirror settings which should affect gems need to be done in those tools.
|
140
|
+
|
131
141
|
# gradle, maven, etc
|
132
142
|
|
133
143
|
for dependency management frameworks like gradle (via
|
data/jar-dependencies.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
|
28
28
|
s.add_development_dependency 'minitest', '~> 5.3'
|
29
29
|
s.add_development_dependency 'rake', '~> 10.2'
|
30
|
-
RUBY_MAVEN_VERSION = '~> 3.3.
|
30
|
+
RUBY_MAVEN_VERSION = '~> 3.3.11'
|
31
31
|
s.add_development_dependency 'ruby-maven', RUBY_MAVEN_VERSION
|
32
32
|
|
33
33
|
s.post_install_message = <<EOF
|
data/lib/jar_dependencies.rb
CHANGED
data/lib/jars/installer.rb
CHANGED
@@ -100,12 +100,16 @@ module Jars
|
|
100
100
|
print_require_jar( file, dep )
|
101
101
|
end
|
102
102
|
|
103
|
-
def self.print_require_jar( file, dep )
|
103
|
+
def self.print_require_jar( file, dep, fallback = false )
|
104
104
|
return if dep.type != :jar || dep.scope != :runtime
|
105
105
|
if dep.system?
|
106
106
|
file.puts( "require( '#{dep.file}' )" ) if file
|
107
107
|
elsif dep.scope == :runtime
|
108
|
-
|
108
|
+
if fallback
|
109
|
+
file.puts( " require '#{dep.path}'" ) if file
|
110
|
+
else
|
111
|
+
file.puts( " require_jar( '#{dep.gav.gsub( ':', "', '" )}' )" ) if file
|
112
|
+
end
|
109
113
|
end
|
110
114
|
end
|
111
115
|
|
@@ -125,11 +129,20 @@ module Jars
|
|
125
129
|
FileUtils.mkdir_p( File.dirname( require_filename ) )
|
126
130
|
File.open( require_filename, 'w' ) do |f|
|
127
131
|
f.puts COMMENT
|
128
|
-
f.puts "
|
132
|
+
f.puts "begin"
|
133
|
+
f.puts " require 'jar_dependencies'"
|
134
|
+
f.puts "rescue LoadError"
|
135
|
+
deps.each do |dep|
|
136
|
+
# do not use require_jar method
|
137
|
+
print_require_jar( f, dep, true )
|
138
|
+
end
|
139
|
+
f.puts "end"
|
129
140
|
f.puts
|
141
|
+
f.puts "if defined? Jars"
|
130
142
|
deps.each do |dep|
|
131
143
|
print_require_jar( f, dep )
|
132
144
|
end
|
145
|
+
f.puts "end"
|
133
146
|
yield f if block_given?
|
134
147
|
end
|
135
148
|
end
|
@@ -147,30 +160,28 @@ module Jars
|
|
147
160
|
|
148
161
|
def spec; @mvn.spec end
|
149
162
|
|
150
|
-
def vendor_jars( write_require_file = true )
|
163
|
+
def vendor_jars( write_require_file = true, vendor_dir = nil )
|
151
164
|
return unless has_jars?
|
152
|
-
|
165
|
+
if Jars.to_prop( Jars::VENDOR ) == 'false'
|
166
|
+
vendor_dir = nil
|
167
|
+
else
|
168
|
+
vendor_dir ||= spec.require_path
|
169
|
+
end
|
170
|
+
do_install( vendor_dir, write_require_file )
|
153
171
|
end
|
154
172
|
|
155
|
-
def self.vendor_jars!
|
156
|
-
new.vendor_jars!
|
173
|
+
def self.vendor_jars!(vendor_dir = nil)
|
174
|
+
new.vendor_jars!(true, vendor_dir)
|
157
175
|
end
|
158
176
|
|
159
|
-
def vendor_jars!( write_require_file = true )
|
160
|
-
|
161
|
-
|
162
|
-
do_vendor = true
|
163
|
-
when 'false'
|
164
|
-
do_vendor = false
|
165
|
-
else
|
166
|
-
do_vendor = true
|
167
|
-
end
|
168
|
-
do_install( do_vendor, write_require_file )
|
177
|
+
def vendor_jars!( write_require_file = true, vendor_dir = nil )
|
178
|
+
vendor_dir ||= spec.require_path
|
179
|
+
do_install( vendor_dir, write_require_file )
|
169
180
|
end
|
170
181
|
|
171
182
|
def install_jars( write_require_file = true )
|
172
183
|
return unless has_jars?
|
173
|
-
do_install(
|
184
|
+
do_install( nil, write_require_file )
|
174
185
|
end
|
175
186
|
|
176
187
|
def ruby_maven_install_options=( options )
|
@@ -194,8 +205,11 @@ module Jars
|
|
194
205
|
|
195
206
|
private
|
196
207
|
|
197
|
-
def do_install(
|
198
|
-
|
208
|
+
def do_install( vendor_dir, write_require_file )
|
209
|
+
if !spec.require_paths.include?(vendor_dir)
|
210
|
+
raise "vendor dir #{vendor_dir} not in require_paths of gemspec #{spec.require_paths}"
|
211
|
+
end
|
212
|
+
target_dir = File.join( @mvn.basedir, vendor_dir || spec.require_path )
|
199
213
|
jars_file = File.join( target_dir, "#{spec.name}_jars.rb" )
|
200
214
|
|
201
215
|
# write out new jars_file it write_require_file is true or
|
@@ -209,7 +223,7 @@ module Jars
|
|
209
223
|
end
|
210
224
|
deps = install_dependencies()
|
211
225
|
self.class.write_require_jars( deps, jars_file )
|
212
|
-
if
|
226
|
+
if vendor_dir
|
213
227
|
self.class.vendor_jars( deps, target_dir )
|
214
228
|
end
|
215
229
|
end
|
data/lib/jars/maven_exec.rb
CHANGED
@@ -36,7 +36,7 @@ module Jars
|
|
36
36
|
@specfile = File.expand_path( spec )
|
37
37
|
@basedir = File.dirname( @specfile )
|
38
38
|
Dir.chdir( @basedir ) do
|
39
|
-
spec = eval( File.read( @specfile ) )
|
39
|
+
spec = eval( File.read( @specfile ), TOPLEVEL_BINDING, @specfile )
|
40
40
|
end
|
41
41
|
when Gem::Specification
|
42
42
|
if File.exists?( spec.spec_file )
|
data/lib/jars/maven_factory.rb
CHANGED
@@ -22,6 +22,7 @@ module Jars
|
|
22
22
|
jndex = 0
|
23
23
|
a.exclusions.each do |ex|
|
24
24
|
self[ "jars.#{@index}.exclusions.#{jndex}" ] = ex.to_s
|
25
|
+
jndex += 1
|
25
26
|
end
|
26
27
|
end
|
27
28
|
self[ "jars.#{@index}.scope" ] = a.scope if a.scope
|
@@ -69,15 +70,6 @@ module Jars
|
|
69
70
|
end
|
70
71
|
maven[ 'verbose' ] = (@debug || @verbose) == true
|
71
72
|
|
72
|
-
# TODO what todo with https proxy ?
|
73
|
-
# FIX this proxy settings seems not to work
|
74
|
-
if (proxy = Gem.configuration[ :http_proxy ]).is_a?( String )
|
75
|
-
require 'uri'; uri = URI.parse( proxy )
|
76
|
-
maven['proxySet'] = 'true'
|
77
|
-
maven['proxyHost'] = "#{uri.host}"
|
78
|
-
maven['proxyPort'] = "#{uri.port}"
|
79
|
-
end
|
80
|
-
|
81
73
|
if Jars.maven_settings
|
82
74
|
maven.options[ '-s' ] = Jars.maven_settings
|
83
75
|
end
|
@@ -121,7 +113,8 @@ module Jars
|
|
121
113
|
unless spec
|
122
114
|
raise "failed to resolve gem '#{name}' if you're using Bundler add it as a dependency"
|
123
115
|
end
|
124
|
-
|
116
|
+
path = File.join( spec.full_gem_path, spec.require_path )
|
117
|
+
$LOAD_PATH << path unless $LOAD_PATH.include?( path )
|
125
118
|
end
|
126
119
|
|
127
120
|
def requirement( name )
|
data/lib/jars/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jar-dependencies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian meier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 3.3.
|
46
|
+
version: 3.3.11
|
47
47
|
name: ruby-maven
|
48
48
|
prerelease: false
|
49
49
|
type: :development
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.3.
|
54
|
+
version: 3.3.11
|
55
55
|
description: manage jar dependencies for gems and keep track which jar was already loaded using maven artifact coordinates. it warns on version conflicts and loads only ONE jar assuming the first one is compatible to the second one otherwise your project needs to lock down the right version by providing a Jars.lock file.
|
56
56
|
email:
|
57
57
|
- mkristian@web.de
|
@@ -90,9 +90,9 @@ licenses:
|
|
90
90
|
- MIT
|
91
91
|
metadata: {}
|
92
92
|
post_install_message: "\nif you want to use the executable lock_jars then install\
|
93
|
-
\ ruby-maven gem before using lock_jars \n\n $ gem install ruby-maven -v '~> 3.3.
|
93
|
+
\ ruby-maven gem before using lock_jars \n\n $ gem install ruby-maven -v '~> 3.3.11'\n\
|
94
94
|
\nor add it as a development dependency to your Gemfile\n\n gem 'ruby-maven',\
|
95
|
-
\ '~> 3.3.
|
95
|
+
\ '~> 3.3.11'\n\n"
|
96
96
|
rdoc_options: []
|
97
97
|
require_paths:
|
98
98
|
- lib
|