Class: GithubHerokuDeployer::Heroku
- Inherits:
-
Object
- Object
- GithubHerokuDeployer::Heroku
- Defined in:
- lib/github_heroku_deployer/heroku.rb
Instance Method Summary collapse
- #addon_add(addon, addon_options = {}) ⇒ Object
- #addon_remove(addon) ⇒ Object
- #app ⇒ Object
- #config_set(config_vars) ⇒ Object
- #create_app ⇒ Object
- #destroy_app ⇒ Object
- #find_app ⇒ Object
- #find_or_create_app ⇒ Object
- #heroku ⇒ Object
-
#initialize(options) ⇒ Heroku
constructor
A new instance of Heroku.
- #post_ps_scale(process, quantity) ⇒ Object
- #restart_app ⇒ Object
- #run(command) ⇒ Object
Constructor Details
#initialize(options) ⇒ Heroku
7 8 9 10 11 12 |
# File 'lib/github_heroku_deployer/heroku.rb', line 7 def initialize() @heroku_api_key = [:heroku_api_key] @heroku_app_name = [:heroku_app_name] @heroku_organization_name = [:heroku_organization_name] @logger = GithubHerokuDeployer.configuration.logger end |
Instance Method Details
#addon_add(addon, addon_options = {}) ⇒ Object
54 55 56 |
# File 'lib/github_heroku_deployer/heroku.rb', line 54 def addon_add(addon, ={}) heroku.post_addon(@heroku_app_name, addon, ) end |
#addon_remove(addon) ⇒ Object
58 59 60 |
# File 'lib/github_heroku_deployer/heroku.rb', line 58 def addon_remove(addon) heroku.delete_addon(@heroku_app_name, addon) end |
#app ⇒ Object
19 20 21 |
# File 'lib/github_heroku_deployer/heroku.rb', line 19 def app @app ||= find_or_create_app end |
#config_set(config_vars) ⇒ Object
50 51 52 |
# File 'lib/github_heroku_deployer/heroku.rb', line 50 def config_set(config_vars) heroku.put_config_vars(@heroku_app_name, config_vars) end |
#create_app ⇒ Object
33 34 35 36 |
# File 'lib/github_heroku_deployer/heroku.rb', line 33 def create_app @logger.info("Creating Heroku app with options: #{platform_api_options}") heroku_platform_api.organization_app.create() end |
#destroy_app ⇒ Object
42 43 44 |
# File 'lib/github_heroku_deployer/heroku.rb', line 42 def destroy_app heroku.delete_app(@heroku_app_name) end |
#find_app ⇒ Object
29 30 31 |
# File 'lib/github_heroku_deployer/heroku.rb', line 29 def find_app heroku.get_app(@heroku_app_name) end |
#find_or_create_app ⇒ Object
23 24 25 26 27 |
# File 'lib/github_heroku_deployer/heroku.rb', line 23 def find_or_create_app find_app rescue ::Heroku::API::Errors::NotFound create_app end |
#heroku ⇒ Object
14 15 16 |
# File 'lib/github_heroku_deployer/heroku.rb', line 14 def heroku @heroku ||= ::Heroku::API.new(api_key: @heroku_api_key) end |
#post_ps_scale(process, quantity) ⇒ Object
62 63 64 |
# File 'lib/github_heroku_deployer/heroku.rb', line 62 def post_ps_scale(process, quantity) heroku.post_ps_scale(@heroku_app_name, process, quantity) end |
#restart_app ⇒ Object
38 39 40 |
# File 'lib/github_heroku_deployer/heroku.rb', line 38 def restart_app heroku.post_ps_restart(@heroku_app_name) end |
#run(command) ⇒ Object
46 47 48 |
# File 'lib/github_heroku_deployer/heroku.rb', line 46 def run(command) heroku.post_ps(@heroku_app_name, command) end |