Class: Ardb::CLI::MigrateCommand
- Inherits:
-
Object
- Object
- Ardb::CLI::MigrateCommand
- Defined in:
- lib/ardb/cli.rb,
lib/ardb/cli.rb
Instance Attribute Summary collapse
-
#clirb ⇒ Object
readonly
Returns the value of attribute clirb.
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(argv, stdout = nil, stderr = nil) ⇒ MigrateCommand
constructor
A new instance of MigrateCommand.
- #run ⇒ Object
Constructor Details
#initialize(argv, stdout = nil, stderr = nil) ⇒ MigrateCommand
Returns a new instance of MigrateCommand.
203 204 205 206 207 208 209 210 |
# File 'lib/ardb/cli.rb', line 203 def initialize(argv, stdout = nil, stderr = nil) @argv = argv @stdout = stdout || $stdout @stderr = stderr || $stderr @clirb = Ardb::CLIRB.new @adapter = Ardb::Adapter.send(Ardb.config.db.adapter) end |
Instance Attribute Details
#clirb ⇒ Object (readonly)
Returns the value of attribute clirb.
201 202 203 |
# File 'lib/ardb/cli.rb', line 201 def clirb @clirb end |
Instance Method Details
#help ⇒ Object
226 227 228 229 |
# File 'lib/ardb/cli.rb', line 226 def help "Usage: ardb migrate [options]\n\n" \ "Options: #{@clirb}" end |
#run ⇒ Object
212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/ardb/cli.rb', line 212 def run @clirb.parse!(@argv) begin Ardb.init @adapter.migrate_db @adapter.dump_schema unless ENV['ARDB_MIGRATE_NO_SCHEMA'] rescue StandardError => e @stderr.puts e @stderr.puts e.backtrace.join("\n") @stderr.puts "error migrating #{Ardb.config.db.database.inspect} database" raise CommandExitError end end |