Class: Shippy::Cli::App
Instance Method Summary collapse
- #deploy ⇒ Object
-
#initialize ⇒ App
constructor
A new instance of App.
- #logs ⇒ Object
- #refresh ⇒ Object
- #restart ⇒ Object
- #start ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ App
Returns a new instance of App.
4 5 6 7 |
# File 'lib/shippy/cli/app.rb', line 4 def initialize(...) super(...) load_app end |
Instance Method Details
#deploy ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shippy/cli/app.rb', line 10 def deploy say "Deploying #{app_name} on #{SHIPPY.host}...", :magenta SHIPPY.compile archive backup upload create_network refresh stop_old pre_start_hooks start cleanup status end |
#logs ⇒ Object
65 66 67 68 69 |
# File 'lib/shippy/cli/app.rb', line 65 def logs within_app do puts capture(:docker, "compose", "logs", verbosity: Logger::INFO) end end |
#refresh ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/shippy/cli/app.rb', line 27 def refresh say "Pulling images for #{app_name} on #{SHIPPY.host}...", :magenta within_app do execute :docker, "compose", "pull" end end |
#restart ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/shippy/cli/app.rb', line 46 def restart say "Restarting #{app_name} on #{SHIPPY.host}...", :magenta = [:service] ? ["--", [:service]] : [] within_app do execute :docker, "compose", "restart", * end end |
#start ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/shippy/cli/app.rb', line 36 def start say "Starting #{app_name} on #{SHIPPY.host}...", :magenta within_app do execute :docker, "compose", "up", "-d", SHIPPY.app&.deploy_flags end end |
#status ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/shippy/cli/app.rb', line 72 def status say "Status for #{app_name} on #{SHIPPY.host}...", :magenta within_app do puts capture(:docker, "compose", "ps", "-a") end end |
#stop ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/shippy/cli/app.rb', line 56 def stop say "Stopping #{app_name} on #{SHIPPY.host}...", :magenta within_app do execute :docker, "compose", "down", "--remove-orphans" end end |