Class: Ronin::DB::CLI::Commands::Irb Private

Inherits:
Ronin::DB::CLI::Command show all
Includes:
DatabaseOptions
Defined in:
lib/ronin/db/cli/commands/irb.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Connects to a database and start an interactive Ruby shell.

Usage

ronin-db irb [options]

Options

    --db NAME                    The database to connect to (Default: default)
    --db-uri URI                 The database URI to connect to
    --db-file PATH               The sqlite3 database file to use
    --no-connect                 Do not connect to a database on startup
-h, --help                       Print help information

Constant Summary

Constants included from URIMethods

URIMethods::ADAPTER_ALIASES

Instance Method Summary collapse

Methods included from DatabaseOptions

#db_config, #db_connect, included

Methods included from URIMethods

#normalize_adapter, #normalize_sqlite3_path, #parse_uri

Instance Method Details

#load_modelsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loads all models.



76
77
78
79
# File 'lib/ronin/db/cli/commands/irb.rb', line 76

def load_models
  require 'ronin/db/models'
  Ronin::DB::Models.connect
end

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Starts the ronin-db irb command.



57
58
59
60
61
62
63
64
65
66
# File 'lib/ronin/db/cli/commands/irb.rb', line 57

def run
  unless options[:no_connect]
    db_connect
    load_models
  end

  set_logger

  CLI::RubyShell.start
end

#set_loggerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



68
69
70
71
# File 'lib/ronin/db/cli/commands/irb.rb', line 68

def set_logger
  require 'logger'
  DB.logger = Logger.new(stderr,:debug)
end