jar-dependencies 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8285b7214e47fe153c7757817c250fe9a7752fdc
4
- data.tar.gz: f99b7597244bdbf340fb945c7cf39a699734b15a
3
+ metadata.gz: a34bb3f36e6ad44d263107a9d6fe8d3e513b934f
4
+ data.tar.gz: 620b12873948e1347d0020596dcb7cc080304952
5
5
  SHA512:
6
- metadata.gz: b55db0cfecaaf73eac4d95cc3b7d061d809d112afe815afffd2a8a12b83ed4d3c8beb0cbfb19e27ff2f14ece87068d3267c49e79298dda32d273cbbc69f0284b
7
- data.tar.gz: 5bcf7abf25d8709a98ff405a94bdba3f219450bf58b8a2c0d6a99b2499f1067f0870277d4f32fd7520a50b3095ec3bb1315616a34606c5d57e88f6695086174b
6
+ metadata.gz: d2f5934de747736b5f733cfac0aeb932be5896ff8e1ff1536290894f71bc50733b41c4bdd2533ed596b5acff65c0cd511b719ff4f6f6efb93c7c00051eaac813
7
+ data.tar.gz: d76e95558788a112844391576b838af227d2f2871f0f988b5817a645af450a39ea276861beb5236a26410ac3587479e18f06789736d02c71f8a7a16ca2a9901a
data/Mavenfile CHANGED
@@ -16,6 +16,7 @@ properties( 'jruby.versions' => ['1.6.8', '1.7.12', '${jruby.version}', '9.0.0.0
16
16
  'jruby.modes' => ['1.9', '2.0', '2.1'].join(','),
17
17
  # just lock the version
18
18
  'jruby.version' => '1.7.19',
19
+ 'jruby.plugins.version' => '1.0.9',
19
20
  'tesla.dump.pom' => 'pom.xml',
20
21
  'tesla.dump.readonly' => true )
21
22
 
@@ -26,7 +27,13 @@ plugin :invoker, '1.8' do
26
27
  :streamLogs => true,
27
28
  :goals => ['install'],
28
29
  :cloneProjectsTo => '${project.build.directory}',
29
- :properties => { 'jar-dependencies.version' => '${project.version}' })
30
+ :properties => { 'jar-dependencies.version' => '${project.version}',
31
+ 'jruby.version' => '${jruby.version}',
32
+ 'jruby.plugins.version' => '${jruby.plugins.version}',
33
+ 'bundler.version' => '1.9.2',
34
+ 'ruby-maven.version' => '3.1.1.0.11',
35
+ # dump pom for the time being - for travis
36
+ 'polyglot.dump.pom' => 'pom.xml'})
30
37
  end
31
38
 
32
39
  # vim: syntax=Ruby
@@ -1,8 +1,10 @@
1
1
  #-*- mode: ruby -*-
2
2
 
3
+ require './lib/jars/version'
4
+
3
5
  Gem::Specification.new do |s|
4
6
  s.name = 'jar-dependencies'
5
- s.version = "0.1.10"
7
+ s.version = Jars::VERSION
6
8
  s.author = 'christian meier'
7
9
  s.email = [ 'mkristian@web.de' ]
8
10
  s.summary = 'manage jar dependencies for gems'
@@ -10,17 +12,15 @@ Gem::Specification.new do |s|
10
12
 
11
13
  s.license = 'MIT'
12
14
 
13
- s.executable = 'bundle-with-jars'
14
-
15
15
  s.files = Dir[ 'lib/**/*rb' ]
16
16
  s.files += Dir[ '*file' ]
17
17
  s.files += [ 'Readme.md', 'jar-dependencies.gemspec', 'MIT-LICENSE' ]
18
18
 
19
- s.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.'
19
+ s.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.'
20
20
 
21
21
  s.add_development_dependency 'minitest', '~> 5.3'
22
22
  s.add_development_dependency 'rake', '~> 10.2'
