class Fastlane::Actions::UserDefaultGetAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 21
def self.authors
  ["zhangqi"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 34
def self.available_options
  [
    # FastlaneCore::ConfigItem.new(key: :your_option,
    #                         env_name: "USER_DEFAULT_GET_YOUR_OPTION",
    #                      description: "A description of your option",
    #                         optional: false,
    #                             type: String)
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "user_default_path_get", # The name of the environment variable
                                 description: "Path for user default", # a short description of this parameter
                                 default_value: "build/.configure.fastlane",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :key,
                                 env_name: "user_default_key_get",
                                 description: "key for user default",
                                 is_string: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("No key for UserDefaultGetAction , pass using `key: 'key'`") unless (value and not value.empty?)
                                         # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
                                 end)


  ]
end
description() click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 17
def self.description
  "get value like ios userDefault"
end
details() click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 29
def self.details
  # Optional:
  "get value from the path configure"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 59
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  return [:ios, :mac, :android].include?(platform)
end
return_value() click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 25
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/user_default_get/actions/user_default_get_action.rb, line 4
def self.run(params)
  UI.message("The user_default_get plugin is working!")
  path = params[:path]
  map = Hash.new
  if File.exist? path
    json_string = File.read(path)
    json = JSON.parse(json_string)
    map = json if json.is_a? Hash
  end
  key = params[:key]
  return map[key]
end