Class: Source::PomFileReader
- Includes:
- HasDirectories, HasOptionMethods
- Defined in:
- lib/gpm/source/maven.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes included from HasOptionMethods
Instance Method Summary collapse
- #effective_pom ⇒ Object
-
#initialize(pomfile, options) ⇒ PomFileReader
constructor
A new instance of PomFileReader.
- #raw_pom ⇒ Object
- #read ⇒ Object
- #tempfile ⇒ Object
Methods included from HasOptionMethods
Methods included from HasDirectories
Constructor Details
#initialize(pomfile, options) ⇒ PomFileReader
Returns a new instance of PomFileReader.
10 11 12 13 14 |
# File 'lib/gpm/source/maven.rb', line 10 def initialize(pomfile,) @logger = create_logger @options = @pomfile = pomfile end |
Instance Method Details
#effective_pom ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gpm/source/maven.rb', line 28 def effective_pom result = tempfile extracted_pom = raw_pom @logger.info "Invoking maven to generate effective POM in : mvn help:effective-pom -Doutput=#{result} -f #{extracted_pom}" mvn_output = `mvn help:effective-pom -Doutput=#{File.join(File.(Dir.getwd),result)} -f #{extracted_pom}` exit_code = $? unless exit_code.to_i == 0 @logger.error "Maven failed with exit status #{exit_code}." @logger.error "Maven output was:\n==========\n#{mvn_output}" raise "Failed to invoke maven to generate effective pom." end result end |
#raw_pom ⇒ Object
24 25 26 |
# File 'lib/gpm/source/maven.rb', line 24 def raw_pom @pomfile end |
#read ⇒ Object
18 19 20 21 22 |
# File 'lib/gpm/source/maven.rb', line 18 def read in_directory work_dir do XmlSimple.xml_in(effective_pom) end end |
#tempfile ⇒ Object
42 43 44 |
# File 'lib/gpm/source/maven.rb', line 42 def tempfile "effective_pom.xml" end |