lib/tasks/db.rake in db-sync-0.0.7 vs lib/tasks/db.rake in db-sync-0.0.8
- old
+ new
@@ -1,18 +1,18 @@
namespace :db do
namespace :sync do
desc 'Download data from the databse into files.'
task down: :environment do
- synchronizer = Db::Sync.new
+ synchronizer = Db::Sync.new(sync_dir)
synchronizer.sync_down
end
desc 'Upload data from the files into the database.'
task up: :environment do
commit = ENV['commit'].present? ? ENV['commit'] == 'true' : nil
- synchronizer = Db::Sync.new
- sync_up_and_print(synchronizer, commit)
+ synchronizer = Db::Sync.new(sync_dir)
+ sync_up_and_print(synchronizer, sync_dir, commit)
if commit.nil? && synchronizer.log.present?
print "Commit Changes? [y/n]\n"
sync_up_and_print(synchronizer, true) if STDIN.gets.chomp == 'y'
end
end
@@ -20,6 +20,10 @@
end
def self.sync_up_and_print(synchronizer, commit)
synchronizer.sync_up(commit)
print synchronizer.log.join("\n") + "\n"
+end
+
+def self.sync_dir
+ ENV['dir']
end