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

Inherits:
DatabaseCommand show all
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
    --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 inherited from DatabaseCommand

#config, #connect

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.



72
73
74
75
# File 'lib/ronin/db/cli/commands/irb.rb', line 72

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.



53
54
55
56
57
58
59
60
61
62
# File 'lib/ronin/db/cli/commands/irb.rb', line 53

def run
  unless options[:no_connect]
    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.



64
65
66
67
# File 'lib/ronin/db/cli/commands/irb.rb', line 64

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