class Syncoku::RemoteDb
Attributes
app_name[R]
Public Class Methods
new(app_name)
click to toggle source
# File lib/syncoku/remote_db.rb, line 9 def initialize(app_name) @app_name = app_name end
Public Instance Methods
run_remotely(command)
click to toggle source
# File lib/syncoku/remote_db.rb, line 30 def run_remotely(command) run_command "heroku #{command} --app #{app_name}" end
sync(args)
click to toggle source
# File lib/syncoku/remote_db.rb, line 13 def sync(args) 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" if args.include?("--skip-after-sync") puts "Skipping syncoku:after_sync task" else run_remotely "run rake syncoku:after_sync" end run_remotely "restart" puts "Switch off maintenance mode" run_remotely "maintenance:off" end