23
- s.add_development_dependency "ruby-maven", "~> 3.1.1.0.9"
23
+ s.add_development_dependency "ruby-maven", "~> 3.1.1.0.11"
24
24
  end
25
25
 
26
26
  # vim: syntax=Ruby
@@ -18,10 +18,12 @@
18
18
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  #
21
-
22
21
  module Jars
23
22
  unless defined? Jars::MAVEN_SETTINGS
24
23
  MAVEN_SETTINGS = 'JARS_MAVEN_SETTINGS'.freeze
24
+ LOCAL_MAVEN_REPO = 'JARS_LOCAL_MAVEN_REPO'.freeze
25
+ # lock file to use
26
+ LOCK = 'JARS_LOCK'.freeze
25
27
  # where the locally stored jars are search for or stored
26
28
  HOME = 'JARS_HOME'.freeze
27
29
  # skip the gem post install hook
@@ -96,6 +98,14 @@ module Jars
96
98
  @frozen = true
97
99
  end
98
100
 
101
+ def lock
102
+ to_prop( LOCK ) || 'Jars.lock'
103
+ end
104
+
105
+ def local_maven_repo
106
+ to_prop( LOCAL_MAVEN_REPO ) || home
107
+ end
108
+
99
109
  def reset
100
110
  instance_variables.each { |var| instance_variable_set(var, nil) }
101
111
  ( @@jars ||= {} ).clear
@@ -151,18 +161,23 @@ module Jars
151
161
  @_jars_home_
152
162
  end
153
163
 
164
+ def require_jars_lock!( scope = :runtime )
165
+ # funny error during spec where it tries to load it again
166
+ # and finds it as gem instead of the LOAD_PATH
167
+ require 'jars/classpath' unless defined? Jars::Classpath
168
+ classpath = Jars::Classpath.new
169
+ if jars_lock = classpath.jars_lock
170
+ @@jars_lock = jars_lock
171
+ classpath.require( scope )
172
+ self.no_more_warnings
173
+ end
174
+ end
175
+
154
176
  def require_jars_lock
155
177
  @@jars_lock ||= false
156
178
  unless @@jars_lock
157
- # be lazy and only load if there are jar dependencies
158
- require 'jars/classpath'
159
- classpath = Jars::Classpath.new
160
- if @@jars_lock = classpath.jars_lock
161
- classpath.require
162
- self.no_more_warnings
163
- else
164
- @@jars_lock = true
165
- end
179
+ require_jars_lock!
180
+ @@jars_lock ||= true
166
181
  end
167
182
  end
168
183
 
@@ -16,7 +16,9 @@ module Jars
16
16
  end
17
17
 
18
18
  def jars_lock
19
- deps = File.join( @mvn.basedir || '.', 'Jars.lock' )
19
+ deps = Jars.lock
20
+ return deps if File.exists?( deps )
21
+ deps = File.join( @mvn.basedir || '.', Jars.lock )
20
22
  deps if File.exists?( deps )
21
23
  end
22
24
 
@@ -35,7 +37,7 @@ module Jars
35
37
  def resolve_dependencies
36
38
  basedir = workdir( 'pkg' ) || workdir( 'target' ) || workdir( '' )
37
39
  deps = File.join( basedir, DEPENDENCY_LIST )
38
- @mvn.resolve_dependencies( deps )
40
+ @mvn.resolve_dependencies_list( deps )
39
41
  deps
40
42
  end
41
43
  private :resolve_dependencies
@@ -175,7 +175,7 @@ module Jars
175
175
  deps = File.join( @mvn.basedir, 'deps.lst' )
176
176
 
177
177
  puts " jar dependencies for #{@mvn.spec.spec_name} . . ." unless Jars.quiet?
178
- @mvn.resolve_dependencies( deps )
178
+ @mvn.resolve_dependencies_list( deps )
179
179
 
180
180
  self.class.load_from_maven( deps )
