Class: Hap::CLI
Class Method Summary collapse
Instance Method Summary collapse
- #account(account) ⇒ Object
- #create(*args) ⇒ Object
- #delete(app, *args) ⇒ Object
- #delete_all(*args) ⇒ Object
- #deploy(*args) ⇒ Object
- #endpoint(*args) ⇒ Object
- #new(*args) ⇒ Object
- #server(*args) ⇒ Object
Class Method Details
Instance Method Details
#account(account) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/hap/cli.rb', line 44 def account(account) if has_accounts_plugin? set_env_var "HEROKU_ACCOUNT", account if File.exists? Hap::DEPLOYED_FRONTEND inside Hap::DEPLOYED_FRONTEND do run "heroku accounts:set #{account}" end end endpoints.each do |endpoint| next unless deployed? endpoint inside deploy_dir(endpoint) do run "heroku accounts:set #{account}" end end end end |
#create(*args) ⇒ Object
26 27 28 |
# File 'lib/hap/cli.rb', line 26 def create(*args) create_app *args end |
#delete(app, *args) ⇒ Object
31 32 33 |
# File 'lib/hap/cli.rb', line 31 def delete(app, *args) delete_app app end |
#delete_all(*args) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/hap/cli.rb', line 36 def delete_all(*args) delete_app Hap::FRONT_END endpoints.each do |endpoint| delete_app endpoint[:path] end end |
#deploy(*args) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/hap/cli.rb', line 73 def deploy(*args) old_env = Hap.env Hap.env = "production" # Deploy Frontend create_app Hap::FRONT_END Hap::Generators::Procfile.start [Hap::FRONT_END, "production"] Hap::Generators::Haproxy.start ["production"] bundle_and_git Hap::FRONT_END # Deploy Backend endpoints.each do |endpoint| create_app endpoint[:path] Hap::Generators::Procfile.start [endpoint[:path], "production"] Hap::Generators::Gemfile.start [endpoint[:path], "production"] copy_file endpoint[:file], deploy_dir(endpoint) bundle_and_git endpoint[:path] end Hap.env = old_env end |
#endpoint(*args) ⇒ Object
21 22 23 |
# File 'lib/hap/cli.rb', line 21 def endpoint(*args) Hap::Generators::Endpoint.start args end |
#new(*args) ⇒ Object
14 15 16 |
# File 'lib/hap/cli.rb', line 14 def new(*args) Hap::Generators::Install.start args end |
#server(*args) ⇒ Object
66 67 68 69 70 |
# File 'lib/hap/cli.rb', line 66 def server(*args) Hap::Generators::Haproxy.start args Hap::Generators::Procfile.start args system "foreman start -f #{Hap::RUNTIME_DIR}/#{Hap::FRONT_END}/Procfile -d ." end |