Class: DB

Inherits:
Object
  • Object
show all
Defined in:
lib/db.rb

Overview

Suprails: The customizable wrapper to the rails command

Copyright 2008 Bradley Grzesiak This file is part of Suprails.

Suprails is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Suprails is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Suprails.  If not, see <http://www.gnu.org/licenses/>.

Defined Under Namespace

Classes: Environment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name) ⇒ DB

Returns a new instance of DB.



59
60
61
62
63
64
# File 'lib/db.rb', line 59

def initialize app_name
  @development = Environment.new 'development'
  @test = Environment.new 'test'
  @production = Environment.new 'production'
  @app_name = app_name
end

Instance Attribute Details

#developmentObject (readonly)

Returns the value of attribute development.



22
23
24
# File 'lib/db.rb', line 22

def development
  @development
end

#productionObject (readonly)

Returns the value of attribute production.



22
23
24
# File 'lib/db.rb', line 22

def production
  @production
end

#testObject (readonly)

Returns the value of attribute test.



22
23
24
# File 'lib/db.rb', line 22

def test
  @test
end

Instance Method Details

#createObject



66
67
68
# File 'lib/db.rb', line 66

def create
  `cd #{@app_name}; rake db:create`
end

#migrateObject



69
70
71
# File 'lib/db.rb', line 69

def migrate
  `cd #{@app_name}; rake db:migrate`
end