karo 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of karo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/karo/cli.rb +31 -28
- data/lib/karo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cef5122b1fb4265a148cd2f1c700684a044f3e1
|
4
|
+
data.tar.gz: 06353a8e2e1a1d299d94d2a7ef2bc602a8b8a159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33f114b6f81e5e816e49b0b1ee89a058dff3472fa96e1a1a6bdfd28486595dfebd4bd14117094eef6e6ff3f38d5701738f2efaea0c24204110e090bd60ea599b
|
7
|
+
data.tar.gz: 6c5c1a3a18256511e54143b5655ec7acd731c933d5539efee70c98eb7b9a4722623dfd829ae81657bf00b2b58279c2652456105250c941bda2456984ac1ea290
|
data/CHANGELOG.md
CHANGED
data/lib/karo/cli.rb
CHANGED
@@ -77,18 +77,10 @@ module Karo
|
|
77
77
|
|
78
78
|
> Beginning deploy...
|
79
79
|
LONGDESC
|
80
|
-
def client(cmd, *
|
80
|
+
def client(cmd, *extras)
|
81
81
|
configuration = Config.load_configuration(options)
|
82
|
-
|
83
|
-
|
84
|
-
cmd = configuration["commands"]["client"][cmd]
|
85
|
-
end
|
86
|
-
|
87
|
-
to_run = "#{cmd} #{extra.flatten.uniq.join(" ")}"
|
88
|
-
|
89
|
-
say to_run, :green if options[:verbose]
|
90
|
-
|
91
|
-
system to_run
|
82
|
+
command = make_command configuration, "client", cmd, extras
|
83
|
+
run_it command, options[:verbose]
|
92
84
|
end
|
93
85
|
map clt: :client
|
94
86
|
map local: :client
|
@@ -145,29 +137,21 @@ module Karo
|
|
145
137
|
|
146
138
|
> 25224800 active memory
|
147
139
|
LONGDESC
|
148
|
-
def server(cmd, *
|
140
|
+
def server(cmd, *extras)
|
149
141
|
configuration = Config.load_configuration(options)
|
150
142
|
|
151
143
|
ssh = "ssh #{configuration["user"]}@#{configuration["host"]}"
|
152
|
-
|
153
|
-
# Forces pseudo-tty allocation
|
154
144
|
ssh << " -t" if options[:tty]
|
155
145
|
|
156
|
-
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
to_run = "#{ssh} '#{cmd} #{extra.flatten.uniq.join(" ")}'"
|
161
|
-
|
162
|
-
say to_run, :green if options[:verbose]
|
163
|
-
system to_run
|
146
|
+
command = make_command configuration, "server", cmd, extras
|
147
|
+
run_it "#{ssh} #{command}", options[:verbose]
|
164
148
|
end
|
165
149
|
map srv: :server
|
166
150
|
map remote: :server
|
167
151
|
|
168
152
|
desc "top", "run top command on a given server environment"
|
169
|
-
def top(*
|
170
|
-
invoke :server, ["top",
|
153
|
+
def top(*extras)
|
154
|
+
invoke :server, ["top", extras]
|
171
155
|
end
|
172
156
|
|
173
157
|
desc "ssh", "open ssh console for a given server environment"
|
@@ -192,18 +176,18 @@ module Karo
|
|
192
176
|
end
|
193
177
|
|
194
178
|
desc "rake", "run rake commands for a rails app on a given server environment"
|
195
|
-
def rake(command, *
|
179
|
+
def rake(command, *extras)
|
196
180
|
configuration = Config.load_configuration(options)
|
197
181
|
|
198
182
|
path = File.join(configuration["path"], "current")
|
199
183
|
cmd = "cd #{path} && export RAILS_ENV=#{options[:environment]} && bundle exec rake #{command}"
|
200
184
|
|
201
|
-
invoke :server, [cmd,
|
185
|
+
invoke :server, [cmd, extras]
|
202
186
|
end
|
203
187
|
|
204
188
|
desc "log", "displays server log for a given environment"
|
205
189
|
class_option :continous, type: :boolean, lazy_default: true, aliases: "-f", desc: "The -f option causes tail to not stop when end of file is reached, but rather to wait for additional data to be appended to the input."
|
206
|
-
def log(*
|
190
|
+
def log(*extras)
|
207
191
|
configuration = Config.load_configuration(options)
|
208
192
|
|
209
193
|
path = File.join(configuration["path"], "shared/log/#{options["environment"]}.log")
|
@@ -212,7 +196,7 @@ module Karo
|
|
212
196
|
cmd << " -f" if options[:continous]
|
213
197
|
cmd << " #{path}"
|
214
198
|
|
215
|
-
invoke :server, [cmd,
|
199
|
+
invoke :server, [cmd, extras]
|
216
200
|
end
|
217
201
|
|
218
202
|
desc "version", "displays karo's current version"
|
@@ -220,6 +204,25 @@ module Karo
|
|
220
204
|
say Karo::VERSION
|
221
205
|
end
|
222
206
|
|
207
|
+
private
|
208
|
+
|
209
|
+
def make_command(configuration, namespace, command, extras)
|
210
|
+
commands = configuration["commands"]
|
211
|
+
|
212
|
+
if commands && commands[namespace] && commands[namespace][command]
|
213
|
+
command = commands[namespace][command]
|
214
|
+
end
|
215
|
+
|
216
|
+
extras = extras.flatten.uniq.join(" ")
|
217
|
+
|
218
|
+
"#{command} #{extras}"
|
219
|
+
end
|
220
|
+
|
221
|
+
def run_it(cmd, verbose=false)
|
222
|
+
say cmd, :green if verbose
|
223
|
+
system cmd
|
224
|
+
end
|
225
|
+
|
223
226
|
end
|
224
227
|
|
225
228
|
end
|
data/lib/karo/version.rb
CHANGED