Class: MasonServer::Deployment
- Inherits:
-
Object
- Object
- MasonServer::Deployment
- Defined in:
- lib/mason_server/deployment.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #db_config ⇒ Object
-
#initialize(environment, url, db_config_file, directory) ⇒ Deployment
constructor
A new instance of Deployment.
- #reset_db ⇒ Object
- #setup_db ⇒ Object
Constructor Details
#initialize(environment, url, db_config_file, directory) ⇒ Deployment
Returns a new instance of Deployment.
3 4 5 6 7 8 |
# File 'lib/mason_server/deployment.rb', line 3 def initialize(environment, url, db_config_file, directory) @environment = environment @url = url @db_config_file = db_config_file @directory = directory end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
10 11 12 |
# File 'lib/mason_server/deployment.rb', line 10 def directory @directory end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/mason_server/deployment.rb', line 10 def url @url end |
Instance Method Details
#db_config ⇒ Object
20 21 22 23 24 |
# File 'lib/mason_server/deployment.rb', line 20 def db_config @db_config ||= YAML.load_file(@db_config_file). fetch(@environment). values_at("username", "password", "host", "database") end |
#reset_db ⇒ Object
16 17 18 |
# File 'lib/mason_server/deployment.rb', line 16 def reset_db DataMapper.auto_migrate! end |
#setup_db ⇒ Object
12 13 14 |
# File 'lib/mason_server/deployment.rb', line 12 def setup_db DataMapper.setup(:default, ("postgres://%s:%s@%s/%s" % db_config)) end |