lib/maven/tools/dsl.rb in maven-tools-0.34.1 vs lib/maven/tools/dsl.rb in maven-tools-0.34.2

- old
+ new

@@ -15,10 +15,20 @@ @model.group_id = 'dummy' @model.artifact_id = model.name @model.version = '0.0.0' @context = :project nested_block( :project, @model, block ) if block + if @needs_torquebox + if ! @model.repositories.detect { |r| r.id == 'rubygems-prereleases' } && @model.dependencies.detect { |d| d.group_id == 'rubygems' && d.version.match( /[a-zA-Z]/ ) } + + @current = @model + snapshot_repository( 'http://rubygems-proxy.torquebox.org/prereleases', + :id => 'rubygems-prereleases' ) + @current = nil + end + @needs_torquebox = nil + end result = @model @context = nil @model = nil result end @@ -135,15 +145,11 @@ unless model.repositories.detect { |r| r.id == 'rubygems-releases' } repository( 'http://rubygems-proxy.torquebox.org/releases', :id => 'rubygems-releases' ) end - if ! model.repositories.detect { |r| r.id == 'rubygems-prereleases' } && model.dependencies.detect { |d| d.group_id == 'rubygems' && d.version.match( /[a-zA-Z]/ ) } - - snapshot_repository( 'http://rubygems-proxy.torquebox.org/prereleases', - :id => 'rubygems-prereleases' ) - end + @needs_torquebox = true setup_jruby_plugins_version end if options.key?( :jar ) || options.key?( 'jar' ) @@ -184,11 +190,11 @@ warn 'jruby version below 1.7 uses jruby-complete' jar 'org.jruby:jruby-core', jruby elsif ( jruby < '1.7.5' ) jar 'org.jruby:jruby-core', jruby else - jar 'org.jruby:jruby', jruby + jar 'org.jruby:jruby-noasm', jruby end end end private :setup_jruby @@ -503,21 +509,23 @@ def plugin_repository( url, options = {}, &block ) do_repository( :plugin, url, options, block ) end def snapshot_repository( url, options = {}, &block ) - options[ :releases ] = false unless options.key?( :releases ) || options.key?( 'releases' ) - options[ :snapshots ] = true unless options.key?( :snapshots ) || options.key?( 'snapshots' ) + unless @current.respond_to? :snapshot_repository= + options[ :releases ] = false unless options.key?( :releases ) || options.key?( 'releases' ) + options[ :snapshots ] = true unless options.key?( :snapshots ) || options.key?( 'snapshots' ) + end do_repository( :snapshot_repository=, url, options, block ) end def releases( config ) - @current.releases = respository_policy( config ) + @current.releases = repository_policy( config ) end def snapshots( config ) - @current.snapshots = respository_policy( config ) + @current.snapshots = repository_policy( config ) end def repository_policy( config ) rp = RepositoryPolicy.new case config @@ -793,13 +801,17 @@ type = a[ :type ] options = a else a = ::Maven::Tools::Artifact.from( type, *args ) end + options ||= {} d = fill_gav( Dependency, a ? a.gav : args.join( ':' ) ) d.type = type.to_s + # TODO maybe copy everything from options ? + d.scope = options[ :scope ] if options[ :scope ] + d.system_path = options[ :system_path ] if options[ :system_path ] d end def dependency_container if @context == :overrides @@ -844,9 +856,10 @@ d.exclusions << fill_gav( Exclusion, v ) end when String d.exclusions << fill_gav( Exclusion, exclusions ) end + options.each do |k,v| d.send( "#{k}=".to_sym, v ) unless d.send( k.to_sym ) end end d