Sha256: 1b0135560bb66a5917cc4ea0f71f3d2ae916fea686f5934dd9cd977b0f438462

Contents?: true

Size: 940 Bytes

Versions: 13

Compression:

Stored size: 940 Bytes

Contents

module Fastlane
  module Actions
    class RestoreFileAction < Action
      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

      def self.description
        'This action restore your file that was backuped with the `backup_file` action'
      end

      def self.is_supported?(platform)
        true
      end

      def self.author
        "gin0606"
      end

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fastlane-1.104.0 lib/fastlane/actions/restore_file.rb
fastlane-1.103.0 lib/fastlane/actions/restore_file.rb
fastlane-1.102.0 lib/fastlane/actions/restore_file.rb
fastlane-1.101.0 lib/fastlane/actions/restore_file.rb
fastlane-1.100.0 lib/fastlane/actions/restore_file.rb
fastlane-1.99.0 lib/fastlane/actions/restore_file.rb
fastlane-1.98.0 lib/fastlane/actions/restore_file.rb
fastlane-1.97.2 lib/fastlane/actions/restore_file.rb
fastlane-1.97.1 lib/fastlane/actions/restore_file.rb
fastlane-1.97.0 lib/fastlane/actions/restore_file.rb
fastlane-1.96.0 lib/fastlane/actions/restore_file.rb
fastlane-1.95.0 lib/fastlane/actions/restore_file.rb
fastlane-1.94.1 lib/fastlane/actions/restore_file.rb