maven-tools 0.33.3 → 0.33.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/maven/tools/dsl.rb +92 -14
- data/lib/maven/tools/version.rb +1 -1
- data/lib/maven/tools/versions.rb +1 -1
- metadata +2 -2
data/lib/maven/tools/dsl.rb
CHANGED
@@ -80,7 +80,10 @@ module Maven
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def group( *args )
|
83
|
+
@group = args[ 0 ]
|
83
84
|
yield
|
85
|
+
ensure
|
86
|
+
@group = nil
|
84
87
|
end
|
85
88
|
|
86
89
|
def gemfile( name = 'Gemfile', options = {} )
|
@@ -100,6 +103,16 @@ module Maven
|
|
100
103
|
@gemfile_options = nil
|
101
104
|
setup_gem_support( options )
|
102
105
|
end
|
106
|
+
|
107
|
+
if @has_path or @has_git
|
108
|
+
gem 'bundler', :scope => :provided unless gem? 'bundler'
|
109
|
+
jruby_plugin :gem do
|
110
|
+
execute_goal :exec, :filename => 'bundle', :args => 'install'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
ensure
|
114
|
+
@has_path = nil
|
115
|
+
@has_git = nil
|
103
116
|
end
|
104
117
|
|
105
118
|
def setup_gem_support( options, spec = nil, config = {} )
|
@@ -116,7 +129,7 @@ module Maven
|
|
116
129
|
:id => 'rubygems-releases' )
|
117
130
|
end
|
118
131
|
|
119
|
-
|
132
|
+
setup_jruby_plugins_version
|
120
133
|
|
121
134
|
if options.key?( :jar ) || options.key?( 'jar' )
|
122
135
|
jarpath = options[ :jar ] || options[ 'jar' ]
|
@@ -432,6 +445,21 @@ module Maven
|
|
432
445
|
@current.build.extensions << ext
|
433
446
|
end
|
434
447
|
|
448
|
+
def setup_jruby_plugins_version
|
449
|
+
unless @current.properties.key?( 'jruby.plugins.version' )
|
450
|
+
properties( 'jruby.plugins.version' => VERSIONS[ :jruby_plugins ] )
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
def jruby_plugin( *gav, &block )
|
455
|
+
gav[ 0 ] = "de.saumya.mojo:#{gav[ 0 ]}-maven-plugin"
|
456
|
+
if gav.size == 1 || gav[ 1 ].is_a?( Hash )
|
457
|
+
setup_jruby_plugins_version
|
458
|
+
gav.insert( 1, '${jruby.plugins.version}' )
|
459
|
+
end
|
460
|
+
plugin( *gav, &block )
|
461
|
+
end
|
462
|
+
|
435
463
|
def plugin( *gav, &block )
|
436
464
|
if gav.last.is_a? Hash
|
437
465
|
options = gav.last
|
@@ -506,6 +534,29 @@ module Maven
|
|
506
534
|
end
|
507
535
|
|
508
536
|
def dependency( type, *args )
|
537
|
+
do_dependency( false, type, *args )
|
538
|
+
end
|
539
|
+
|
540
|
+
def dependency?( container, dep )
|
541
|
+
container.detect do |d|
|
542
|
+
dep.group_id == d.group_id && dep.artifact_id == d.artifact_id && dep.classifier == d.classifier
|
543
|
+
end
|
544
|
+
end
|
545
|
+
|
546
|
+
def dependency_set( bang, container, dep )
|
547
|
+
if bang
|
548
|
+
dd = dependency?( container, dep )
|
549
|
+
if index = container.index( dd )
|
550
|
+
container[ index ] = dep
|
551
|
+
else
|
552
|
+
container << dep
|
553
|
+
end
|
554
|
+
else
|
555
|
+
container << dep
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
def do_dependency( bang, type, *args )
|
509
560
|
if args.empty?
|
510
561
|
a = type
|
511
562
|
type = a[ :type ]
|
@@ -522,9 +573,13 @@ module Maven
|
|
522
573
|
d.type = type.to_s
|
523
574
|
if @context == :overrides
|
524
575
|
@current.dependency_management ||= DependencyManagement.new
|
525
|
-
|
576
|
+
dependency_set( bang,
|
577
|
+
@current.dependency_management.dependencies,
|
578
|
+
d )
|
526
579
|
else
|
527
|
-
|
580
|
+
dependency_set( bang,
|
581
|
+
@current.dependencies,
|
582
|
+
d )
|
528
583
|
end
|
529
584
|
if args.last.is_a?( Hash )
|
530
585
|
options = args.last
|
@@ -595,8 +650,23 @@ module Maven
|
|
595
650
|
@current.reporting = reporting
|
596
651
|
nested_block( :reporting, reporting, block )
|
597
652
|
end
|
653
|
+
|
654
|
+
def gem?( name )
|
655
|
+
@current.dependencies.detect do |d|
|
656
|
+
d.artifact_id == name && d.type == :gem
|
657
|
+
end
|
658
|
+
end
|
598
659
|
|
599
660
|
def gem( *args )
|
661
|
+
do_gem( false, *args )
|
662
|
+
end
|
663
|
+
|
664
|
+
# TODO useful ?
|
665
|
+
def gem!( *args )
|
666
|
+
do_gem( true, *args )
|
667
|
+
end
|
668
|
+
|
669
|
+
def do_gem( bang, *args )
|
600
670
|
# in some setup that gem could overload the Kernel gem
|
601
671
|
return if @current.nil?
|
602
672
|
unless args[ 0 ].match( /:/ )
|
@@ -604,21 +674,29 @@ module Maven
|
|
604
674
|
end
|
605
675
|
if args.last.is_a?(Hash)
|
606
676
|
options = args.last
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
677
|
+
if options.key?( :git )
|
678
|
+
@has_git = true
|
679
|
+
elsif options.key?( :path )
|
680
|
+
@has_path = true
|
681
|
+
else
|
682
|
+
platform = options.delete( :platform ) || options.delete( 'platform' )
|
683
|
+
group = options.delete( :group ) || options.delete( 'group' ) || @group || nil
|
684
|
+
if group
|
685
|
+
case group.to_sym
|
686
|
+
when :test
|
687
|
+
options[ :scope ] = :test
|
688
|
+
when :development
|
689
|
+
options[ :scope ] = :provided
|
690
|
+
end
|
691
|
+
end
|
615
692
|
if platform.nil? || is_jruby_platform( platform )
|
616
|
-
|
693
|
+
options[ :version ] = '[0,)' if args.size == 2 && options[ :version ].nil? && options[ 'version' ].nil?
|
694
|
+
do_dependency( bang, :gem, *args )
|
617
695
|
end
|
618
696
|
end
|
619
697
|
else
|
620
|
-
|
621
|
-
|
698
|
+
args << { :version => '[0,)' } if args.size == 1
|
699
|
+
do_dependency( bang, :gem, *args )
|
622
700
|
end
|
623
701
|
end
|
624
702
|
|
data/lib/maven/tools/version.rb
CHANGED
data/lib/maven/tools/versions.rb
CHANGED
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: maven-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.33.
|
5
|
+
version: 0.33.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Christian Meier
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|