Class: Syncoku::RemoteDb
- Inherits:
-
Object
- Object
- Syncoku::RemoteDb
- Includes:
- CaptureBackup, Runnable
- Defined in:
- lib/syncoku/remote_db.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
Instance Method Summary collapse
-
#initialize(app_name) ⇒ RemoteDb
constructor
A new instance of RemoteDb.
- #run_remotely(command) ⇒ Object
- #sync ⇒ Object
Methods included from CaptureBackup
#capture, #production_app_name, #run_on_production
Methods included from Runnable
Constructor Details
#initialize(app_name) ⇒ RemoteDb
9 10 11 |
# File 'lib/syncoku/remote_db.rb', line 9 def initialize(app_name) @app_name = app_name end |
Instance Attribute Details
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
7 8 9 |
# File 'lib/syncoku/remote_db.rb', line 7 def app_name @app_name end |
Instance Method Details
#run_remotely(command) ⇒ Object
26 27 28 |
# File 'lib/syncoku/remote_db.rb', line 26 def run_remotely(command) run_command "heroku #{command} --app #{app_name}" end |
#sync ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/syncoku/remote_db.rb', line 13 def sync puts "Switch on maintenance mode" run_remotely "maintenance:on" puts "Restoring database" run_remotely "pg:reset DATABASE_URL --confirm #{app_name}" run_remotely "pg:backups restore '#{capture}' DATABASE_URL --confirm #{app_name}" run_remotely "run rake db:migrate" run_remotely "run rake syncoku:after_sync" run_remotely "restart" puts "Switch off maintenance mode" run_remotely "maintenance:off" end |