Module: Executive
- Defined in:
- lib/executive.rb,
lib/executive/version.rb
Defined Under Namespace
Modules: Development, Production
Constant Summary
collapse
- VERSION =
"0.0.7"
Class Method Summary
collapse
Class Method Details
.bootstrap_data ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/executive.rb', line 24
def bootstrap_data
config = YAML.load_file(File.join("config", "database.yml"))["development"]
old_backup = `heroku pgbackups | grep HEROKU_POSTGRESQL | cut -d " " -f 1 | head -n 1`
puts "Destroying Old Backup: #{old_backup}".green
`heroku pgbackups:destroy #{old_backup}`
puts "Capturing New Backup...".green
`heroku pgbackups:capture`
backup_url = `heroku pgbackups:url`.strip
`curl "#{backup_url}" > temporary_backup.dump`
puts "Dropping Development Database..."
if `psql -l` =~ /#{config["database"]}/ && !system("dropdb #{config["database"]}")
puts "Please close all database connections and try again".red
exit
end
system("createdb #{config["database"]}")
puts "Restoring Backup to #{config["database"]}".green
`pg_restore --no-acl --no-owner -c -h #{config["host"]} -U #{config["username"]} -d #{config["database"]} temporary_backup.dump`
`rm temporary_backup.dump`
end
|
.deploy(environment) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/executive.rb', line 16
def deploy(environment)
if environment == "development"
Development.deploy
elsif environment == "production"
Production.deploy
end
end
|
.restart ⇒ Object
10
11
12
13
14
|
# File 'lib/executive.rb', line 10
def restart
puts "\tRestarting Foreman".blue
Process.kill "TERM", @foreman_pid
start
end
|
.start ⇒ Object
6
7
8
|
# File 'lib/executive.rb', line 6
def start
@foreman_pid = Process.spawn("foreman start")
end
|