class Fastlane::Actions::GetInfoPlistValueAction

Public Class Methods

authors() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 55
def self.authors
  ["kohtenko"]
end
available_options() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 33
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
category() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 73
def self.category
  :project
end
description() click to toggle source
# File fastlane/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
details() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 29
def self.details
  "Get a value from a plist file, which can be used to fetch the app identifier and more information about your app"
end
example_code() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 63
def self.example_code
  [
    'identifier = get_info_plist_value(path: "./Info.plist", key: "CFBundleIdentifier")'
  ]
end
is_supported?(platform) click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 59
def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end
output() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 49
def self.output
  [
    ['GET_INFO_PLIST_VALUE_CUSTOM_VALUE', 'The value of the last plist file that was parsed']
  ]
end
return_type() click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 69
def self.return_type
  :string
end
run(params) click to toggle source
# File fastlane/lib/fastlane/actions/get_info_plist_value.rb, line 8
def self.run(params)
  require "plist"

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

    plist = File.open(path) { |f| Plist.parse_xml(f) }

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

    return value
  rescue => ex
    UI.error(ex)
  end
end