Class: Fastlane::Actions::GetInfoPlistValueAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/get_info_plist_value.rb

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, details, return_value, sh, step_text

Class Method Details

.authorsObject



51
52
53
# File 'lib/fastlane/actions/get_info_plist_value.rb', line 51

def self.authors
  ["kohtenko"]
end

.available_optionsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/actions/get_info_plist_value.rb', line 29

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :key,
                                 env_name: "FL_GET_INFO_PLIST_PARAM_NAME",
                                 description: "Name of parameter",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "FL_GET_INFO_PLIST_PATH",
                                 description: "Path to plist file you want to read",
                                 optional: false,
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't find plist file at path '#{value}'") unless File.exist?(value)
                                 end)
  ]
end

.descriptionObject



25
26
27
# File 'lib/fastlane/actions/get_info_plist_value.rb', line 25

def self.description
  "Returns value from Info.plist of your project as native Ruby data structures"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/fastlane/actions/get_info_plist_value.rb', line 55

def self.is_supported?(platform)
  [:ios, :mac].include? platform
end

.outputObject



45
46
47
48
49
# File 'lib/fastlane/actions/get_info_plist_value.rb', line 45

def self.output
  [
    ['GET_INFO_PLIST_VALUE_CUSTOM_VALUE', 'The value of the last plist file that was parsed']
  ]
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/actions/get_info_plist_value.rb', line 8

def self.run(params)
  require "plist"

  begin
    path = File.expand_path(params[:path])
    plist = Plist.parse_xml(path)

    value = plist[params[:key]]
    Actions.lane_context[SharedValues::GET_INFO_PLIST_VALUE_CUSTOM_VALUE] = value

    return value
  rescue => ex
    UI.error(ex)
    UI.error("Unable to find plist file at '#{path}'")
  end
end