Sha256: 2a08346ae55bc506aef7ba3b4374d5ada06a5ea05594443bc0f27a28d08ea01c

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

namespace :backup do
  desc 'Setup backup.'
  task :setup do
    on roles(:app) do
      puts 'Creating backup model.'

      # Check model is exist
      full_path = "/home/#{fetch(:local_user)}/Backup/models/#{fetch(:application)}.rb"
      if 'true' ==  capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
        execute "mv #{full_path} #{full_path}.#{Time.now.to_i}"
      end

      # Generate new model
      gem_execute "backup generate:model -t #{fetch(:application)} --storages=local --compressor=gzip --databases=postgresql"
      execute "rm #{full_path}"
      template 'backup_model.erb', full_path
      puts "Now edit #{full_path}"
    end
  end

  desc 'Get backup.'
  task :perform do
    on roles(:app) do
      puts 'Performing backup.'
      gem_execute "backup perform --trigger #{fetch(:application)}"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
recipes_matic-1.3.0 lib/generators/recipes_matic/templates/lib/capistrano/tasks/backup.rake
recipes_matic-1.2.1 lib/generators/recipes_matic/templates/lib/capistrano/tasks/backup.rake
recipes_matic-1.2.0 lib/generators/recipes_matic/templates/lib/capistrano/tasks/backup.rake