Skip to content

Instantly share code, notes, and snippets.

@plrthink
Created October 10, 2018 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plrthink/2cb58ac600b7864bb2638d34cfd6f688 to your computer and use it in GitHub Desktop.
Save plrthink/2cb58ac600b7864bb2638d34cfd6f688 to your computer and use it in GitHub Desktop.
fastlane action to correct app name in manifest.plist
module Fastlane
module Actions
module SharedValues
end
class CorrectAppNameAction < Action
def self.run(params)
# you need to install the plist gem
require 'plist'
if params[:app_name]
# change the path to anywhere you want
manifest_plist_path = File.join(File.dirname(__FILE__), "../../../server/public/ipas", params[:plist_folder], "manifest.plist")
raise "Couldn't find info plist file at path '#{manifest_plist_path}'".red unless File.exist?(manifest_plist_path)
plist = Plist.parse_xml(manifest_plist_path)
plist['items'][0]['metadata']['title'] = params[:app_name]
plist_string = Plist::Emit.dump(plist)
File.write(manifest_plist_path, plist_string)
UI.success("Updated #{plist} 💾.")
plist_string
else
UI.important("You haven't specified app name.")
false
end
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"correct app name in export options"
end
def self.details
"You can use this action to do cool things..."
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :app_name,
env_name: "FL_CORRECT_APP_NAME",
description: "App name"),
FastlaneCore::ConfigItem.new(key: :plist_folder,
env_name: "FL_CORRECT_APP_NAME",
description: "App name")
]
end
def self.output
end
def self.return_value
end
def self.authors
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment