Class: MetaBuild::Parser::WarParser

Inherits:
BaseParser show all
Defined in:
lib/meta_build/parser/war_parser.rb

Constant Summary collapse

MODULES =
{
  'siefdau-web' => 'sdau',
  'rdoc-web' => 'rdoc',
  'cobra-web' => 'cobra',
  'tdecis-web' => 'tdcs',
  'precadin-web' => 'pcad',
  'mpct-web' => 'overlay',
  'sic-web' => 'sic'
}

Instance Attribute Summary

Attributes inherited from BaseParser

#source_path

Instance Method Summary collapse

Methods inherited from BaseParser

#initialize

Constructor Details

This class inherits a constructor from MetaBuild::Parser::BaseParser

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/meta_build/parser/war_parser.rb', line 16

def parse
  path = "#{@source_path}/META-INF/maven/**/pom.properties"
  hash = Hash.new

  Dir.glob(path).each do |pom|
    pieces = pom.split(File::SEPARATOR)
    _module = pieces[pieces.size - 2]
    hash[MODULES[_module]] = MetaBuild::Helper::PropertiesHelper.load(pom)
  end

  path = "#{@source_path}/public/**/data.json"

  Dir.glob(path).each do |data_json|
    meta_inf = JSON.parse File.read(data_json)
    
    pieces = data_json.split(File::SEPARATOR)
    _module = pieces[pieces.size - 2]
    _module = MODULES['mpct-web'] if _module == 'public'

    if hash[_module]
      hash[_module].merge! meta_inf
    else
      hash[_module] = meta_inf
    end
  end

  hash
end