Class: Codeland::Starter::Integrations::Heroku
- Inherits:
-
Object
- Object
- Codeland::Starter::Integrations::Heroku
- Defined in:
- lib/codeland/starter/integrations/heroku.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize ⇒ Heroku
constructor
A new instance of Heroku.
- #output ⇒ Object
- #perform ⇒ Object
Constructor Details
#initialize ⇒ Heroku
Returns a new instance of Heroku.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 10 def initialize token = if Configuration['heroku'] Configuration['heroku']['oauth_token'] else yaml = Starter.config.yaml = "Missing heroku key in #{yaml}" missing_config() end @app = {} @success = false @api = PlatformAPI.connect_oauth(token) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
8 9 10 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 8 def app @app end |
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 28 def create begin @app = create_app(Starter.name) @success = true rescue Excon::Errors::Unauthorized yaml = Starter.config.yaml missing_config("Please verify the Heroku oauth key in #{yaml}") rescue Excon::Errors::UnprocessableEntity @app = create_random_app @success = true ensure if success? add_git_remote add_collaborators end end end |
#output ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 46 def output if success? puts <<-MESSAGE.gsub(/^\s{12}/, '') Heroku created with URL: #{app['web_url']} Git remote: #{app['git_url']} MESSAGE else puts 'heroku failed' puts app end end |
#perform ⇒ Object
23 24 25 26 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 23 def perform create output end |