lib/maven/tools/dsl.rb in maven-tools-1.0.13 vs lib/maven/tools/dsl.rb in maven-tools-1.1.0
- old
+ new
@@ -86,11 +86,23 @@
end
self.send a[:type].to_sym, a
end
def source(*args)
- warn "ignore source #{args}" if !(args[0].to_s =~ /^https?:\/\/rubygems.org/) && args[0] != :rubygems
+ url = args[0].to_s
+ url = 'https://rubygems.org' if url == :rubygems
+ id = url.gsub( /[\/:"<>|?*]/, '_').gsub(/_+/, '_') unless url == 'https://rubygems.org'
+
+ # we need to add the repo at project level
+ if @context == :profile
+ current = @current
+ @current = @model
+ end
+
+ repository :id => id || 'mavengems', :url => "mavengem:#{url}"
+ extension! 'org.torquebox.mojo:mavengem-wagon', '${mavengem.wagon.version}'
+ @current = current if current
end
def ruby( *args )
# ignore
end
@@ -127,20 +139,21 @@
name = 'Gemfile'
end
name = ::File.join( basedir, name ) unless ::File.exists?( name )
if @context == :project
build do
+ extension! 'org.torquebox.mojo:mavengem-wagon', '${mavengem.wagon.version}'
directory '${basedir}/pkg'
end
end
@inside_gemfile = true
# the eval might need those options for gemspec declaration
lockfile = ::File.expand_path( name + '.lock' )
if File.exists? lockfile
pr = profile :gemfile do
activation do
- file( :missing => name + '.lock' )
+ file( :missing => name.sub(/#{basedir}./, '') + '.lock' )
end
FileUtils.cd( basedir ) do
f = ::File.expand_path( name )
eval( ::File.read( f ), nil, f )
@@ -184,11 +197,11 @@
if pr && !pr.dependencies.empty?
locked = GemfileLock.new( lockfile )
has_bundler = gem?( 'bundler' )
profile :gemfile_lock do
activation do
- file( :exists => name + '.lock' )
+ file( :exists => name.sub(/#{basedir}./, '') + '.lock' )
end
done = add_scoped_hull( locked, pr.dependencies )
done += add_scoped_hull( locked, pr.dependencies,
done, :provided )
add_scoped_hull( locked, pr.dependencies, done, :test )
@@ -260,14 +273,13 @@
name = spec.name
end
unless options[ :only_metadata ]
- if ( nil == model.repositories.detect { |r| r.id == 'rubygems-releases' } && options[ :no_rubygems_repo ] != true )
+ if ( nil == model.repositories.detect { |r| r.id == 'rubygems-releases' || r.id == 'mavengems' } && options[ :no_rubygems_repo ] != true )
- repository( 'rubygems-releases',
- 'http://rubygems-proxy.torquebox.org/releases' )
+ repository( 'mavengems', 'mavengem:https://rubygems.org' )
end
@needs_torquebox = true
setup_jruby_plugins_version
end
@@ -668,11 +680,11 @@
if val =~ /jruby[WJ]ar/
if not @current.properties.key?( 'jruby9.plugins.version' ) and
not (@context == :profile and model.properties.key?( 'jruby9.plugins.version' ) )
properties( 'jruby9.plugins.version' => VERSIONS[ :jruby9_plugins ] )
end
- extension 'de.saumya.mojo', 'jruby9-extensions', '${jruby9.plugins.version}'
+ extension 'org.torquebox.mojo', 'jruby9-extensions', '${jruby9.plugins.version}'
build do
directory '${basedir}/pkg'
end
end
end
@@ -693,13 +705,34 @@
def directory( val )
build_method( __method__, val )
end
+ def default_goal( val )
+ build_method( __method__, val )
+ end
+
def output_directory( val )
build_method( __method__, val )
end
+
+ def test_output_directory( val )
+ build_method( __method__, val )
+ end
+
+ def source_directory( val )
+ build_method( __method__, val )
+ end
+
+ def script_source_directory( val )
+ build_method( __method__, val )
+ end
+
+ def test_source_directory( val )
+ build_method( __method__, val )
+ end
+
def repository( *args, &block )
do_repository( :repository=, *args, &block )
end
def plugin_repository( *args, &block )
@@ -801,18 +834,31 @@
end
@current.properties
end
def extension( *args )
+ ext, build = do_extension( *args )
+ build.extensions << ext
+ ext
+ end
+
+ def do_extension( *args )
build = if @context == :build
@current
else
@current.build ||= Build.new
end
args, options = args_and_options( *args )
ext = fill_gav( Extension, args.join( ':' ) )
fill_options( ext, options )
+ [ ext, build ]
+ end
+
+ def extension!( *args )
+ ext, build = do_extension( *args )
+ old = build.extensions.detect { |e| e.group_id == ext.group_id && e.artifact_id == ext.artifact_id }
+ build.extensions.remove( old ) if old
build.extensions << ext
ext
end
def exclusion( *gav )
@@ -824,9 +870,10 @@
def setup_jruby_plugins_version
if not @current.properties.key?( 'jruby.plugins.version' ) and
not (@context == :profile and model.properties.key?( 'jruby.plugins.version' ) )
properties( 'jruby.plugins.version' => VERSIONS[ :jruby_plugins ] )
+ properties( 'mavengem.wagon.version' => VERSIONS[ :mavengem_wagon ] )
end
end
def do_jruby_plugin( method, *gav, &block )
gav[ 0 ] = "de.saumya.mojo:#{gav[ 0 ]}-maven-plugin"