Class: Apadmi::Grout::CommandParsingUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/apadmi/grout/utils/command_parsing_utils.rb

Overview

Generic Command parsing Utils

Class Method Summary collapse

Class Method Details

.determine_build_type(command) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/apadmi/grout/utils/command_parsing_utils.rb', line 12

def self.determine_build_type(command)
  raise "Command can't be blank" if command.blank?

  split = command.split(":", -1).last

  return AndroidBuildType::APK if split.starts_with?("assemble")
  return AndroidBuildType::AAB if split.starts_with?("bundle")

  raise "Could not determine if #{command} generates an apk or aab"
end

.determine_variant(command) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/apadmi/grout/utils/command_parsing_utils.rb', line 23

def self.determine_variant(command)
  raise "Command can't be blank" if command.blank?
  raise "Command can't be blank" if command.strip == ":"

  split = command.split(":", -1).last

  split.delete_prefix("assemble").delete_prefix("bundle")
end