vmc 0.3.13.beta.2 → 0.3.13.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +84 -2
- data/lib/cli.rb +2 -3
- data/lib/cli/commands/admin.rb +9 -6
- data/lib/cli/commands/apps.rb +144 -111
- data/lib/cli/commands/base.rb +8 -15
- data/lib/cli/commands/misc.rb +3 -2
- data/lib/cli/commands/services.rb +15 -16
- data/lib/cli/commands/user.rb +11 -2
- data/lib/cli/config.rb +5 -1
- data/lib/cli/core_ext.rb +331 -0
- data/lib/cli/frameworks.rb +10 -4
- data/lib/cli/runner.rb +4 -0
- data/lib/cli/services_helper.rb +8 -2
- data/lib/cli/usage.rb +4 -3
- data/lib/cli/version.rb +1 -1
- data/lib/vmc/client.rb +4 -0
- data/lib/vmc/const.rb +1 -0
- metadata +13 -46
- data/spec/assets/app_info.txt +0 -9
- data/spec/assets/app_listings.txt +0 -9
- data/spec/assets/bad_create_app.txt +0 -9
- data/spec/assets/delete_app.txt +0 -9
- data/spec/assets/global_service_listings.txt +0 -9
- data/spec/assets/good_create_app.txt +0 -9
- data/spec/assets/good_create_service.txt +0 -9
- data/spec/assets/info_authenticated.txt +0 -27
- data/spec/assets/info_return.txt +0 -15
- data/spec/assets/info_return_bad.txt +0 -16
- data/spec/assets/list_users.txt +0 -13
- data/spec/assets/login_fail.txt +0 -9
- data/spec/assets/login_success.txt +0 -9
- data/spec/assets/sample_token.txt +0 -1
- data/spec/assets/service_already_exists.txt +0 -9
- data/spec/assets/service_gateway_fail.txt +0 -9
- data/spec/assets/service_listings.txt +0 -9
- data/spec/assets/service_not_found.txt +0 -9
- data/spec/assets/user_info.txt +0 -9
- data/spec/spec_helper.rb +0 -11
- data/spec/unit/cli_opts_spec.rb +0 -68
- data/spec/unit/client_spec.rb +0 -345
data/lib/cli/frameworks.rb
CHANGED
@@ -10,7 +10,7 @@ module VMC::Cli
|
|
10
10
|
'Spring' => ['spring', { :mem => '512M', :description => 'Java SpringSource Spring Application'}],
|
11
11
|
'Grails' => ['grails', { :mem => '512M', :description => 'Java SpringSource Grails Application'}],
|
12
12
|
'Lift' => ['lift', { :mem => '512M', :description => 'Scala Lift Application'}],
|
13
|
-
'JavaWeb' => ['
|
13
|
+
'JavaWeb' => ['java_web',{ :mem => '512M', :description => 'Java Web Application'}],
|
14
14
|
'Sinatra' => ['sinatra', { :mem => '128M', :description => 'Sinatra Application'}],
|
15
15
|
'Node' => ['node', { :mem => '64M', :description => 'Node.js Application'}],
|
16
16
|
'PHP' => ['php', { :mem => '128M', :description => 'PHP Application'}],
|
@@ -37,9 +37,14 @@ module VMC::Cli
|
|
37
37
|
return Framework.lookup('Rails')
|
38
38
|
|
39
39
|
# Java
|
40
|
-
elsif Dir.glob('*.war').first
|
40
|
+
elsif Dir.glob('*.war').first || File.exist?('WEB-INF/web.xml')
|
41
41
|
war_file = Dir.glob('*.war').first
|
42
|
-
|
42
|
+
|
43
|
+
if war_file
|
44
|
+
contents = ZipUtil.entry_lines(war_file)
|
45
|
+
else
|
46
|
+
contents = Dir['**/*'].join("\n")
|
47
|
+
end
|
43
48
|
|
44
49
|
# Spring/Lift Variations
|
45
50
|
if contents =~ /WEB-INF\/lib\/grails-web.*\.jar/
|
@@ -50,10 +55,11 @@ module VMC::Cli
|
|
50
55
|
return Framework.lookup('Spring')
|
51
56
|
elsif contents =~ /WEB-INF\/lib\/spring-core.*\.jar/
|
52
57
|
return Framework.lookup('Spring')
|
58
|
+
elsif contents =~ /WEB-INF\/lib\/org\.springframework\.core.*\.jar/
|
59
|
+
return Framework.lookup('Spring')
|
53
60
|
else
|
54
61
|
return Framework.lookup('JavaWeb')
|
55
62
|
end
|
56
|
-
|
57
63
|
# Simple Ruby Apps
|
58
64
|
elsif !Dir.glob('*.rb').empty?
|
59
65
|
matched_file = nil
|
data/lib/cli/runner.rb
CHANGED
@@ -48,6 +48,10 @@ class VMC::Cli::Runner
|
|
48
48
|
opts.on('-t [TKEY]') { |tkey| @options[:trace] = tkey || true }
|
49
49
|
opts.on('--trace [TKEY]') { |tkey| @options[:trace] = tkey || true }
|
50
50
|
|
51
|
+
# start application in debug mode
|
52
|
+
opts.on('-d [MODE]') { |mode| @options[:debug] = mode || "run" }
|
53
|
+
opts.on('--debug [MODE]') { |mode| @options[:debug] = mode || "run" }
|
54
|
+
|
51
55
|
opts.on('-q', '--quiet') { @options[:quiet] = true }
|
52
56
|
|
53
57
|
# Don't use builtin zip
|
data/lib/cli/services_helper.rb
CHANGED
@@ -50,19 +50,25 @@ module VMC::Cli
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def bind_service_banner(service, appname, check_restart=true)
|
53
|
-
display "Binding Service: ", false
|
53
|
+
display "Binding Service [#{service}]: ", false
|
54
54
|
client.bind_service(service, appname)
|
55
55
|
display 'OK'.green
|
56
56
|
check_app_for_restart(appname) if check_restart
|
57
57
|
end
|
58
58
|
|
59
59
|
def unbind_service_banner(service, appname, check_restart=true)
|
60
|
-
display "Unbinding Service: ", false
|
60
|
+
display "Unbinding Service [#{service}]: ", false
|
61
61
|
client.unbind_service(service, appname)
|
62
62
|
display 'OK'.green
|
63
63
|
check_app_for_restart(appname) if check_restart
|
64
64
|
end
|
65
65
|
|
66
|
+
def delete_service_banner(service)
|
67
|
+
display "Deleting service [#{service}]: ", false
|
68
|
+
client.delete_service(service)
|
69
|
+
display 'OK'.green
|
70
|
+
end
|
71
|
+
|
66
72
|
def random_service_name(service)
|
67
73
|
r = "%04x" % [rand(0x0100000)]
|
68
74
|
"#{service.to_s}-#{r}"
|
data/lib/cli/usage.rb
CHANGED
@@ -39,17 +39,18 @@ Currently available vmc commands are:
|
|
39
39
|
push [appname] --instances <N> Set the expected number <N> of instances
|
40
40
|
push [appname] --mem M Set the memory reservation for the application
|
41
41
|
push [appname] --runtime RUNTIME Set the runtime to use for the application
|
42
|
+
push [appname] --debug [MODE] Push application and start in a debug mode
|
42
43
|
push [appname] --no-start Do not auto-start the application
|
43
44
|
|
44
45
|
Application Operations
|
45
|
-
start <appname>
|
46
|
+
start <appname> [--debug [MODE]] Start the application
|
46
47
|
stop <appname> Stop the application
|
47
|
-
restart <appname>
|
48
|
+
restart <appname> [--debug [MODE]] Restart the application
|
48
49
|
delete <appname> Delete the application
|
49
50
|
rename <appname> <newname> Rename the application
|
50
51
|
|
51
52
|
Application Updates
|
52
|
-
update <appname> [--path]
|
53
|
+
update <appname> [--path,--debug [MODE]] Update the application bits
|
53
54
|
mem <appname> [memsize] Update the memory reservation for an application
|
54
55
|
map <appname> <url> Register the application to the url
|
55
56
|
unmap <appname> <url> Unregister the application from the url
|
data/lib/cli/version.rb
CHANGED
data/lib/vmc/client.rb
CHANGED
@@ -63,6 +63,10 @@ class VMC::Client
|
|
63
63
|
json_get(VMC::GLOBAL_SERVICES_PATH)
|
64
64
|
end
|
65
65
|
|
66
|
+
def runtimes_info
|
67
|
+
json_get(VMC::GLOBAL_RUNTIMES_PATH)
|
68
|
+
end
|
69
|
+
|
66
70
|
######################################################
|
67
71
|
# Apps
|
68
72
|
######################################################
|
data/lib/vmc/const.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.13.beta.
|
5
|
+
version: 0.3.13.beta.3
|
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-
|
13
|
+
date: 2011-10-18 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -35,21 +35,10 @@ dependencies:
|
|
35
35
|
version: 2.0.1
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: highline
|
40
|
-
prerelease: false
|
41
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 1.6.1
|
47
|
-
type: :runtime
|
48
|
-
version_requirements: *id003
|
49
38
|
- !ruby/object:Gem::Dependency
|
50
39
|
name: rest-client
|
51
40
|
prerelease: false
|
52
|
-
requirement: &
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
42
|
none: false
|
54
43
|
requirements:
|
55
44
|
- - ">="
|
@@ -59,51 +48,51 @@ dependencies:
|
|
59
48
|
- !ruby/object:Gem::Version
|
60
49
|
version: 1.7.0
|
61
50
|
type: :runtime
|
62
|
-
version_requirements: *
|
51
|
+
version_requirements: *id003
|
63
52
|
- !ruby/object:Gem::Dependency
|
64
53
|
name: terminal-table
|
65
54
|
prerelease: false
|
66
|
-
requirement: &
|
55
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
56
|
none: false
|
68
57
|
requirements:
|
69
58
|
- - ~>
|
70
59
|
- !ruby/object:Gem::Version
|
71
60
|
version: 1.4.2
|
72
61
|
type: :runtime
|
73
|
-
version_requirements: *
|
62
|
+
version_requirements: *id004
|
74
63
|
- !ruby/object:Gem::Dependency
|
75
64
|
name: rake
|
76
65
|
prerelease: false
|
77
|
-
requirement: &
|
66
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
78
67
|
none: false
|
79
68
|
requirements:
|
80
69
|
- - ">="
|
81
70
|
- !ruby/object:Gem::Version
|
82
71
|
version: "0"
|
83
72
|
type: :development
|
84
|
-
version_requirements: *
|
73
|
+
version_requirements: *id005
|
85
74
|
- !ruby/object:Gem::Dependency
|
86
75
|
name: rspec
|
87
76
|
prerelease: false
|
88
|
-
requirement: &
|
77
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
89
78
|
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 1.3.0
|
94
83
|
type: :development
|
95
|
-
version_requirements: *
|
84
|
+
version_requirements: *id006
|
96
85
|
- !ruby/object:Gem::Dependency
|
97
86
|
name: webmock
|
98
87
|
prerelease: false
|
99
|
-
requirement: &
|
88
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
100
89
|
none: false
|
101
90
|
requirements:
|
102
|
-
- -
|
91
|
+
- - "="
|
103
92
|
- !ruby/object:Gem::Version
|
104
93
|
version: 1.5.0
|
105
94
|
type: :development
|
106
|
-
version_requirements: *
|
95
|
+
version_requirements: *id007
|
107
96
|
description: Client library and CLI that provides access to the VMware Cloud Application Platform.
|
108
97
|
email: support@vmware.com
|
109
98
|
executables:
|
@@ -136,28 +125,6 @@ files:
|
|
136
125
|
- lib/vmc/client.rb
|
137
126
|
- lib/vmc/const.rb
|
138
127
|
- lib/vmc.rb
|
139
|
-
- spec/assets/app_info.txt
|
140
|
-
- spec/assets/app_listings.txt
|
141
|
-
- spec/assets/bad_create_app.txt
|
142
|
-
- spec/assets/delete_app.txt
|
143
|
-
- spec/assets/global_service_listings.txt
|
144
|
-
- spec/assets/good_create_app.txt
|
145
|
-
- spec/assets/good_create_service.txt
|
146
|
-
- spec/assets/info_authenticated.txt
|
147
|
-
- spec/assets/info_return.txt
|
148
|
-
- spec/assets/info_return_bad.txt
|
149
|
-
- spec/assets/list_users.txt
|
150
|
-
- spec/assets/login_fail.txt
|
151
|
-
- spec/assets/login_success.txt
|
152
|
-
- spec/assets/sample_token.txt
|
153
|
-
- spec/assets/service_already_exists.txt
|
154
|
-
- spec/assets/service_gateway_fail.txt
|
155
|
-
- spec/assets/service_listings.txt
|
156
|
-
- spec/assets/service_not_found.txt
|
157
|
-
- spec/assets/user_info.txt
|
158
|
-
- spec/spec_helper.rb
|
159
|
-
- spec/unit/cli_opts_spec.rb
|
160
|
-
- spec/unit/client_spec.rb
|
161
128
|
- bin/vmc
|
162
129
|
has_rdoc: true
|
163
130
|
homepage: http://vmware.com
|
data/spec/assets/app_info.txt
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Fri, 04 Mar 2011 02:56:21 GMT
|
4
|
-
Content-Type: application/json
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 243
|
8
|
-
|
9
|
-
{"resources":{"memory":64},"uris":["foo.vcap.me"],"staging":{"stack":"ruby foo.rb","model":"http://b20nine.com/unknown"},"state":"STARTED","instances":1,"name":"foo","meta":{"version":1,"created":1299207348},"services":[],"runningInstances":1}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Thu, 03 Mar 2011 19:46:19 GMT
|
4
|
-
Content-Type: application/json
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 251
|
8
|
-
|
9
|
-
[{"resources":{"memory":128},"uris":["r.vcap.me"],"staging":{"stack":"ruby redis_sample.rb","model":"http://b20nine.com/unknown"},"state":"STARTED","instances":1,"name":"r","meta":{"version":1,"created":1298681379},"services":[],"runningInstances":1}]
|
@@ -1,9 +0,0 @@
|
|
1
|
-
HTTP/1.1 400 Bad Request
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Thu, 03 Mar 2011 23:37:51 GMT
|
4
|
-
Content-Type: text/html;charset=utf-8
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 157
|
8
|
-
|
9
|
-
{"code":10050,"description":"Invalid number of instances: \"'', App instances not presentApp instances is not a numberInstances must be between 1 and 100\""}
|
data/spec/assets/delete_app.txt
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Thu, 03 Mar 2011 20:20:15 GMT
|
4
|
-
Content-Type: application/json
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 381
|
8
|
-
|
9
|
-
{"key-value":{"redis":{"2":{"type":"key-value","tiers":{"free":{"order":1,"description":"Free offering (64MiB)"}},"version":"2","vendor":"redis","description":"Redis key-value store service"}}},"database":{"mysql":{"5.1":{"type":"database","tiers":{"free":{"order":1,"description":"Free offering (1GiB)"}},"version":"5.1","description":"MySQL database service","vendor":"mysql"}}}}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Thu, 03 Mar 2011 19:25:34 GMT
|
4
|
-
Content-Type: application/json
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 380
|
8
|
-
|
9
|
-
{
|
10
|
-
"name": "vcap",
|
11
|
-
"build": "3465a13ab528443f1afcd3c9c2861a078549b8e5",
|
12
|
-
"support": "ac-support@vmware.com",
|
13
|
-
"version": 0.999,
|
14
|
-
"limits": {
|
15
|
-
"apps": 50,
|
16
|
-
"memory": 8192,
|
17
|
-
"app_uris": 4,
|
18
|
-
"services": 4
|
19
|
-
},
|
20
|
-
"user": "derek@gmail.com",
|
21
|
-
"description": "VMware's Cloud Application Platform",
|
22
|
-
"usage": {
|
23
|
-
"apps": 1,
|
24
|
-
"memory": 128,
|
25
|
-
"services": 0
|
26
|
-
}
|
27
|
-
}
|
data/spec/assets/info_return.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Thu, 03 Mar 2011 19:04:04 GMT
|
4
|
-
Content-Type: application/json
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 189
|
8
|
-
|
9
|
-
{
|
10
|
-
"name": "vcap",
|
11
|
-
"build": "3465a13ab528443f1afcd3c9c2861a078549b8e5",
|
12
|
-
"support": "ac-support@vmware.com",
|
13
|
-
"version": 0.999,
|
14
|
-
"description": "VMware's Cloud Application Platform"
|
15
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
HTTP/1.1 301 Moved Permanently
|
2
|
-
Location: http://www.google.com/
|
3
|
-
Content-Type: text/html; charset=UTF-8
|
4
|
-
Date: Thu, 03 Mar 2011 19:06:04 GMT
|
5
|
-
Expires: Sat, 02 Apr 2011 19:06:04 GMT
|
6
|
-
Cache-Control: public, max-age=2592000
|
7
|
-
Server: gws
|
8
|
-
Content-Length: 219
|
9
|
-
X-XSS-Protection: 1; mode=block
|
10
|
-
|
11
|
-
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
|
12
|
-
<TITLE>301 Moved</TITLE></HEAD><BODY>
|
13
|
-
<H1>301 Moved</H1>
|
14
|
-
The document has moved
|
15
|
-
<A HREF="http://www.google.com/">here</A>.
|
16
|
-
</BODY></HTML>
|
data/spec/assets/list_users.txt
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Sun, 22 May 2011 18:58:41 GMT
|
4
|
-
Content-Type: application/json; charset=utf-8
|
5
|
-
Transfer-Encoding: chunked
|
6
|
-
Connection: keep-alive
|
7
|
-
Keep-Alive: timeout=20
|
8
|
-
ETag: "eb21ee2635a8b6b378f896e26b61f006"
|
9
|
-
Cache-Control: max-age=0, private, must-revalidate
|
10
|
-
X-UA-Compatible: IE=Edge
|
11
|
-
Content-Length: 365
|
12
|
-
|
13
|
-
[{"email":"test@example.com","admin":true,"apps":[{"name":"chat","state":"STARTED"},{"name":"smith","state":"STARTED"},{"name":"env","state":"STARTED"},{"name":"redirect","state":"STARTED"}]},{"email":"user2@example.com","admin":false,"apps":[]},{"email":"autotest@adamgreenfield.com","admin":false,"apps":[]},{"email":"user3@example.com","admin":false,"apps":[]}]
|
data/spec/assets/login_fail.txt
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Thu, 03 Mar 2011 18:26:45 GMT
|
4
|
-
Content-Type: application/json
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 112
|
8
|
-
|
9
|
-
{"token":"04085b082214646572656b40676d61696c2e636f6d6c2b07e517794d22198e59d96b40ccbc3625964dfb8dcca21174835d7e"}
|
@@ -1 +0,0 @@
|
|
1
|
-
04085b082214646572656b40676d61696c2e636f6d6c2b07f014794d2219b3dd205faeaefc0a8c70bb3ba786628c8cb8d667
|
@@ -1,9 +0,0 @@
|
|
1
|
-
HTTP/1.1 400 Bad Request
|
2
|
-
Server: nginx/0.7.65
|
3
|
-
Date: Fri, 04 Mar 2011 02:19:28 GMT
|
4
|
-
Content-Type: text/html;charset=utf-8
|
5
|
-
Connection: keep-alive
|
6
|
-
Keep-Alive: timeout=20
|
7
|
-
Content-Length: 93
|
8
|
-
|
9
|
-
{"code":20001,"description":"A service with the name: \"redis-86b7a8655555\" already exists"}
|