lib/ardb/runner.rb in ardb-0.5.0 vs lib/ardb/runner.rb in ardb-0.6.0

- old
+ new

@@ -1,9 +1,7 @@ require 'ardb' -ENV['ARDB_CONFIG_FILE'] ||= 'config/db' - module Ardb; end class Ardb::Runner UnknownCmdError = Class.new(ArgumentError) CmdError = Class.new(RuntimeError) CmdFail = Class.new(RuntimeError) @@ -15,11 +13,12 @@ @cmd_name = args.shift || "" @cmd_args = args end def run - setup_run + Ardb.init(false) # don't establish a connection + case @cmd_name when 'migrate' require 'ardb/runner/migrate_command' MigrateCommand.new.run when 'generate' @@ -37,16 +36,9 @@ when 'null' NullCommand.new.run else raise UnknownCmdError, "unknown command `#{@cmd_name}`" end - end - - private - - def setup_run - require ENV['ARDB_CONFIG_FILE'] - Ardb.init(false) # don't establish a connection end class NullCommand def run # if this was a real command it would do something here