Class: Fastlane::Actions::AndroidGetValueFromBuildAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/android_version_manager/actions/android_get_value_from_build_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



31
32
33
# File 'lib/fastlane/plugin/android_version_manager/actions/android_get_value_from_build_action.rb', line 31

def self.authors
  ["Jonathan Cardoso", "@_jonathancardos", "JCMais"]
end

.available_optionsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/android_version_manager/actions/android_get_value_from_build_action.rb', line 14

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :app_project_dir,
                                 description: "The path to the application source folder in the Android project, the one that contains the build.gradle file (default: android/app)",
                                 optional: true,
                                 type: String,
                                 default_value: "android/app",
                                 verify_block: proc do |value|
                                   # Not using File.exist?("#{value}/build.gradle") because it does not handle globs
                                   UI.user_error!("Couldn't find build.gradle file at path '#{value}'") unless Dir["#{value}/build.gradle"].any?
                                 end),
    FastlaneCore::ConfigItem.new(key: :key,
                                 description: "The property key to retrieve the value from",
                                 type: String),
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/fastlane/plugin/android_version_manager/actions/android_get_value_from_build_action.rb', line 35

def self.is_supported?(platform)
  platform == :android
end

.run(params) ⇒ Object



8
9
10
11
12
# File 'lib/fastlane/plugin/android_version_manager/actions/android_get_value_from_build_action.rb', line 8

def self.run(params)
  app_project_dir ||= params[:app_project_dir]
  value, _line, _line_index = Helper::AndroidVersionManagerHelper.get_key_from_gradle_file("#{app_project_dir}/build.gradle", params[:key])
  return value
end