Sha256: b7d3b11f656ac6d4091de3c3a5c1e0a68a75f55476cd77dc5a166bd720f461d7

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

namespace :db do
  namespace :sync do
    desc 'Download data from the databse into files.'
    task down: :environment do
      synchronizer = Db::Sync.new
      synchronizer.sync_down
    end

    desc 'Upload data from the files into the database.'
    task up: :environment do
      commit = ENV['commit'] == 'true'
      synchronizer = Db::Sync.new
      sync_up_and_print(synchronizer, commit)
      if !commit && synchronizer.log.present?
        print "Commit Changes? [y/n]\n"
        sync_up_and_print(synchronizer, true) if STDIN.gets.chomp == 'y'
      end
    end
  end
end

def self.sync_up_and_print(synchronizer, commit)
  synchronizer.sync_up(commit)
  print synchronizer.log.join("\n") + "\n"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
db-sync-0.0.6 lib/tasks/db.rake
db-sync-0.0.5 lib/tasks/db-sync.rake