181
181
  ensure
@@ -5,10 +5,10 @@ specfile = java.lang.System.getProperty('jars.specfile')
5
5
  # needed since the gemspec does not allow absolute files
6
6
  basedir( File.dirname( specfile ) )
7
7
 
8
- # add jruby for compilation
8
+ # add jruby as provided for compilation when used vi Jars::Classpath#classpath
9
9
  jar 'org.jruby:jruby-core', JRUBY_VERSION, :scope => :provided
10
10
 
11
- # get ALL depenedencies from the specfile
11
+ # get ALL dependencies from the specfile
12
12
  gemspec File.basename( specfile )
13
13
 
14
14
  # we do not want those gem dependencies, each gem takes care of its
@@ -3,7 +3,7 @@
3
3
  require_relative 'lock'
4
4
  require_relative '../jar_dependencies'
5
5
 
6
- lock = Jars::Lock.new( java.lang.System.getProperty('outputFile') )
6
+ lock = Jars::Lock.new( ENV_JAVA['jars.lock'] )
7
7
 
8
8
  lock.process( :all ) do |coord|
9
9
 
@@ -14,5 +14,3 @@ lock.process( :all ) do |coord|
14
14
  jar coord.group_id, coord.artifact_id, coord.version, options
15
15
 
16
16
  end
17
-
18
- properties :excludeTransitive => true
@@ -55,7 +55,7 @@ module Jars
55
55
  end
56
56
 
57
57
  def process( scope )
58
- scope ||= :compile
58
+ scope ||= :runtime
59
59
  File.read( @file ).each_line do |line|
60
60
  next if not line =~ /:.+:/
