Class: Parsing
- Inherits:
-
Object
- Object
- Parsing
- Defined in:
- lib/utilities/parsing.rb
Class Method Summary collapse
- .generate_options_from_yaml(yaml_c) ⇒ Object
- .modify_yaml_attrs ⇒ Object
- .parse(file_location = nil, test = false) ⇒ Object
- .parse_config_file(file_location) ⇒ Object
- .variable_set(options = {}) ⇒ Object
Class Method Details
.generate_options_from_yaml(yaml_c) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/utilities/parsing.rb', line 25 def self.(yaml_c) = {} [:apk] = yaml_c["apk"] [:apktool] = yaml_c["apktool"] [:output_directory] = yaml_c["output_directory"] [:d2j] = yaml_c["d2j"] return end |
.modify_yaml_attrs ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/utilities/parsing.rb', line 16 def self.modify_yaml_attrs yaml_c = { "apk" => ENV["APK"], "apktool" => ENV["APKTOOL"], "output_directory" => ENV["OUTPUT_DIR"], "d2j" => ENV["DEX2JAR"] } end |
.parse(file_location = nil, test = false) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/utilities/parsing.rb', line 5 def self.parse(file_location=nil, test=false) raise "NoFileProvidedForParsing" if !(file_location) yaml_c = test ? modify_yaml_attrs : parse_config_file(file_location) opts = (yaml_c) variable_set(opts) end |
.parse_config_file(file_location) ⇒ Object
12 13 14 |
# File 'lib/utilities/parsing.rb', line 12 def self.parse_config_file(file_location) yaml_c = YAML.load_file(file_location) end |
.variable_set(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/utilities/parsing.rb', line 34 def self.variable_set(={}) Decompiler.set_static_vars() apk_loc = [:apk] if apk_loc.kind_of?(String) Decompiler.set_apk_var(apk_loc) Decompiler.execute elsif apk_loc.kind_of?(Array) apk_loc.each do |apkl| Decompiler.set_apk_var(apkl) Decompiler.execute end end end |