Class: Fastlane::Actions::BackupFileAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, deprecated_notes, details, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorObject



18
19
20
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 18

def self.author
  "gin0606"
end

.available_optionsObject



22
23
24
25
26
27
28
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 22

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "Path to the file you want to backup",
                                 optional: false)
  ]
end

.categoryObject



36
37
38
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 36

def self.category
  :misc
end

.descriptionObject



10
11
12
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 10

def self.description
  'This action backs up your file to "[path].back"'
end

.example_codeObject



30
31
32
33
34
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 30

def self.example_code
  [
    'backup_file(path: "/path/to/file")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



14
15
16
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 14

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
# File 'fastlane/lib/fastlane/actions/backup_file.rb', line 4

def self.run(params)
  path = params[:path]
  FileUtils.cp(path, "#{path}.back", preserve: true)
  UI.message("Successfully created a backup 💾")
end