vmc 0.3.14.beta.3 → 0.3.14.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/config/clients.yml +4 -1
- data/lib/cli/commands/services.rb +7 -4
- data/lib/cli/tunnel_helper.rb +20 -10
- data/lib/cli/version.rb +1 -1
- metadata +2 -2
data/config/clients.yml
CHANGED
@@ -8,4 +8,7 @@ mongodb:
|
|
8
8
|
mongo: mongo --host ${host} --port ${port} -u ${user} -p ${password} ${name}
|
9
9
|
|
10
10
|
postgresql:
|
11
|
-
psql:
|
11
|
+
psql:
|
12
|
+
command: psql -h ${host} -p ${port} -d ${name} -U ${user} -w
|
13
|
+
environment:
|
14
|
+
- PGPASSWORD='${password}'
|
@@ -151,21 +151,24 @@ module VMC::Cli::Command
|
|
151
151
|
start_tunnel(service, port, conn_info, auth)
|
152
152
|
|
153
153
|
clients = get_clients_for(info[:vendor])
|
154
|
+
|
154
155
|
if clients.empty?
|
155
|
-
|
156
|
+
client_name ||= "none"
|
156
157
|
else
|
157
|
-
|
158
|
+
client_name ||= ask(
|
158
159
|
"Which client would you like to start?",
|
159
160
|
:choices => ["none"] + clients.keys,
|
160
161
|
:indexed => true
|
161
162
|
)
|
162
163
|
end
|
163
164
|
|
164
|
-
if
|
165
|
+
if client_name == "none"
|
165
166
|
wait_for_tunnel_end
|
166
167
|
else
|
167
168
|
wait_for_tunnel_start(port)
|
168
|
-
start_local_prog(
|
169
|
+
unless start_local_prog(clients[client_name], conn_info, port)
|
170
|
+
err "'#{client_name}' executation failed; is it in your $PATH?"
|
171
|
+
end
|
169
172
|
end
|
170
173
|
end
|
171
174
|
|
data/lib/cli/tunnel_helper.rb
CHANGED
@@ -231,9 +231,8 @@ module VMC::Cli
|
|
231
231
|
@local_tunnel_thread.join
|
232
232
|
end
|
233
233
|
|
234
|
-
def
|
235
|
-
|
236
|
-
cmd.gsub!(/\$\{\s*([^\}]+)\s*\}/) do
|
234
|
+
def resolve_symbols(str, info, local_port)
|
235
|
+
str.gsub(/\$\{\s*([^\}]+)\s*\}/) do
|
237
236
|
case $1
|
238
237
|
when "host"
|
239
238
|
# TODO: determine proper host
|
@@ -241,20 +240,31 @@ module VMC::Cli
|
|
241
240
|
when "port"
|
242
241
|
local_port
|
243
242
|
when "user", "username"
|
244
|
-
|
243
|
+
info["username"]
|
245
244
|
else
|
246
|
-
|
245
|
+
info[$1] || err("Unknown symbol '#{$1}'")
|
247
246
|
end
|
248
247
|
end
|
249
|
-
cmd
|
250
248
|
end
|
251
249
|
|
252
|
-
def start_local_prog(
|
250
|
+
def start_local_prog(client, info, port)
|
251
|
+
case client
|
252
|
+
when Hash
|
253
|
+
cmdline = resolve_symbols(client["command"], info, port)
|
254
|
+
client["environment"].each do |e|
|
255
|
+
e =~ /([^=]+)=(["']?)([^"']*)\2/
|
256
|
+
ENV[$1] = resolve_symbols($3, info, port)
|
257
|
+
end
|
258
|
+
when String
|
259
|
+
cmdline = resolve_symbols(client, info, port)
|
260
|
+
else
|
261
|
+
err "Unknown client info: #{client.inspect}."
|
262
|
+
end
|
263
|
+
|
253
264
|
display "Launching '#{cmdline}'"
|
254
265
|
display ''
|
255
|
-
|
256
|
-
|
257
|
-
end
|
266
|
+
|
267
|
+
system(cmdline)
|
258
268
|
end
|
259
269
|
|
260
270
|
def push_caldecott(token)
|
data/lib/cli/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: vmc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 7
|
5
|
-
version: 0.3.14.beta.
|
5
|
+
version: 0.3.14.beta.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- VMware
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-16 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|