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 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 28 def create begin @app = create_app(Starter.name) @success = true rescue Excon::Errors:: 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 add_git_remote end end |
#output ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 43 def output if success? puts " Heroku created with\n URL: \#{app['web_url']}\n Git remote: \#{app['git_url']}\n MESSAGE\n else\n puts 'heroku failed'\n puts app\n end\nend\n".gsub(/^\s{12}/, '') |
#perform ⇒ Object
23 24 25 26 |
# File 'lib/codeland/starter/integrations/heroku.rb', line 23 def perform create output end |