Class: Mvnizer::CoordinateParser
- Inherits:
-
Object
- Object
- Mvnizer::CoordinateParser
- Defined in:
- lib/mvnizer/coordinate_parser.rb
Instance Method Summary collapse
-
#parse(coordinates) ⇒ Object
Parse the coordinates of an artifact.
-
#parse_scoped_coordinates(coordinates) ⇒ Object
Parse the coordinates of a dependency, i.e.
Instance Method Details
#parse(coordinates) ⇒ Object
Parse the coordinates of an artifact.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mvnizer/coordinate_parser.rb', line 4 def parse(coordinates) p = nil # When no group and type is given if coordinates =~ /\A([a-zA-Z][\w\.\-]+)(:(\d+\.\d+\.\d(\-\w+)?))?:(war|jar|pom)/ p = Project.new(nil, $1, $3, $5) else coordinates.scan(/(([a-zA-Z][\w\.\-]+):)?([a-zA-Z][\w\.\-]+)(:(\d+\.\d+\.\d(\-\w+)?))?(:(war|jar|pom))?/) do |i,g,a,v0,v,m,t0,t| p = Project.new(g, a, v, t) end end p end |
#parse_scoped_coordinates(coordinates) ⇒ Object
Parse the coordinates of a dependency, i.e. that include the scope (test, compile, provided, runtime, system or import)
21 22 23 24 25 26 27 |
# File 'lib/mvnizer/coordinate_parser.rb', line 21 def parse_scoped_coordinates(coordinates) p = nil if coordinates =~ /\A(([a-zA-Z][\w\.\-]+):)?([a-zA-Z][\w\.\-]+)(:(\d+\.\d+(\.\d)?(\-\w+)?))?:(war|jar|pom):?(test|compile|provided|runtime|system|import)?/ p = Project.new($2, $3, $5, $8, [], $9) end p end |