class Fastlane::Actions::RestoreFileAction

Public Class Methods

author() click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 21
def self.author
  "gin0606"
end
available_options() click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 25
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "Original file name you want to restore",
                                 optional: false)
  ]
end
category() click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 39
def self.category
  :misc
end
description() click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 13
def self.description
  'This action restore your file that was backuped with the `backup_file` action'
end
example_code() click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 33
def self.example_code
  [
    'restore_file(path: "/path/to/file")'
  ]
end
is_supported?(platform) click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 17
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File fastlane/lib/fastlane/actions/restore_file.rb, line 4
def self.run(params)
  path = params[:path]
  backup_path = "#{path}.back"
  UI.user_error!("Could not find file '#{backup_path}'") unless File.exist?(backup_path)
  FileUtils.cp(backup_path, path, preserve: true)
  FileUtils.rm(backup_path)
  UI.message("Successfully restored backup 📤")
end