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

Returns a new instance of GradleHelper.



24
25
26
# File 'lib/fastlane/helper/gradle_helper.rb', line 24

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

Instance Attribute Details

#escaped_gradle_pathObject (readonly)

Read-only path to the shell-escaped gradle script, suitable for use in shell commands



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

def escaped_gradle_path
  @escaped_gradle_path
end

#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



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

def tasks
  @tasks
end

Instance Method Details

#task_available?(task) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/fastlane/helper/gradle_helper.rb', line 35

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

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

Run a certain action



29
30
31
32
33
# File 'lib/fastlane/helper/gradle_helper.rb', line 29

def trigger(task: nil, flags: nil, serial: nil, print_command: true, print_command_output: true)
  android_serial = (serial != "") ? "ANDROID_SERIAL=#{serial}" : nil
  command = [android_serial, escaped_gradle_path, task, flags].compact.join(" ")
  Action.sh(command, print_command: print_command, print_command_output: print_command_output)
end