Sha256: 41c1e0efcfa50e475677e0eb38b6d909875238201a16b40d6ecf4c7cb4b43947

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

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 backed up 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

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

      def self.category
        :misc
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fastlane-2.225.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.224.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.223.1 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.223.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.222.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.221.1 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.221.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.220.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.219.0 fastlane/lib/fastlane/actions/restore_file.rb
fastlane-2.218.0 fastlane/lib/fastlane/actions/restore_file.rb