class Fastlane::Actions::UpdateSettingsBundleAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 68 def self.available_options [ # Required parameters FastlaneCore::ConfigItem.new(key: :key, env_name: "SETTINGS_BUNDLE_KEY", description: "The user defaults key to update in the settings bundle", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :value, env_name: "SETTINGS_BUNDLE_VALUE", description: "Value to set with optional :version and :build included", optional: false, type: String), # Optional parameters FastlaneCore::ConfigItem.new(key: :xcodeproj, env_name: "SETTINGS_BUNDLE_XCODEPROJ", description: "An Xcode project file whose settings bundle to update", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :configuration, env_name: "SETTINGS_BUNDLE_CONFIGURATION", description: "The build configuration to use for the Info.plist file", optional: true, default_value: "Release", type: String), FastlaneCore::ConfigItem.new(key: :file, env_name: "SETTINGS_BUNDLE_FILE", description: "The plist file in the Settings.bundle to update", optional: true, default_value: "Root.plist", type: String), FastlaneCore::ConfigItem.new(key: :bundle_name, env_name: "SETTINGS_BUNDLE_BUNDLE_NAME", description: "The name of the settings bundle in the project (default Settings.bundle)", optional: true, default_value: "Settings.bundle", type: String), FastlaneCore::ConfigItem.new(key: :target, env_name: "SETTINGS_BUNDLE_TARGET", description: "An optional target name from the project", optional: true, type: String) ] end
category()
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 170 def self.category :project end
description()
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 52 def self.description "Fastlane plugin action to update static settings in an iOS settings bundle" end
details()
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 60 def self.details "This action is used to automatically update a Title entry in a plist\n" \ "in an app's Settings bundle. It can be used to update the current\n" \ "version and/or build number automatically after they have been \n" \ "updated, e.g. by the increment_version_number or increment_build_number\n" \ "actions." end
example_code()
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 114 def self.example_code [ <<-EOF update_settings_bundle( key: "CurrentAppVersion", value: ":version (:build)" ) EOF, <<-EOF update_settings_bundle( xcodeproj: "MyProject.xcodeproj", key: "CurrentAppVersion", value: ":version (:build)" ) EOF, <<-EOF update_settings_bundle( file: "About.plist", key: "CurrentAppVersion", value: ":version (:build)" ) EOF, <<-EOF update_settings_bundle( key: "BuildDate", value: Time.now.strftime("%Y-%m-%d") ) EOF, <<-EOF update_settings_bundle( key: "CurrentAppVersion", value: ":version (:build)", configuration: "Debug" ) EOF, <<-EOF update_settings_bundle( key: "CurrentAppVersion", value: ":version (:build)", target: "MyAppTarget" ) EOF, <<-EOF update_settings_bundle( key: "CurrentAppVersion", value: ":version (:build)", bundle_name: "MySettings.bundle" ) EOF ] end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 166 def self.is_supported?(platform) platform == :ios end
run(params)
click to toggle source
# File lib/fastlane/plugin/settings_bundle/actions/update_settings_bundle_action.rb, line 24 def self.run(params) key = params[:key] configuration = params[:configuration] target_name = params[:target] file = params[:file] value = params[:value] helper = Helper::SettingsBundleHelper xcodeproj_path = helper.xcodeproj_path_from_params params # Error already reported in helper return if xcodeproj_path.nil? # try to open project file (raises) project = Xcodeproj::Project.open xcodeproj_path # raises settings = helper.settings_from_project project, configuration, target_name formatted_value = helper.formatted_value value, settings # raises helper.update_settings_plist_title_setting project, params[:bundle_name], file, key, formatted_value rescue StandardError => e UI.user_error! "#{e.message}\n#{e.backtrace}" end