vmc 0.3.17 → 0.3.18
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/lib/cli/commands/services.rb +1 -1
- data/lib/cli/console_helper.rb +25 -22
- data/lib/cli/frameworks.rb +24 -3
- data/lib/cli/version.rb +1 -1
- data/lib/cli/zip_util.rb +1 -1
- data/lib/cli.rb +3 -2
- metadata +94 -11
@@ -167,7 +167,7 @@ module VMC::Cli::Command
|
|
167
167
|
else
|
168
168
|
wait_for_tunnel_start(port)
|
169
169
|
unless start_local_prog(clients, client_name, conn_info, port)
|
170
|
-
err "'#{client_name}'
|
170
|
+
err "'#{client_name}' execution failed; is it in your $PATH?"
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
data/lib/cli/console_helper.rb
CHANGED
@@ -50,13 +50,14 @@ module VMC::Cli
|
|
50
50
|
5.times do
|
51
51
|
begin
|
52
52
|
results = @telnet_client.login("Name"=>auth_info["username"],
|
53
|
-
"Password"=>auth_info["password"])
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
"Password"=>auth_info["password"])
|
54
|
+
lines = results.sub("Login: Password: ", "").split("\n")
|
55
|
+
last_line = lines.pop
|
56
|
+
if last_line =~ /[$%#>] \z/n
|
57
|
+
prompt = last_line
|
58
|
+
elsif last_line =~ /Login failed/
|
59
|
+
err_msg = last_line
|
60
|
+
end
|
60
61
|
break
|
61
62
|
rescue TimeoutError
|
62
63
|
sleep 1
|
@@ -104,29 +105,31 @@ module VMC::Cli
|
|
104
105
|
end
|
105
106
|
|
106
107
|
def readline_with_history(prompt)
|
107
|
-
line = Readline
|
108
|
-
return ''
|
109
|
-
|
110
|
-
if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
|
111
|
-
Readline::HISTORY.pop
|
112
|
-
end
|
108
|
+
line = Readline::readline(prompt)
|
109
|
+
return nil if line == nil || line == 'quit' || line == 'exit'
|
110
|
+
Readline::HISTORY.push(line) if not line =~ /^\s*$/ and Readline::HISTORY.to_a[-1] != line
|
113
111
|
line
|
114
112
|
end
|
115
113
|
|
116
114
|
def run_console(prompt)
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
115
|
+
prev = trap("INT") { |x| exit_console; prev.call(x); exit }
|
116
|
+
prev = trap("TERM") { |x| exit_console; prev.call(x); exit }
|
117
|
+
loop do
|
118
|
+
cmd = readline_with_history(prompt)
|
119
|
+
if(cmd == nil)
|
120
|
+
exit_console
|
122
121
|
break
|
123
122
|
end
|
124
|
-
|
125
|
-
prompt = send_console_command_display_results(cmd, prompt)
|
126
|
-
end
|
123
|
+
prompt = send_console_command_display_results(cmd, prompt)
|
127
124
|
end
|
128
125
|
end
|
129
126
|
|
127
|
+
def exit_console
|
128
|
+
#TimeoutError expected, as exit doesn't return anything
|
129
|
+
@telnet_client.cmd("String"=>"exit","Timeout"=>1) rescue TimeoutError
|
130
|
+
close_console
|
131
|
+
end
|
132
|
+
|
130
133
|
def send_console_command_display_results(cmd, prompt)
|
131
134
|
begin
|
132
135
|
lines = send_console_command cmd
|
@@ -154,4 +157,4 @@ module VMC::Cli
|
|
154
157
|
}
|
155
158
|
end
|
156
159
|
end
|
157
|
-
end
|
160
|
+
end
|
data/lib/cli/frameworks.rb
CHANGED
@@ -19,7 +19,8 @@ module VMC::Cli
|
|
19
19
|
'WSGI' => ['wsgi', { :mem => '64M', :description => 'Python WSGI Application'}],
|
20
20
|
'Django' => ['django', { :mem => '128M', :description => 'Python Django Application'}],
|
21
21
|
'dotNet' => ['dotNet', { :mem => '128M', :description => '.Net Web Application'}],
|
22
|
-
'Rack' => ['rack', { :mem => '128M', :description => 'Rack Application'}]
|
22
|
+
'Rack' => ['rack', { :mem => '128M', :description => 'Rack Application'}],
|
23
|
+
'Play' => ['play', { :mem => '256M', :description => 'Play Framework Application'}]
|
23
24
|
}
|
24
25
|
|
25
26
|
class << self
|
@@ -54,6 +55,8 @@ module VMC::Cli
|
|
54
55
|
if !File.directory? path
|
55
56
|
if path.end_with?('.war')
|
56
57
|
return detect_framework_from_war path
|
58
|
+
elsif path.end_with?('.zip')
|
59
|
+
return detect_framework_from_zip path, available_frameworks
|
57
60
|
elsif available_frameworks.include?(["standalone"])
|
58
61
|
return Framework.lookup('Standalone')
|
59
62
|
else
|
@@ -109,6 +112,7 @@ module VMC::Cli
|
|
109
112
|
# Python
|
110
113
|
elsif !Dir.glob('wsgi.py').empty?
|
111
114
|
return Framework.lookup('WSGI')
|
115
|
+
|
112
116
|
# .Net
|
113
117
|
elsif !Dir.glob('web.config').empty?
|
114
118
|
return Framework.lookup('dotNet')
|
@@ -118,6 +122,11 @@ module VMC::Cli
|
|
118
122
|
if File.exist?('server.js') || File.exist?('app.js') || File.exist?('index.js') || File.exist?('main.js')
|
119
123
|
return Framework.lookup('Node')
|
120
124
|
end
|
125
|
+
|
126
|
+
# Play or Standalone Apps
|
127
|
+
elsif Dir.glob('*.zip').first
|
128
|
+
zip_file = Dir.glob('*.zip').first
|
129
|
+
return detect_framework_from_zip zip_file, available_frameworks
|
121
130
|
end
|
122
131
|
|
123
132
|
# Default to Standalone if no other match was made
|
@@ -125,7 +134,6 @@ module VMC::Cli
|
|
125
134
|
end
|
126
135
|
end
|
127
136
|
|
128
|
-
private
|
129
137
|
def detect_framework_from_war(war_file=nil)
|
130
138
|
if war_file
|
131
139
|
contents = ZipUtil.entry_lines(war_file)
|
@@ -149,6 +157,19 @@ module VMC::Cli
|
|
149
157
|
return Framework.lookup('JavaWeb')
|
150
158
|
end
|
151
159
|
end
|
160
|
+
|
161
|
+
def detect_framework_from_zip(zip_file, available_frameworks)
|
162
|
+
contents = ZipUtil.entry_lines(zip_file)
|
163
|
+
detect_framework_from_zip_contents(contents, available_frameworks)
|
164
|
+
end
|
165
|
+
|
166
|
+
def detect_framework_from_zip_contents(contents, available_frameworks)
|
167
|
+
if available_frameworks.include?(["play"]) && contents =~ /lib\/play\..*\.jar/
|
168
|
+
return Framework.lookup('Play')
|
169
|
+
elsif available_frameworks.include?(["standalone"])
|
170
|
+
return Framework.lookup('Standalone')
|
171
|
+
end
|
172
|
+
end
|
152
173
|
end
|
153
174
|
|
154
175
|
attr_reader :name, :description, :console
|
@@ -228,7 +249,7 @@ module VMC::Cli
|
|
228
249
|
def memory(runtime=nil)
|
229
250
|
default_mem = @memory
|
230
251
|
default_mem = '128M' if runtime =~ /\Aruby/ || runtime == "php"
|
231
|
-
default_mem = '512M' if runtime == "java"
|
252
|
+
default_mem = '512M' if runtime == "java" || runtime == "java7"
|
232
253
|
default_mem
|
233
254
|
end
|
234
255
|
|
data/lib/cli/version.rb
CHANGED
data/lib/cli/zip_util.rb
CHANGED
data/lib/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
WINDOWS = !!(RUBY_PLATFORM =~ /mingw|mswin32|cygwin/)
|
1
|
+
require "rbconfig"
|
3
2
|
|
3
|
+
ROOT = File.expand_path(File.dirname(__FILE__))
|
4
|
+
WINDOWS = !!(RbConfig::CONFIG['host_os'] =~ /mingw|mswin32|cygwin/)
|
4
5
|
|
5
6
|
module VMC
|
6
7
|
autoload :Client, "#{ROOT}/vmc/client"
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 55
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 18
|
10
|
+
version: 0.3.18
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- VMware
|
@@ -10,8 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2012-
|
14
|
-
default_executable:
|
18
|
+
date: 2012-05-30 00:00:00 Z
|
15
19
|
dependencies:
|
16
20
|
- !ruby/object:Gem::Dependency
|
17
21
|
name: json_pure
|
@@ -21,9 +25,19 @@ dependencies:
|
|
21
25
|
requirements:
|
22
26
|
- - ">="
|
23
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 1
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 5
|
32
|
+
- 1
|
24
33
|
version: 1.5.1
|
25
34
|
- - <
|
26
35
|
- !ruby/object:Gem::Version
|
36
|
+
hash: 11
|
37
|
+
segments:
|
38
|
+
- 1
|
39
|
+
- 7
|
40
|
+
- 0
|
27
41
|
version: 1.7.0
|
28
42
|
type: :runtime
|
29
43
|
version_requirements: *id001
|
@@ -35,6 +49,11 @@ dependencies:
|
|
35
49
|
requirements:
|
36
50
|
- - ~>
|
37
51
|
- !ruby/object:Gem::Version
|
52
|
+
hash: 51
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
- 9
|
56
|
+
- 4
|
38
57
|
version: 0.9.4
|
39
58
|
type: :runtime
|
40
59
|
version_requirements: *id002
|
@@ -46,9 +65,19 @@ dependencies:
|
|
46
65
|
requirements:
|
47
66
|
- - ">="
|
48
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 13
|
69
|
+
segments:
|
70
|
+
- 1
|
71
|
+
- 6
|
72
|
+
- 1
|
49
73
|
version: 1.6.1
|
50
74
|
- - <
|
51
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 11
|
77
|
+
segments:
|
78
|
+
- 1
|
79
|
+
- 7
|
80
|
+
- 0
|
52
81
|
version: 1.7.0
|
53
82
|
type: :runtime
|
54
83
|
version_requirements: *id003
|
@@ -60,6 +89,11 @@ dependencies:
|
|
60
89
|
requirements:
|
61
90
|
- - ~>
|
62
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 1
|
95
|
+
- 4
|
96
|
+
- 2
|
63
97
|
version: 1.4.2
|
64
98
|
type: :runtime
|
65
99
|
version_requirements: *id004
|
@@ -71,6 +105,11 @@ dependencies:
|
|
71
105
|
requirements:
|
72
106
|
- - ~>
|
73
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 15
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
- 4
|
112
|
+
- 0
|
74
113
|
version: 0.4.0
|
75
114
|
type: :runtime
|
76
115
|
version_requirements: *id005
|
@@ -82,6 +121,11 @@ dependencies:
|
|
82
121
|
requirements:
|
83
122
|
- - ~>
|
84
123
|
- !ruby/object:Gem::Version
|
124
|
+
hash: 11
|
125
|
+
segments:
|
126
|
+
- 2
|
127
|
+
- 2
|
128
|
+
- 6
|
85
129
|
version: 2.2.6
|
86
130
|
type: :runtime
|
87
131
|
version_requirements: *id006
|
@@ -93,42 +137,76 @@ dependencies:
|
|
93
137
|
requirements:
|
94
138
|
- - ~>
|
95
139
|
- !ruby/object:Gem::Version
|
140
|
+
hash: 11
|
141
|
+
segments:
|
142
|
+
- 2
|
143
|
+
- 1
|
144
|
+
- 0
|
96
145
|
version: 2.1.0
|
97
146
|
type: :runtime
|
98
147
|
version_requirements: *id007
|
99
148
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
149
|
+
name: rb-readline
|
101
150
|
prerelease: false
|
102
151
|
requirement: &id008 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ~>
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 11
|
157
|
+
segments:
|
158
|
+
- 0
|
159
|
+
- 4
|
160
|
+
- 2
|
161
|
+
version: 0.4.2
|
162
|
+
type: :runtime
|
163
|
+
version_requirements: *id008
|
164
|
+
- !ruby/object:Gem::Dependency
|
165
|
+
name: rake
|
166
|
+
prerelease: false
|
167
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
103
168
|
none: false
|
104
169
|
requirements:
|
105
170
|
- - ">="
|
106
171
|
- !ruby/object:Gem::Version
|
172
|
+
hash: 3
|
173
|
+
segments:
|
174
|
+
- 0
|
107
175
|
version: "0"
|
108
176
|
type: :development
|
109
|
-
version_requirements: *
|
177
|
+
version_requirements: *id009
|
110
178
|
- !ruby/object:Gem::Dependency
|
111
179
|
name: rspec
|
112
180
|
prerelease: false
|
113
|
-
requirement: &
|
181
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
114
182
|
none: false
|
115
183
|
requirements:
|
116
184
|
- - ~>
|
117
185
|
- !ruby/object:Gem::Version
|
186
|
+
hash: 27
|
187
|
+
segments:
|
188
|
+
- 1
|
189
|
+
- 3
|
190
|
+
- 0
|
118
191
|
version: 1.3.0
|
119
192
|
type: :development
|
120
|
-
version_requirements: *
|
193
|
+
version_requirements: *id010
|
121
194
|
- !ruby/object:Gem::Dependency
|
122
195
|
name: webmock
|
123
196
|
prerelease: false
|
124
|
-
requirement: &
|
197
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
125
198
|
none: false
|
126
199
|
requirements:
|
127
200
|
- - ~>
|
128
201
|
- !ruby/object:Gem::Version
|
202
|
+
hash: 3
|
203
|
+
segments:
|
204
|
+
- 1
|
205
|
+
- 5
|
206
|
+
- 0
|
129
207
|
version: 1.5.0
|
130
208
|
type: :development
|
131
|
-
version_requirements: *
|
209
|
+
version_requirements: *id011
|
132
210
|
description: Client library and CLI that provides access to the VMware Cloud Application Platform.
|
133
211
|
email: support@vmware.com
|
134
212
|
executables:
|
@@ -181,7 +259,6 @@ files:
|
|
181
259
|
- caldecott_helper/Gemfile.lock
|
182
260
|
- caldecott_helper/server.rb
|
183
261
|
- bin/vmc
|
184
|
-
has_rdoc: true
|
185
262
|
homepage: http://vmware.com
|
186
263
|
licenses: []
|
187
264
|
|
@@ -195,17 +272,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
272
|
requirements:
|
196
273
|
- - ">="
|
197
274
|
- !ruby/object:Gem::Version
|
275
|
+
hash: 3
|
276
|
+
segments:
|
277
|
+
- 0
|
198
278
|
version: "0"
|
199
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
280
|
none: false
|
201
281
|
requirements:
|
202
282
|
- - ">="
|
203
283
|
- !ruby/object:Gem::Version
|
284
|
+
hash: 3
|
285
|
+
segments:
|
286
|
+
- 0
|
204
287
|
version: "0"
|
205
288
|
requirements: []
|
206
289
|
|
207
290
|
rubyforge_project:
|
208
|
-
rubygems_version: 1.
|
291
|
+
rubygems_version: 1.8.23
|
209
292
|
signing_key:
|
210
293
|
specification_version: 3
|
211
294
|
summary: Client library and CLI that provides access to the VMware Cloud Application Platform.
|