module HerokuPull
Attributes
app_name[RW]
Public Class Methods
capture()
click to toggle source
# File lib/heroku_pull.rb, line 9 def capture cmd = "heroku pgbackups:capture --expire" puts "Capture the database..." puts cmd system cmd_with_app_name(cmd) end
cmd_with_app_name(cmd)
click to toggle source
# File lib/heroku_pull.rb, line 30 def cmd_with_app_name(cmd) (HerokuPull.app_name ? "#{cmd} --app #{HerokuPull.app_name}" : cmd) end
database(config_path = './config/database.yml')
click to toggle source
# File lib/heroku_pull.rb, line 38 def database(config_path = './config/database.yml') ENV['RAILS_ENV'] ||= 'development' config = YAML::load_file(config_path) database = config[ENV['RAILS_ENV']]['database'] end
download()
click to toggle source
# File lib/heroku_pull.rb, line 16 def download cmd = "wget -O #{filename} `#{cmd_with_app_name("heroku pgbackups:url")}`" puts "Download backup file..." puts cmd system cmd end
filename()
click to toggle source
# File lib/heroku_pull.rb, line 34 def filename "./tmp/heroku_pull.sql" end
restore()
click to toggle source
# File lib/heroku_pull.rb, line 23 def restore cmd = "pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{database} #{filename}" puts "Restore local database..." puts cmd system cmd end