Class: FIR::Parser::AabAnalysis

Inherits:
Object
  • Object
show all
Defined in:
lib/fir/util/parser/aab_analysis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aab_file, bundletool_jar_path = nil, auto_download_bundletool_jar = false) ⇒ AabAnalysis

Returns a new instance of AabAnalysis.



9
10
11
12
13
# File 'lib/fir/util/parser/aab_analysis.rb', line 9

def initialize(aab_file, bundletool_jar_path = nil, auto_download_bundletool_jar = false)
  @aab_file = aab_file
  @bundletool_jar_path = bundletool_jar_path
  @auto_download_bundletool_jar = auto_download_bundletool_jar
end

Instance Attribute Details

#aab_fileObject

Returns the value of attribute aab_file.



8
9
10
# File 'lib/fir/util/parser/aab_analysis.rb', line 8

def aab_file
  @aab_file
end

#auto_download_bundletool_jarObject

Returns the value of attribute auto_download_bundletool_jar.



8
9
10
# File 'lib/fir/util/parser/aab_analysis.rb', line 8

def auto_download_bundletool_jar
  @auto_download_bundletool_jar
end

#bundletool_jar_pathObject

Returns the value of attribute bundletool_jar_path.



8
9
10
# File 'lib/fir/util/parser/aab_analysis.rb', line 8

def bundletool_jar_path
  @bundletool_jar_path
end

#head_xmlObject

Returns the value of attribute head_xml.



8
9
10
# File 'lib/fir/util/parser/aab_analysis.rb', line 8

def head_xml
  @head_xml
end

Instance Method Details

#infoObject



15
16
17
18
19
# File 'lib/fir/util/parser/aab_analysis.rb', line 15

def info
  insure_exists_bundlebool # 确保bundlebool 正常
  fetch_first_xml # 读取生成的第一句
  read_from_xml # 读取有用的的信息
end

#read_from_xmlObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/fir/util/parser/aab_analysis.rb', line 21

def read_from_xml
  # 不到迫不得已 不要引用Nokogiri, 免得又装不来依赖
  {
    type: 'android',
    name: "AAB #{File.basename(@aab_file)}",
    identifier: read_from_attribute('package'),
    build: read_from_attribute('versionCode'),
    version: read_from_attribute('versionName')
  }
end