Sha256: e3ce630a3e1000ad36cfc020311eb480e22372c69e30b6c31094650b4774f5a0

Contents?: true

Size: 430 Bytes

Versions: 4

Compression:

Stored size: 430 Bytes

Contents

module AwsRotate
  class Backup < Base
    def run
      return if @options[:noop] || @options[:backup] == false
      return unless credentials_exist?
      backup_path = @credentials_path + ".bak-#{Time.now.strftime("%F-%T")}"
      FileUtils.cp(@credentials_path, backup_path)
      puts "Backed up credentials file at: #{backup_path}"
    end

    def credentials_exist?
      File.exist?(@credentials_path)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aws-rotate-0.4.0 lib/aws_rotate/backup.rb
aws-rotate-0.3.0 lib/aws_rotate/backup.rb
aws-rotate-0.2.0 lib/aws_rotate/backup.rb
aws-rotate-0.1.0 lib/aws_rotate/backup.rb