class MetaBuild::Parser::WarParser

Constants

MODULES

Public Instance Methods

parse() click to toggle source
# 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