class Fastlane::Actions::RemoveSettingAction

Public Class Methods

author() click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 49
def self.author
  'Colin Harris'
end
available_options() click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 59
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),

    # 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: :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)
  ]
end
category() click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 121
def self.category
  :project
end
description() click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 45
def self.description
  'Fastlane plugin action to remove settings in an iOS settings bundle'
end
details() click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 53
def self.details
  "This action is used to automatically delete an entry \n" \
    "in an app's Settings bundle. It can be used to remove settings \n." \
    "that you do not want to make available in some environments."
end
example_code() click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 89
      def self.example_code
        [
          <<-EOF
            remove_setting(
              key: "ItemToRemove"
            )
          EOF,
          <<-EOF
            remove_setting(
              xcodeproj: "MyProject.xcodeproj",
              key: "ItemToRemove",
            )
          EOF,
          <<-EOF
            remove_setting(
              file: "About.plist",
              key: "ItemToRemove"
            )
          EOF,
          <<-EOF
            remove_setting(
              key: "ItemToRemove",
              bundle_name: "MySettings.bundle"
            )
          EOF
        ]
      end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 117
def self.is_supported?(platform)
  platform == :ios
end
run(params) click to toggle source
# File lib/fastlane/plugin/remove_setting/actions/remove_setting_action.rb, line 25
def self.run(params)
  key = params[:key]
  file = params[:file]

  bundleHelper = Fastlane::Helper::SettingsBundleHelper
  helper = Helper::RemoveSettingHelper

  xcodeproj_path = bundleHelper.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
  helper.remove_setting project, params[:bundle_name], file, key
rescue => e
  UI.user_error! "#{e.message}\n#{e.backtrace}"
end