Class: Source::PomFromWarFileReader
- Inherits:
-
PomFileReader
- Object
- PomFileReader
- Source::PomFromWarFileReader
- Defined in:
- lib/gpm/source/war.rb
Constant Summary collapse
- POM_FILE_NAME =
%r{^META-INF/maven/.*/pom\.xml$}
Instance Attribute Summary
Attributes included from HasOptionMethods
Instance Method Summary collapse
-
#initialize(warfile, options) ⇒ PomFromWarFileReader
constructor
A new instance of PomFromWarFileReader.
- #raw_pom ⇒ Object
Methods inherited from PomFileReader
#effective_pom, #read, #tempfile
Methods included from HasOptionMethods
Methods included from HasDirectories
Constructor Details
#initialize(warfile, options) ⇒ PomFromWarFileReader
Returns a new instance of PomFromWarFileReader.
10 11 12 13 |
# File 'lib/gpm/source/war.rb', line 10 def initialize(warfile,) super(nil,) @warfile=warfile end |
Instance Method Details
#raw_pom ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gpm/source/war.rb', line 15 def raw_pom @logger.info "Extracting raw pom from #{warfile}..." Archive::Zip.open(warfile) do |f| #inspect war file to find pom.xml pom_file_entries = f.select { |entry| entry.ftype == :file && entry.zip_path =~ POM_FILE_NAME } raise "Wrong number of POM files (#{pom_file_entries.size}):\n #{pom_file_entries.join("\n")}" unless pom_file_entries.size == 1 #Write it to temporary file to maven can use it extract_target = Tempfile.new("from_pom", work_dir).path pom_file_entries.first.extract(:file_path => extract_target) #Return the name of the temporary file extract_target end end |