Class: Fastlane::Actions::RestoreFileAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/restore_file.rb

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, details, output, sh, step_text

Class Method Details

.authorObject



21
22
23
# File 'lib/fastlane/actions/restore_file.rb', line 21

def self.author
  "gin0606"
end

.available_optionsObject



25
26
27
28
29
30
31
# File '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

.descriptionObject



13
14
15
# File '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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/fastlane/actions/restore_file.rb', line 17

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/fastlane/actions/restore_file.rb', line 4

def self.run params
  path = params[:path]
  backup_path = "#{path}.back"
  raise "Could not find file '#{backup_path}'" unless File.exist? backup_path
  FileUtils.cp(backup_path, path, {preserve: true})
  FileUtils.rm(backup_path)
  Helper.log.info "Successfully restored backup 📤"
end