class Maguro::Heroku
Attributes
app_name[R]
builder[R]
organization[R]
production_name[R]
staging_name[R]
Public Class Methods
new(builder, app_name, organization)
click to toggle source
# File lib/maguro/heroku.rb, line 6 def initialize(builder, app_name, organization) @builder = builder @app_name = app_name.gsub(/[_ ]/,'-') @organization = organization @production_name = "#{@organization}-#{@app_name}" @staging_name = "#{@organization}-#{@app_name}-staging" end
Public Instance Methods
add_database(app_name)
click to toggle source
addons.heroku.com/heroku-postgresql
# File lib/maguro/heroku.rb, line 19 def add_database(app_name) builder.run "heroku addons:add heroku-postgresql --app #{app_name}" end
add_pg_backup(app_name, length="month")
click to toggle source
addons.heroku.com/pgbackups length can be “week” or “month”
# File lib/maguro/heroku.rb, line 25 def add_pg_backup(app_name, length="month") builder.run "heroku addons:add pgbackups:auto-#{length} --app #{app_name}" end
create()
click to toggle source
# File lib/maguro/heroku.rb, line 29 def create create_app(staging_name, "staging") create_app(production_name, "production") add_database(staging_name) add_database(production_name) add_pg_backup(staging_name, "week") add_pg_backup(production_name) end
create_app(app_name, remote_name)
click to toggle source
# File lib/maguro/heroku.rb, line 14 def create_app(app_name, remote_name) builder.run "heroku apps:create #{app_name} --remote #{remote_name}" end
push()
click to toggle source
# File lib/maguro/heroku.rb, line 40 def push builder.git push: "production master:master" builder.git push: "staging master:master" end