class Dryrun::ManifestParser

Attributes

launcher_activity[RW]
package[RW]

Public Class Methods

new(manifest_file) click to toggle source
# File lib/dryrun/manifest_parser.rb, line 9
def initialize(manifest_file)
  doc = Oga.parse_xml(manifest_file)

  @package = get_package(doc)
  @launcher_activity = get_launcher_activity(doc)
end

Public Instance Methods

get_launcher_activity(doc) click to toggle source
# File lib/dryrun/manifest_parser.rb, line 20
def get_launcher_activity(doc)
  activities = doc.css('activity')
  activities.each do |child|
    intent_filter = child.css('intent-filter')

    if !intent_filter.nil? && !intent_filter.empty?
      return child.attr('android:name').value
    end
  end
  false
end
get_package(doc) click to toggle source
# File lib/dryrun/manifest_parser.rb, line 16
def get_package(doc)
  doc.xpath('//manifest').attr('package').first.value
end