Sha256: 7f749b92bfc3b5e31b0e2f1731225f7834a6d17e1a9dda0378c0c94f80cb6299

Contents?: true

Size: 1.92 KB

Versions: 3

Compression:

Stored size: 1.92 KB

Contents

namespace :backup do

  desc "Run Backup Procedure."
  task :run => :environment do
    puts "Running: #{ENV['trigger']}."
    Backup::Setup.new(ENV['trigger'], @backup_procedures).initialize_adapter
  end
  
  desc "Finds backup records by trigger"
  task :find => :environment do
    puts "Finding backup records with trigger: #{ENV['trigger']}."
    backup = Backup::Setup.new(ENV['trigger'], @backup_procedures)
    records = backup.procedure.record_class.all( :conditions => {:trigger => ENV['trigger']} )
    
    if ENV['table'].eql?("true")
      puts Hirb::Helpers::AutoTable.render(records)
    else
      records.each do |record|
        puts record.to_yaml
      end
    end
  end
  
  desc "Truncates all records for the specified \"trigger\", excluding the physical files on s3 or the remote server."
  task :truncate => :environment do
    puts "Truncating backup records with trigger: #{ENV['trigger']}."
    Backup::Record::Base.destroy_all :trigger => ENV['trigger']
  end
  
  desc "Truncates everything."
  task :truncate_all => :environment do
    puts "Truncating all backup records."
    Backup::Record::Base.destroy_all
  end
  
  desc "Destroys all records for the specified \"trigger\", including the physical files on s3 or the remote server."
  task :destroy => :environment do
    puts "Destroying backup records with trigger: #{ENV['trigger']}."
    backup = Backup::Setup.new(ENV['trigger'], @backup_procedures)
    backup.procedure.record_class.destroy_all_backups( backup.procedure, ENV['trigger'] )
  end
  
  desc "Destroys all records for the specified \"trigger\", including the physical files on s3 or the remote server."
  task :destroy_all => :environment do
    puts "Destroying all backup records."
    backup = Backup::Setup.new(false, @backup_procedures)
    backup.procedures.each do |backup_procedure|
      backup_procedure.record_class.destroy_all_backups( backup_procedure, backup_procedure.trigger )
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
backup-2.3.3.1 generators/backup/templates/tasks/backup.rake
backup-2.3.3 generators/backup/templates/tasks/backup.rake
backup-2.3.2 generators/backup/templates/tasks/backup.rake