61
61
  jar = JarDetails.new( line.strip
@@ -65,11 +65,13 @@ module Jars
65
65
  when :all
66
66
  yield jar
67
67
  when :compile
68
+ # jar.scope is maven scope
68
69
  yield jar if jar.scope != :test
69
70
  when :runtime
71
+ # jar.scope is maven scope
70
72
  yield jar if jar.scope != :test and jar.scope != :provided
71
73
  when :test
72
- yield jar if jar.scope != :runtime
74
+ yield jar
73
75
  end
74
76
  end
75
77
  end
@@ -29,7 +29,9 @@ module Jars
29
29
  when String
30
30
  @specfile = File.expand_path( spec )
31
31
  @basedir = File.dirname( @specfile )
32
- spec = eval( File.read( spec ) )
32
+ spec = Dir.chdir( File.dirname(@specfile) ) do
33
+ eval( File.read( @specfile ) )
34
+ end
33
35
  when Gem::Specification
34
36
  if File.exists?( spec.spec_file )
35
37
  @basedir = spec.gem_dir
@@ -57,26 +59,26 @@ module Jars
57
59
  @options.delete( :ignore_dependencies )
58
60
  end
59
61
 
62
+ def resolve_dependencies_list( file )
63
+ do_resolve_dependencies( *setup_arguments( 'jar_pom.rb', 'dependency:copy-dependencies', 'dependency:list', "-DoutputFile=#{file}" ) )
64
+ end
65
+
60
66
  def resolve_dependencies( file )
67
+ do_resolve_dependencies( *setup_arguments( 'jars_lock_pom.rb', 'dependency:copy-dependencies', '-DexcludeTransitive=true' , "-Djars.lock=#{file}") )
68
+ end
69
+
70
+ private
71
+
72
+ def do_resolve_dependencies( *args )
61
73
  lazy_load_maven
62
74
 
63
75
  maven = Maven::Ruby::Maven.new
64
76
  maven.verbose = Jars.verbose?
65
- maven.exec( *setup_arguments( file ) )
77
+ maven.exec( *args )
66
78
  end
67
79
 
68
- private
69
-
70
- def setup_arguments( deps )
71
- if File.basename( deps ) == 'Jars.lock'
72
- pom = 'jars_lock_pom.rb'
73
- goals = [ 'dependency:copy-dependencies' ]
74
- else
75
- pom = 'jar_pom.rb'
76
- goals = [ 'dependency:copy-dependencies', 'dependency:list' ]
77
- end
78
- args = [ *goals,
79
- "-DoutputFile=#{deps}",
80
+ def setup_arguments( pom, *goals )
81
+ args = [ *goals,
80
82
  '-DoutputAbsoluteArtifactFilename=true',
81
83
  '-DincludeTypes=jar',
82
84
  '-DoutputScope=true',
@@ -98,11 +100,7 @@ module Jars
98
100
  args << "-DproxyPort=#{uri.port}"
99
101
  end
100
102
 
101
- if defined? JRUBY_VERSION
102
- args << "-Dmaven.repo.local=#{java.io.File.new( Jars.home ).absolute_path}"
103
- else
104
- args << "-Dmaven.repo.local=#{File.expand_path( Jars.home )}"
105
- end
103
+ args << "-Dmaven.repo.local=#{java.io.File.new( Jars.local_maven_repo ).absolute_path}"
106
104
 
107
105
  args
108
106
  end
@@ -0,0 +1,3 @@
1
+ module Jars
2
+ VERSION = '0.1.11'.freeze
3
+ end
metadata CHANGED
@@ -1,80 +1,79 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jar-dependencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian meier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-28 00:00:00.000000000 Z
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: minitest
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '5.3'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ~>
23
17
  - !ruby/object:Gem::Version
24
18
  version: '5.3'
19
+ name: minitest
25
20
  prerelease: false
26
21
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
24
  - - ~>
32
25
  - !ruby/object:Gem::Version
33
- version: '10.2'
26
+ version: '5.3'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - ~>
37
31
  - !ruby/object:Gem::Version
38
32
  version: '10.2'
33
+ name: rake
39
34
  prerelease: false
40
35
  type: :development
41
- - !ruby/object:Gem::Dependency
42
- name: ruby-maven
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - ~>
46
39
  - !ruby/object:Gem::Version
47
- version: 3.1.1.0.9
40
+ version: '10.2'
41
+ - !ruby/object:Gem::Dependency
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
44
  - - ~>
51
45
  - !ruby/object:Gem::Version
52
- version: 3.1.1.0.9
46
+ version: 3.1.1.0.11
47
+ name: ruby-maven
53
48
  prerelease: false
54
49
  type: :development
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.
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.1.0.11
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
58
- executables:
59
- - bundle-with-jars
58
+ executables: []
60
59
  extensions: []
61
60
  extra_rdoc_files: []
62
61
  files:
62
+ - lib/rubygems_plugin.rb
63
+ - lib/jar-dependencies.rb
63
64
  - lib/jar_install_post_install_hook.rb
64
65
  - lib/jar_dependencies.rb
65
66
  - lib/jar_installer.rb
66
- - lib/jar-dependencies.rb
67
- - lib/rubygems_plugin.rb
68
- - lib/jars/jar_pom.rb
67
+ - lib/jars/classpath.rb
69
68
  - lib/jars/jars_lock_pom.rb
70
- - lib/jars/installer.rb
71
- - lib/jars/lock.rb
72
69
  - lib/jars/maven_exec.rb
73
- - lib/jars/classpath.rb
70
+ - lib/jars/version.rb
71
+ - lib/jars/installer.rb
72
+ - lib/jars/jar_pom.rb
74
73
  - lib/jars/post_install_hook.rb
75
- - bin/bundle-with-jars
76
- - Rakefile
74
+ - lib/jars/lock.rb
77
75
  - Mavenfile
76
+ - Rakefile
78
77
  - Gemfile
79
78
  - Readme.md
80
79
  - jar-dependencies.gemspec
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'jar_install_post_install_hook'
4
-
5
- load Gem.bin_path('bundler', 'bundle')