Class: Appfront::Command::Ps
Class Method Summary collapse
- .force_restart(args, opts) ⇒ Object
- .reload(args, opts) ⇒ Object
- .run(args, opts) ⇒ Object
- .scale(settings, opts) ⇒ Object
- .scale_down(opts) ⇒ Object
- .scale_up(opts) ⇒ Object
- .stop(args, opts) ⇒ Object
Class Method Details
.force_restart(args, opts) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/appfront/command/ps.rb', line 17 def self.force_restart(args, opts) find_deploy! opts api.put "/flow/#{@deploy}/force-restart" spinner "Force restarting Deploy..." do loop do sleep 3 info = api.get "/flow/#{@deploy}" break if info['status'] == 'running' end end puts "\n" end |
.reload(args, opts) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/appfront/command/ps.rb', line 3 def self.reload(args, opts) find_deploy! opts api.put "/flow/#{@deploy}/reload" spinner "Reloading Deploy..." do loop do sleep 3 info = api.get "/flow/#{@deploy}" break if info['status'] == 'running' or info['status'] == 'pending_reload' end end puts "\n" end |
.run(args, opts) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/appfront/command/ps.rb', line 45 def self.run(args, opts) find_deploy! opts api.put "/flow/#{@deploy}/run" spinner "Running Deploy..." do loop do sleep 3 info = api.get "/flow/#{@deploy}" break if info['status'] == 'running' end end puts "\n" end |
.scale(settings, opts) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/appfront/command/ps.rb', line 78 def self.scale(settings, opts) find_deploy! opts count, mode = nil settings.each do |s| p, v = s.split('=',2) count = v if p == 'instances' mode = nil end unless count puts 'Usage: appfront ps:scale instances=N' exit 1 end params[:scaling] = mode if mode params[:instances] = count api.put "/flows/#{@deploy}/scaling", params spinner "Scaling deploy instances..." do loop do sleep 3 info = api.get "/flow/#{@deploy}" break if info['status'] == 'running' end end puts "Now running N instances" end |
.scale_down(opts) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/appfront/command/ps.rb', line 68 def self.scale_down(opts) find_deploy! opts spinner "Scaling down deploy instances..." do api.put "/flow/#{@deploy}/scale/down" end puts "\n" end |
.scale_up(opts) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/appfront/command/ps.rb', line 59 def self.scale_up(opts) find_deploy! opts spinner "Scaling up deploy instances..." do api.put "/flow/#{@deploy}/scale/up" end puts "\n" end |
.stop(args, opts) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/appfront/command/ps.rb', line 31 def self.stop(args, opts) find_deploy! opts api.put "/flow/#{@deploy}/stop" spinner "Stopping Deploy..." do loop do sleep 3 info = api.get "/flow/#{@deploy}" break if info['status'] == 'deactivated' end end puts "\n" end |