class MetaBuild::Parser::BaseParser
Attributes
source_path[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/meta_build/parser/base_parser.rb, line 8 def initialize(options = {}) @source_path = options[:source_path] end
Public Instance Methods
parse()
click to toggle source
# File lib/meta_build/parser/base_parser.rb, line 12 def parse raise MetaBuild::Exceptions::MetaBuildException.new "#{self.class}.parse must be overridden." end
Protected Instance Methods
_parse()
click to toggle source
# File lib/meta_build/parser/base_parser.rb, line 17 def _parse path = "#{@source_path}/META-INF/maven/**/pom.properties" hash = MetaBuild::Helper::PropertiesHelper.load Dir.glob(path).first if hash.nil? captures = /([-\w\d]+)-([\w\d\.]+)\z/.match(@source_path).captures hash = { 'artifactId' => captures.first, 'version' => captures.last } end data_json = "#{@source_path}/META-INF/data.json" if File.exist? data_json meta_inf = JSON.parse File.read(data_json) hash.merge! meta_inf end hash end