jar-dependencies 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +22 -2
- data/jar-dependencies.gemspec +1 -1
- data/lib/jar_dependencies.rb +21 -7
- data/lib/jars/installer.rb +9 -3
- data/lib/jars/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 285c3578922ce5e751b875aac6728649d38a174f
|
4
|
+
data.tar.gz: a20d84a454308495cc0c10475bcbda345df89037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02086bfa2664b6ab0bc185d007f9504903ec24bcf94b4053f23d611297e0932c6fd5c0b02d6d7f6ac485b66d8c443f8f0f0e7b01853d65f8feca4849ca412f57
|
7
|
+
data.tar.gz: a096cc1e27693b6898ba1eabb315cd54b55c5ac65bf7f8da4031ba44b682367b62658063a8fdc494444a3e54e329c74783b546864d3b928f0b75880440ba4a0d
|
data/Readme.md
CHANGED
@@ -23,9 +23,9 @@ in such cases **jbundler** can always **overwrite** any such version.
|
|
23
23
|
|
24
24
|
add following to your *Rakefile*:
|
25
25
|
|
26
|
-
require '
|
26
|
+
require 'jars/installer'
|
27
27
|
task :install_jars do
|
28
|
-
Jars::
|
28
|
+
Jars::Installer.vendor_jars!
|
29
29
|
end
|
30
30
|
|
31
31
|
which will install (download) the dependent jars into **JARS_HOME** and create a
|
@@ -148,6 +148,26 @@ the gemspec files and just load the bundle jars into jruby
|
|
148
148
|
classloader, can easily create problems as the jackson and
|
149
149
|
xalan/xerces libraries used by those gems are popular ones in the java world.
|
150
150
|
|
151
|
+
# trouble shooting #
|
152
|
+
|
153
|
+
since maven is used under the hood it is possible to get more insight
|
154
|
+
what maven is doing. show the regualr maven output:
|
155
|
+
|
156
|
+
|
157
|
+
JARS_VERBOSE=true bundle install
|
158
|
+
JARS_VERBOSE=true gem install some_gem
|
159
|
+
|
160
|
+
or with maven debug enabled
|
161
|
+
|
162
|
+
JARS_DEBUG=true bundle install
|
163
|
+
JARS_DEBUG=true gem install some_gem
|
164
|
+
|
165
|
+
the maven command line which gets printed needs maven-3.3.x and the
|
166
|
+
ruby DSL extension for maven:
|
167
|
+
[https://github.com/takari/polyglot-maven#configuration](polyglot-maven
|
168
|
+
configuration) where ```${maven.multiModuleProjectDirectory}``` is
|
169
|
+
your current directory.
|
170
|
+
|
151
171
|
# configuration #
|
152
172
|
|
153
173
|
<table border='1'>
|
data/jar-dependencies.gemspec
CHANGED
@@ -36,7 +36,7 @@ if you want to use the executable #{LOCK_JARS} then install ruby-maven gem befor
|
|
36
36
|
|
37
37
|
$ gem install ruby-maven -v '#{RUBY_MAVEN_VERSION}'
|
38
38
|
|
39
|
-
or add it as
|
39
|
+
or add it as a development dependency to your Gemfile
|
40
40
|
|
41
41
|
gem 'ruby-maven', '#{RUBY_MAVEN_VERSION}'
|
42
42
|
|
data/lib/jar_dependencies.rb
CHANGED
@@ -28,6 +28,8 @@ module Jars
|
|
28
28
|
HOME = 'JARS_HOME'.freeze
|
29
29
|
# skip the gem post install hook
|
30
30
|
SKIP = 'JARS_SKIP'.freeze
|
31
|
+
# skip Jars.lock mainly to run lock_jars
|
32
|
+
SKIP_LOCK = 'JARS_SKIP_LOCK'.freeze
|
31
33
|
# do not require any jars if set to false
|
32
34
|
REQUIRE = 'JARS_REQUIRE'.freeze
|
33
35
|
# @private
|
@@ -47,8 +49,11 @@ module Jars
|
|
47
49
|
class << self
|
48
50
|
|
49
51
|
def lock_down( debug = false, verbose = false, options = {} )
|
52
|
+
ENV[ SKIP_LOCK ] = 'true'
|
50
53
|
require 'jars/lock_down' # do this lazy to keep things clean
|
51
54
|
Jars::LockDown.new( debug, verbose ).lock_down( options )
|
55
|
+
ensure
|
56
|
+
ENV[ SKIP_LOCK ] = nil
|
52
57
|
end
|
53
58
|
|
54
59
|
if defined? JRUBY_VERSION
|
@@ -117,6 +122,10 @@ module Jars
|
|
117
122
|
self.require = false
|
118
123
|
end
|
119
124
|
|
125
|
+
def skip_lock?
|
126
|
+
to_prop( SKIP_LOCK ) || false
|
127
|
+
end
|
128
|
+
|
120
129
|
def lock
|
121
130
|
to_prop( LOCK ) || 'Jars.lock'
|
122
131
|
end
|
@@ -140,10 +149,6 @@ module Jars
|
|
140
149
|
nil
|
141
150
|
end
|
142
151
|
|
143
|
-
def local_maven_repo
|
144
|
-
to_prop( LOCAL_MAVEN_REPO ) || home
|
145
|
-
end
|
146
|
-
|
147
152
|
def reset
|
148
153
|
instance_variables.each { |var| instance_variable_set(var, nil) }
|
149
154
|
( @@jars ||= {} ).clear
|
@@ -203,7 +208,8 @@ module Jars
|
|
203
208
|
end
|
204
209
|
|
205
210
|
def local_maven_repo
|
206
|
-
@_local_maven_repo ||=
|
211
|
+
@_local_maven_repo ||= absolute(to_prop(LOCAL_MAVEN_REPO)) ||
|
212
|
+
detect_local_repository(maven_local_settings) ||
|
207
213
|
detect_local_repository(maven_user_settings) ||
|
208
214
|
detect_local_repository(maven_global_settings) ||
|
209
215
|
File.join( user_home, '.m2', 'repository' )
|
@@ -224,7 +230,7 @@ module Jars
|
|
224
230
|
while done != urls do
|
225
231
|
urls.each do |url|
|
226
232
|
unless done.member?( url )
|
227
|
-
Jars.debug { "--- load jars from #{url}" }
|
233
|
+
Jars.debug { "--- load jars from uri #{url}" }
|
228
234
|
classpath = Jars::Classpath.new( nil, "uri:#{url}" )
|
229
235
|
classpath.require( scope )
|
230
236
|
done << url
|
@@ -277,7 +283,7 @@ module Jars
|
|
277
283
|
end
|
278
284
|
|
279
285
|
def require_jar( group_id, artifact_id, *classifier_version )
|
280
|
-
require_jars_lock
|
286
|
+
require_jars_lock unless skip_lock?
|
281
287
|
require_jar_with_block( group_id, artifact_id, *classifier_version ) do |gid, aid, version, classifier|
|
282
288
|
do_require( gid, aid, version, classifier )
|
283
289
|
end
|
@@ -355,10 +361,18 @@ module Jars
|
|
355
361
|
|
356
362
|
def do_require( *args )
|
357
363
|
jar = to_jar( *args )
|
364
|
+
local = File.join( Dir.pwd, 'jars', jar )
|
365
|
+
vendor = File.join( Dir.pwd, 'vendor', 'jars', jar )
|
358
366
|
file = File.join( home, jar )
|
359
367
|
# use jar from local repository if exists
|
360
368
|
if File.exists?( file )
|
361
369
|
require file
|
370
|
+
# use jar from PWD/jars if exists
|
371
|
+
elsif File.exists?( local )
|
372
|
+
require local
|
373
|
+
# use jar from PWD/vendor/jars if exists
|
374
|
+
elsif File.exists?( vendor )
|
375
|
+
require vendor
|
362
376
|
else
|
363
377
|
# otherwise try to find it on the load path
|
364
378
|
require jar
|
data/lib/jars/installer.rb
CHANGED
@@ -149,15 +149,21 @@ module Jars
|
|
149
149
|
|
150
150
|
def vendor_jars( write_require_file = true )
|
151
151
|
return unless has_jars?
|
152
|
+
vendor_jars!( write_require_file )
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.vendor_jars!
|
156
|
+
new.vendor_jars!
|
157
|
+
end
|
158
|
+
|
159
|
+
def vendor_jars!( write_require_file = true )
|
152
160
|
case Jars.to_prop( Jars::VENDOR )
|
153
161
|
when 'true'
|
154
162
|
do_vendor = true
|
155
163
|
when 'false'
|
156
164
|
do_vendor = false
|
157
165
|
else
|
158
|
-
|
159
|
-
# coming via bundle :path or :git
|
160
|
-
do_vendor = File.exists?( spec.spec_file )
|
166
|
+
do_vendor = true
|
161
167
|
end
|
162
168
|
do_install( do_vendor, write_require_file )
|
163
169
|
end
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian meier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,8 +91,8 @@ licenses:
|
|
91
91
|
metadata: {}
|
92
92
|
post_install_message: "\nif you want to use the executable lock_jars then install\
|
93
93
|
\ ruby-maven gem before using lock_jars \n\n $ gem install ruby-maven -v '~> 3.3.3'\n\
|
94
|
-
\nor add it as
|
95
|
-
\ 3.3.3'\n\n"
|
94
|
+
\nor add it as a development dependency to your Gemfile\n\n gem 'ruby-maven',\
|
95
|
+
\ '~> 3.3.3'\n\n"
|
96
96
|
rdoc_options: []
|
97
97
|
require_paths:
|
98
98
|
- lib
|