Class: Horatio::Detector::Maven
- Inherits:
-
Object
- Object
- Horatio::Detector::Maven
- Defined in:
- lib/horatio/detector/maven.rb
Instance Attribute Summary
Attributes included from IOHandler
Instance Method Summary collapse
- #default_input ⇒ Object
- #description ⇒ Object
- #info ⇒ Object
- #name ⇒ Object
-
#version ⇒ Object
Maven version reader.
Methods included from IOHandler
#default_output, #detect, included, #initialize, #memo_read
Methods included from Validator
#validate, #validate_name, #validate_version
Instance Method Details
#default_input ⇒ Object
13 14 15 |
# File 'lib/horatio/detector/maven.rb', line 13 def default_input 'pom.xml' end |
#description ⇒ Object
43 44 45 |
# File 'lib/horatio/detector/maven.rb', line 43 def description 'JAVA Maven pom.xml' end |
#info ⇒ Object
17 18 19 20 21 |
# File 'lib/horatio/detector/maven.rb', line 17 def info memo_read do File.open('pom.xml', 'r') { |f| Nori.new.parse(f.read) } end end |
#name ⇒ Object
23 24 25 |
# File 'lib/horatio/detector/maven.rb', line 23 def name info['project']['artifactId'] end |
#version ⇒ Object
Maven version reader
We need to decrease the number if we see SNAPSHOT, this is becasue maven increments it in anticipation for the next build
33 34 35 36 37 38 39 40 41 |
# File 'lib/horatio/detector/maven.rb', line 33 def version version = info['project']['version'] || info['project']['parent']['version'] return version unless version =~ /-SNAPSHOT$/ version = version.split('-')[0] version = version.split('.') minor = version.last.to_i > 1 ? version.last.to_i - 1 : version.last version[-1] = minor version.join('.') end |