Class: BP::Heroku

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bp/heroku.rb

Instance Method Summary collapse

Instance Method Details

#configObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bp/heroku.rb', line 7

def config
  lines = `heroku config`.split(/\n/)
  output = lines.reject do |l|
    name = l.split(/\s/).first
    name =~ /DEPLOYHOOK/ || name !~ /[A-Z]/ || %w{
      DATABASE_URL GEM_PATH LANG PATH RACK_ENV RAILS_ENV
      SHARED_DATABASE_URL 
    }.include?(name)
  end.map do |l|
    'export ' + l.sub(/\s*=>\s*/,'=')
  end
  puts output
end

#hooks(app = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/bp/heroku.rb', line 22

def hooks(app = nil)
  app ||= BP.heroku_repo_name

  run "heroku addons:remove deployhooks:email --app #{app} --confirm #{app}"
  run %{heroku addons:add deployhooks:email [email protected] subject="{{user}} deployed #{app} at {{head}}" body="{{user}} deployed #{app} at {{head}}\n\n{{git_log}}" --app #{app} --confirm #{app}}
  run "heroku addons:remove deployhooks:campfire --app #{app} --confirm #{app}"
  run %{heroku addons:add deployhooks:campfire url=fingertips ssl=1 api_key=#{CAMPFIRE_TOKEN} room="Brighter Planet" message="{{user}} deployed #{app} at {{head}}" --app #{app} --confirm #{app}}
  run "heroku addons:remove deployhooks:http --app #{app} --confirm #{app}"
  run "heroku addons:add deployhooks:http url=http://impact.brighterplanet.com/flush --app #{app} --confirm #{app}"
end