Class: GithubHerokuDeployer::Heroku

Inherits:
Object
  • Object
show all
Defined in:
lib/github_heroku_deployer/heroku.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Heroku

Returns a new instance of Heroku.



6
7
8
9
# File 'lib/github_heroku_deployer/heroku.rb', line 6

def initialize(options)
  @heroku_api_key = options[:heroku_api_key]
  @heroku_app_name = options[:heroku_app_name]
end

Instance Method Details

#addon_add(addon, options = {}) ⇒ Object



49
50
51
# File 'lib/github_heroku_deployer/heroku.rb', line 49

def addon_add(addon, options={})
  heroku.post_addon(@heroku_app_name, addon, options)
end

#addon_remove(addon) ⇒ Object



53
54
55
# File 'lib/github_heroku_deployer/heroku.rb', line 53

def addon_remove(addon)
  heroku.delete_addon(@heroku_app_name, addon)
end

#appObject



15
16
17
# File 'lib/github_heroku_deployer/heroku.rb', line 15

def app
  @app ||= find_or_create_app
end

#config_set(config_vars) ⇒ Object



45
46
47
# File 'lib/github_heroku_deployer/heroku.rb', line 45

def config_set(config_vars)
  heroku.put_config_vars(@heroku_app_name, config_vars)
end

#create_appObject



29
30
31
# File 'lib/github_heroku_deployer/heroku.rb', line 29

def create_app
  heroku.post_app(name: @heroku_app_name)
end

#destroy_appObject



37
38
39
# File 'lib/github_heroku_deployer/heroku.rb', line 37

def destroy_app
  heroku.delete_app(@heroku_app_name)
end

#find_appObject



25
26
27
# File 'lib/github_heroku_deployer/heroku.rb', line 25

def find_app
  heroku.get_app(@heroku_app_name)
end

#find_or_create_appObject



19
20
21
22
23
# File 'lib/github_heroku_deployer/heroku.rb', line 19

def find_or_create_app
  find_app
rescue ::Heroku::API::Errors::NotFound
  create_app
end

#herokuObject



11
12
13
# File 'lib/github_heroku_deployer/heroku.rb', line 11

def heroku
  @heroku ||= ::Heroku::API.new(api_key: @heroku_api_key)
end

#post_ps_scale(process, quantity) ⇒ Object



57
58
59
# File 'lib/github_heroku_deployer/heroku.rb', line 57

def post_ps_scale(process, quantity)
  heroku.post_ps_scale(@heroku_app_name, process, quantity)
end

#restart_appObject



33
34
35
# File 'lib/github_heroku_deployer/heroku.rb', line 33

def restart_app
  heroku.post_ps_restart(@heroku_app_name)
end

#run(command) ⇒ Object



41
42
43
# File 'lib/github_heroku_deployer/heroku.rb', line 41

def run(command)
  heroku.post_ps(@heroku_app_name, command)
end