Sha256: 10402bdb5fbe5b10cab9a0c97b1bf5e44391f4509a36845cd6d8415d2625e989

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

namespace :data_sync do
  task :dump_remote do
    run :remote do
      dump_restore(fetch(:current_path), fetch(:remote_backup_path), mode: :dump, backend: :remote)
    end
  end

  task :dump_local do
    run :local do
      dump_restore('.', fetch(:local_backup_path), mode: :dump, backend: :local)
    end
  end

  task :copy_local_to_remote do
    rsync_db(mode: :local_to_remote)
  end

  task :copy_remote_to_local do
    rsync_db(mode: :remote_to_local)
  end

  task :restore_remote do
    exit unless TTY::Prompt.new.yes?("Are you sure you want to restore #{fetch(:rails_env)} database?") do |q|
      q.suffix ('y/N')
      q.default false
    end
    run :remote do
      dump_restore(fetch(:current_path), fetch(:remote_backup_path), mode: :restore, backend: :remote)
    end
  end

  task :restore_local do
    run :local do
      dump_restore('.', fetch(:local_backup_path), mode: :restore, backend: :local)
    end
  end

  task :pull do
    invoke :'data_sync:dump_remote'
    invoke :'data_sync:copy_remote_to_local'
    invoke :'data_sync:restore_local'
  end

  task :push do
    invoke :'data_sync:dump_local'
    invoke :'data_sync:copy_local_to_remote'
    invoke :'data_sync:restore_remote'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mina-data_sync-1.2.0 lib/mina/data_sync/tasks.rb
mina-data_sync-1.1.0 lib/mina/data_sync/tasks.rb
mina-data_sync-1.0.4 lib/mina/data_sync/tasks.rb
mina-data_sync-1.0.3 lib/mina/data_sync/tasks.rb