Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix styling for more of ps

  • Loading branch information...
commit 9be38ca1ec566599f5ee899748e5c9fad879544c 1 parent 4fed291
Wesley Beary authored

Showing 1 changed file with 15 additions and 13 deletions. Show diff stats Hide diff stats

  1. 28  lib/ext/heroku/command/ps.rb
28  lib/ext/heroku/command/ps.rb
@@ -16,12 +16,13 @@ def dynos
16 16
     # deprecation notice added to v2.21.3 on 03/16/12
17 17
     style_warning("`heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`")
18 18
     if dynos = args.shift
  19
+      style_action("scaling #{app} to #{quantify("dyno", current)}")
19 20
       current = heroku.set_dynos(app, dynos)
20  
-      display "#{app} now running #{quantify("dyno", current)}"
  21
+      hputs("done")
21 22
     else
22 23
       info = heroku.info(app)
23 24
       raise(Heroku::Command::CommandFailed, "For Cedar apps, use `heroku ps`")  if info[:stack] == "cedar"
24  
-      display "#{app} is running #{quantify("dyno", info[:dynos])}"
  25
+      style_info("#{app} is running #{quantify("dyno", info[:dynos])}")
25 26
     end
26 27
   end
27 28
 
@@ -39,12 +40,13 @@ def workers
39 40
     # deprecation notice added to v2.21.3 on 03/16/12
40 41
     style_warning("`heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`")
41 42
     if workers = args.shift
  43
+      style_action("scaling #{app} to #{quantify("worker", current)}")
42 44
       current = heroku.set_workers(app, workers)
43  
-      display "#{app} now running #{quantify("worker", current)}"
  45
+      hputs("done")
44 46
     else
45 47
       info = heroku.info(app)
46 48
       raise(Heroku::Command::CommandFailed, "For Cedar apps, use `heroku ps`")  if info[:stack] == "cedar"
47  
-      display "#{app} is running #{quantify("worker", info[:workers])}"
  49
+      style_info("#{app} is running #{quantify("worker", info[:workers])}")
48 50
     end
49 51
   end
50 52
 
@@ -74,19 +76,19 @@ def index
74 76
   def restart
75 77
     opts = case args.first
76 78
     when NilClass then
77  
-      display "Restarting processes... ", false
  79
+      style_action("Restarting processes")
78 80
       {}
79 81
     when /.+\..+/
80 82
       ps = args.first
81  
-      display "Restarting #{ps} process... ", false
  83
+      style_action("Restarting #{ps} process")
82 84
       { :ps => ps }
83 85
     else
84 86
       type = args.first
85  
-      display "Restarting #{type} processes... ", false
  87
+      style_action("Restarting #{type} processes")
86 88
       { :type => type }
87 89
     end
88 90
     heroku.ps_restart(app, opts)
89  
-    display "done"
  91
+    hputs("done")
90 92
   end
91 93
 
92 94
   alias_command "restart", "ps:restart"
@@ -109,10 +111,10 @@ def scale
109 111
     error "Usage: heroku ps:scale web=2 worker+1" if changes.empty?
110 112
 
111 113
     changes.each do |process, amount|
112  
-      display "Scaling #{process} processes... ", false
  114
+      style_action("scaling #{process} processes")
113 115
       amount.gsub!("=", "")
114 116
       new_qty = heroku.ps_scale(app, :type => process, :qty => amount)
115  
-      display "done, now running #{new_qty}"
  117
+      hputs("done, now running #{new_qty}")
116 118
     end
117 119
   end
118 120
 
@@ -128,18 +130,18 @@ def stop
128 130
     opt =
129 131
       if (args.first =~ /.+\..+/)
130 132
         ps = args.first
131  
-        display "Stopping #{ps} process... ", false
  133
+        style_action("stopping #{ps} process")
132 134
         {:ps => ps}
133 135
       elsif args.first
134 136
         type = args.first
135  
-        display "Stopping #{type} processes... ", false
  137
+        style_action("stopping #{type} processes")
136 138
         {:type => type}
137 139
       else
138 140
         error "Usage: heroku ps:stop PROCESS"
139 141
       end
140 142
 
141 143
     heroku.ps_stop(app, opt)
142  
-    display "done"
  144
+    hputs("done")
143 145
   end
144 146
 
145 147
   alias_command "stop", "ps:stop"

0 notes on commit 9be38ca

Please sign in to comment.
Something went wrong with that request. Please try again.