class Fastlane::Actions::UnsetInfoPlistValueAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 28
def self.authors
  ["Zattoo"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 32
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :key,
                                 env_name: 'FL_SET_INFO_PLIST_PARAM_NAME',
                                 description: 'Name of key in plist',
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: 'FL_SET_INFO_PLIST_PATH',
                                 description: 'Path to plist file you want to update',
                                 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 lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 58
def self.category
  :project
end
description() click to toggle source
# File lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 24
def self.description
  "Unsets value to Info.plist of your project as native Ruby data structures"
end
example_code() click to toggle source
# File lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 52
def self.example_code
  [
    'unset_info_plist_value(path: "./Info.plist", key: "CFBundleIdentifier")'
  ]
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 48
def self.is_supported?(platform)
  %i[ios appletvos mac].include?(platform)
end
run(params) click to toggle source
# File lib/fastlane/plugin/unsetinfoplistvalue/actions/unset_info_plist_value_action.rb, line 7
def self.run(params)
  require 'plist'

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

    plist.delete(params[:key])

    new_plist = Plist::Emit.dump(plist)
    File.write(path, new_plist)
  rescue StandardError => ex
    UI.error(ex)
    UI.user_error!("Unable to unset key '#{params[:key]}' the plist file at '#{path}'")
  end
end