Class: DB
- Inherits:
-
Object
- Object
- DB
- Defined in:
- lib/db.rb
Defined Under Namespace
Classes: Environment
Instance Attribute Summary collapse
-
#development ⇒ Object
readonly
Returns the value of attribute development.
-
#production ⇒ Object
readonly
Returns the value of attribute production.
-
#test ⇒ Object
readonly
Returns the value of attribute test.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(app_name) ⇒ DB
constructor
A new instance of DB.
- #migrate ⇒ Object
- #save_yaml(database_hash) ⇒ Object
Constructor Details
#initialize(app_name) ⇒ DB
Returns a new instance of DB.
61 62 63 64 65 66 |
# File 'lib/db.rb', line 61 def initialize app_name @development = Environment.new 'development' @test = Environment.new 'test' @production = Environment.new 'production' @app_name = app_name end |
Instance Attribute Details
#development ⇒ Object (readonly)
Returns the value of attribute development.
24 25 26 |
# File 'lib/db.rb', line 24 def development @development end |
#production ⇒ Object (readonly)
Returns the value of attribute production.
24 25 26 |
# File 'lib/db.rb', line 24 def production @production end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
24 25 26 |
# File 'lib/db.rb', line 24 def test @test end |
Instance Method Details
#create ⇒ Object
73 74 75 |
# File 'lib/db.rb', line 73 def create `cd #{@app_name}; rake db:create` end |
#migrate ⇒ Object
76 77 78 |
# File 'lib/db.rb', line 76 def migrate `cd #{@app_name}; rake db:migrate` end |
#save_yaml(database_hash) ⇒ Object
68 69 70 71 |
# File 'lib/db.rb', line 68 def save_yaml database_hash file = "#{@app_name}/config/database.yml" YAMLHelper.create_yaml file, database_hash end |