maven-tools 0.34.1 → 0.34.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,11 @@
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
- require 'maven/tools/coordinate'
21
+ begin
22
+ require 'maven/tools/coordinate'
23
+ rescue LoadError
24
+ # that gives an load error on jruby-maven-plugin/gem-maven-plugin ITs
25
+ end
22
26
  module Maven
23
27
  module Tools
24
28
  class Artifact < Hash
@@ -93,6 +97,12 @@ module Maven
93
97
 
94
98
  def self.from_coordinate( coord )
95
99
  args = coord.split( /:/ )
100
+ # maven coordinates differ :(
101
+ if args.size == 5
102
+ classifier = args[ 4 ]
103
+ args[ 4 ] = args[ 3 ]
104
+ args[ 3 ] = classifier
105
+ end
96
106
  new( *args )
97
107
  end
98
108
 
@@ -17,6 +17,16 @@ module Maven
17
17
  @model.version = '0.0.0'
18
18
  @context = :project
19
19
  nested_block( :project, @model, block ) if block
20
+ if @needs_torquebox
21
+ if ! @model.repositories.detect { |r| r.id == 'rubygems-prereleases' } && @model.dependencies.detect { |d| d.group_id == 'rubygems' && d.version.match( /[a-zA-Z]/ ) }
22
+
23
+ @current = @model
24
+ snapshot_repository( 'http://rubygems-proxy.torquebox.org/prereleases',
25
+ :id => 'rubygems-prereleases' )
26
+ @current = nil
27
+ end
28
+ @needs_torquebox = nil
29
+ end
20
30
  result = @model
21
31
  @context = nil
22
32
  @model = nil
@@ -137,11 +147,7 @@ module Maven
137
147
  repository( 'http://rubygems-proxy.torquebox.org/releases',
138
148
  :id => 'rubygems-releases' )
139
149
  end
140
- if ! model.repositories.detect { |r| r.id == 'rubygems-prereleases' } && model.dependencies.detect { |d| d.group_id == 'rubygems' && d.version.match( /[a-zA-Z]/ ) }
141
-
142
- snapshot_repository( 'http://rubygems-proxy.torquebox.org/prereleases',
143
- :id => 'rubygems-prereleases' )
144
- end
150
+ @needs_torquebox = true
145
151
 
146
152
  setup_jruby_plugins_version
147
153
  end
@@ -186,7 +192,7 @@ module Maven
186
192
  elsif ( jruby < '1.7.5' )
187
193
  jar 'org.jruby:jruby-core', jruby
188
194
  else
189
- jar 'org.jruby:jruby', jruby
195
+ jar 'org.jruby:jruby-noasm', jruby
190
196
  end
191
197
  end
192
198
  end
@@ -505,17 +511,19 @@ module Maven
505
511
  end
506
512
 
507
513
  def snapshot_repository( url, options = {}, &block )
508
- options[ :releases ] = false unless options.key?( :releases ) || options.key?( 'releases' )
509
- options[ :snapshots ] = true unless options.key?( :snapshots ) || options.key?( 'snapshots' )
514
+ unless @current.respond_to? :snapshot_repository=
515
+ options[ :releases ] = false unless options.key?( :releases ) || options.key?( 'releases' )
516
+ options[ :snapshots ] = true unless options.key?( :snapshots ) || options.key?( 'snapshots' )
517
+ end
510
518
  do_repository( :snapshot_repository=, url, options, block )
511
519
  end
512
520
 
513
521
  def releases( config )
514
- @current.releases = respository_policy( config )
522
+ @current.releases = repository_policy( config )
515
523
  end
516
524
 
517
525
  def snapshots( config )
518
- @current.snapshots = respository_policy( config )
526
+ @current.snapshots = repository_policy( config )
519
527
  end
520
528
 
521
529
  def repository_policy( config )
@@ -795,9 +803,13 @@ module Maven
795
803
  else
796
804
  a = ::Maven::Tools::Artifact.from( type, *args )
797
805
  end
806
+ options ||= {}
798
807
  d = fill_gav( Dependency,
799
808
  a ? a.gav : args.join( ':' ) )
800
809
  d.type = type.to_s
810
+ # TODO maybe copy everything from options ?
811
+ d.scope = options[ :scope ] if options[ :scope ]
812
+ d.system_path = options[ :system_path ] if options[ :system_path ]
801
813
  d
802
814
  end
803
815
 
@@ -846,6 +858,7 @@ module Maven
846
858
  when String
847
859
  d.exclusions << fill_gav( Exclusion, exclusions )
848
860
  end
861
+
849
862
  options.each do |k,v|
850
863
  d.send( "#{k}=".to_sym, v ) unless d.send( k.to_sym )
851
864
  end
@@ -21,6 +21,7 @@
21
21
  # TODO make nice require after ruby-maven uses the same ruby files
22
22
  require File.join(File.dirname(File.dirname(__FILE__)), 'model', 'model.rb')
23
23
  require File.join(File.dirname(__FILE__), 'jarfile.rb')
24
+ require File.join(File.dirname(__FILE__), 'coordinate.rb')
24
25
 
25
26
  module Maven
26
27
  module Tools
@@ -20,6 +20,6 @@
20
20
  #
21
21
  module Maven
22
22
  module Tools
23
- VERSION = '0.34.1'.freeze
23
+ VERSION = '0.34.2'.freeze
24
24
  end
25
25
  end
@@ -3,6 +3,11 @@ require 'maven/tools/artifact'
3
3
 
4
4
  describe Maven::Tools::Artifact do
5
5
 
6
+ it 'should convert from coordinate' do
7
+ Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:123' ).to_s.must_equal 'sdas:das:jar:tes:123'
8
+ Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:123' ).to_s.must_equal 'sdas:das:jar:123'
9
+ end
10
+
6
11
  it 'should setup artifact' do
7
12
  Maven::Tools::Artifact.new( "sdas", "das", "jar", "123", "tes" ).to_s.must_equal 'sdas:das:jar:tes:123'
8
13
  Maven::Tools::Artifact.new( "sdas", "das", "jar", "123" ).to_s.must_equal 'sdas:das:jar:123'
@@ -0,0 +1,5 @@
1
+ project 'example from jarfile' do
2
+
3
+ jarfile
4
+
5
+ end
data/spec/pom_spec.rb CHANGED
@@ -11,8 +11,8 @@ describe Maven::Tools::POM do
11
11
  pom_xml.sub!( /<!--(.|\n)*-->\n/, '' )
12
12
  pom_xml.sub!( /<?.*?>\n/, '' )
13
13
  pom_xml.sub!( /<project([^>]|\n)*>/, '<project>' )
14
-
15
- pom.to_s.must_equal pom_xml
14
+
15
+ pom.to_s.gsub( /#{File.expand_path( dir )}\//, '' ).must_equal pom_xml
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maven-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.1
4
+ version: 0.34.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-03 00:00:00.000000000 Z
12
+ date: 2013-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: virtus
@@ -113,6 +113,7 @@ files:
113
113
  - spec/gemfile_with_source/bouncy-castle-version.rb
114
114
  - spec/pom_maven_style/pom.rb
115
115
  - spec/gemspec_in_profile/bouncy-castle-version.rb
116
+ - spec/pom_from_jarfile/pom.rb
116
117
  - spec/gemfile_include_jars/bouncy-castle-version.rb
117
118
  - spec/gemfile/bouncy-castle-version.rb
118
119
  - spec/pom_with_execute/pom.rb