Skip to content

Instantly share code, notes, and snippets.

@gin0606
Created June 26, 2015 07:59
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 gin0606/5f1621be3535823f789a to your computer and use it in GitHub Desktop.
Save gin0606/5f1621be3535823f789a to your computer and use it in GitHub Desktop.
module Fastlane
module Actions
class BackupInfoPlistAction < Action
def self.run params
plist_path = params[:plist_path]
FileUtils.cp(plist_path, "#{plist_path}.back", {:preserve => true})
end
def self.details
'This action backup your "Info.plist".'
end
def self.is_supported?(platform)
true
end
def self.author
"gin0606"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :plist_path,
env_name: "",
description: "File name you want to back up",
optional: false),
]
end
end
end
end
module Fastlane
module Actions
class RestoreInfoPlistAction < Action
def self.run params
plist_path = params[:plist_path]
backup_plist_path = "#{plist_path}.back"
raise "not exist #{backup_plist_path}" unless File.exist? backup_plist_path
FileUtils.cp(backup_plist_path, plist_path, {:preserve => true})
FileUtils.rm(backup_plist_path)
end
def self.details
'This action restore your "Info.plist" that backuped in `backup_info_plist` action.'
end
def self.is_supported?(platform)
true
end
def self.author
"gin0606"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :plist_path,
env_name: "",
description: "Original file name you want to restore",
optional: false),
]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment