Class: Fastlane::Helper::GradleHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/helper/gradle_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gradle_path: nil) ⇒ GradleHelper



21
22
23
# File 'lib/fastlane/helper/gradle_helper.rb', line 21

def initialize(gradle_path: nil)
  self.gradle_path = gradle_path
end

Instance Attribute Details

#gradle_pathObject

Path to the gradle script



16
17
18
# File 'lib/fastlane/helper/gradle_helper.rb', line 16

def gradle_path
  @gradle_path
end

#tasksObject

All the available tasks



19
20
21
# File 'lib/fastlane/helper/gradle_helper.rb', line 19

def tasks
  @tasks
end

Instance Method Details

#task_available?(task) ⇒ Boolean



32
33
34
35
# File 'lib/fastlane/helper/gradle_helper.rb', line 32

def task_available?(task)
  load_all_tasks
  return tasks.collect(&:title).include?(task)
end

#trigger(task: nil, flags: nil, serial: nil) ⇒ Object

Run a certain action



26
27
28
29
30
# File 'lib/fastlane/helper/gradle_helper.rb', line 26

def trigger(task: nil, flags: nil, serial: nil)
  android_serial = (serial != "") ? "ANDROID_SERIAL=#{serial}" : nil
  command = [android_serial, gradle_path, task, flags].reject(&:nil?).join(" ")
  Action.sh(command)
end