lib/dumpdb.rb in dumpdb-1.1.0 vs lib/dumpdb.rb in dumpdb-2.0.0
- old
+ new
@@ -11,11 +11,10 @@
def self.included(receiver)
receiver.class_eval do
include NsOptions
options :settings do
option 'ssh', Settings::Ssh, :default => ''
- option 'databases', Settings::Databases, :default => {}
option 'dump_file', Settings::DumpFile, :default => ''
option 'source', Settings::SourceTarget, :default => {}
option 'target', Settings::SourceTarget, :default => {}
option 'dump_cmds', Settings::CmdList, :default => []
option 'restore_cmds', Settings::CmdList, :default => []
@@ -32,11 +31,10 @@
end
module SettingsDslMethods
def ssh(&block); settings.ssh = Settings::Ssh.new(block); end
- def databases(&block); settings.databases = Settings::Databases.new(block); end
def dump_file(&block); settings.dump_file = Settings::DumpFile.new(block); end
def source(&block); settings.source = Settings::SourceTarget.new(block); end
def target(&block); settings.target = Settings::SourceTarget.new(block); end
def dump(&block); settings.dump_cmds << Settings::DumpCmd.new(block); end
@@ -47,25 +45,17 @@
module SettingsMethods
def settings; self.class.settings; end
def ssh; @ssh ||= settings.ssh.value(self); end
- def databases; @databases ||= settings.databases.value(self); end
def dump_file; @dump_file ||= settings.dump_file.value(self); end
def source; @source ||= settings.source.value(self); end
def target; @target ||= settings.target.value(self); end
def dump_cmds; @dump_cmds ||= settings.dump_cmds.value(self); end
def restore_cmds; @restore_cmds ||= settings.restore_cmds.value(self); end
def copy_dump_cmd; @copy_dump_cmd ||= Settings::CopyDumpCmd.new.value(self); end
- end
-
- def db(database_name, other_vals=nil)
- if (db_vals = self.databases[database_name]).nil?
- raise BadDatabaseName, "no database named `#{database_name}'."
- end
- Db.new(self.dump_file, db_vals.merge(other_vals || {}))
end
def dump_cmd(&block); Settings::DumpCmd.new(block).value(self); end
def restore_cmd(&block) Settings::RestoreCmd.new(block).value(self); end