lib/maven/tools/artifact.rb in maven-tools-0.34.5 vs lib/maven/tools/artifact.rb in maven-tools-1.0.0.rc2

- old
+ new

@@ -30,11 +30,11 @@ class Helper include Coordinate end def self.new_local( path, type, options = {} ) - name = File.basename( path ).sub( /.#{type}$/, '' ) + name = ::File.basename( path ).sub( /.#{type}$/, '' ) if ind = name.rindex( '-' ) version = name[ind + 1..-1] name = name[0..ind - 1] else version = '0' @@ -75,21 +75,27 @@ # jar "asd:Asd",'>123', '<345' # jar "asd:Asd:test",'>123', '<345' # jar "asd:Asd:[dsa:rew,fe:fer]",'>123', '<345' # jar "asd:Asd:test:[dsa:rew,fe:fer]",'>123', '<345' # jar "asd:Asd:test:[dsa:rew,fe:fer]", '123', 'source' - v = helper.to_version( *args[1..-1] ) - case v - when String - group_id, artifact_id, classifier, exclusions = args[0].split( /:/ ) - self.new( group_id, artifact_id, type, - v, classifier, exclusions, - options ) + if args[ 0 ].match /:/ + v = helper.to_version( *args[1..-1] ) + case v + when String + group_id, artifact_id, classifier, exclusions = args[0].split( /:/ ) + self.new( group_id, artifact_id, type, + v, classifier, exclusions, + options ) + else + group_id, artifact_id = args[0].split( /:/ ) + self.new( group_id, artifact_id, type, + args[1], args[2], nil, + options ) + end else - group_id, artifact_id = args[0].split( /:/ ) - self.new( group_id, artifact_id, type, - args[1], args[2], nil, - options ) + self.new( args[ 0 ], args[ 1 ], type, + args[ 2 ], nil, nil, + options ) end else nil end end