Class: Ronin::DB::Tasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Ronin::DB::Tasks
- Defined in:
- lib/ronin/db/tasks.rb
Overview
Instance Attribute Summary collapse
-
#database ⇒ Symbol, Hash
readonly
The database to connect to.
Instance Method Summary collapse
-
#define ⇒ Object
private
Defines the
ronin:db
tasks. -
#initialize(database: :default) ⇒ Tasks
constructor
Initializes the tasks.
Constructor Details
#initialize(database: :default) ⇒ Tasks
Initializes the tasks.
48 49 50 51 52 53 54 |
# File 'lib/ronin/db/tasks.rb', line 48 def initialize(database: :default) super() @database = database define end |
Instance Attribute Details
#database ⇒ Symbol, Hash (readonly)
The database to connect to.
38 39 40 |
# File 'lib/ronin/db/tasks.rb', line 38 def database @database end |
Instance Method Details
#define ⇒ Object
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.
Defines the ronin:db
tasks.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/ronin/db/tasks.rb', line 61 def define namespace :db do task :connect do require 'ronin/db' DB.connect(@database) end desc 'Migrates the development database' task :migrate => :connect do require 'ronin/db/migrations' DB::Migrations.up end desc 'Starts an interactive database console' task :console => :connect do require 'logger' DB.logger = Logger.new($stderr,:debug) require 'ronin/db/cli/ruby_shell' DB::CLI::RubyShell.start end end end |