vmc 0.0.8 → 0.2.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/LICENSE +8 -3
- data/README.md +83 -0
- data/Rakefile +11 -65
- data/bin/vmc +3 -2
- data/lib/cli/commands/admin.rb +57 -0
- data/lib/cli/commands/apps.rb +828 -0
- data/lib/cli/commands/base.rb +56 -0
- data/lib/cli/commands/misc.rb +99 -0
- data/lib/cli/commands/services.rb +84 -0
- data/lib/cli/commands/user.rb +60 -0
- data/lib/cli/config.rb +109 -0
- data/lib/cli/core_ext.rb +119 -0
- data/lib/cli/errors.rb +19 -0
- data/lib/cli/frameworks.rb +97 -0
- data/lib/cli/runner.rb +437 -0
- data/lib/cli/services_helper.rb +74 -0
- data/lib/cli/usage.rb +94 -0
- data/lib/cli/version.rb +5 -0
- data/lib/cli/zip_util.rb +61 -0
- data/lib/cli.rb +30 -0
- data/lib/vmc/client.rb +415 -0
- data/lib/vmc/const.rb +19 -0
- data/lib/vmc.rb +2 -1589
- data/spec/assets/app_info.txt +9 -0
- data/spec/assets/app_listings.txt +9 -0
- data/spec/assets/bad_create_app.txt +9 -0
- data/spec/assets/delete_app.txt +9 -0
- data/spec/assets/global_service_listings.txt +9 -0
- data/spec/assets/good_create_app.txt +9 -0
- data/spec/assets/good_create_service.txt +9 -0
- data/spec/assets/info_authenticated.txt +27 -0
- data/spec/assets/info_return.txt +15 -0
- data/spec/assets/info_return_bad.txt +16 -0
- data/spec/assets/login_fail.txt +9 -0
- data/spec/assets/login_success.txt +9 -0
- data/spec/assets/sample_token.txt +1 -0
- data/spec/assets/service_already_exists.txt +9 -0
- data/spec/assets/service_listings.txt +9 -0
- data/spec/assets/service_not_found.txt +9 -0
- data/spec/assets/user_info.txt +9 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/unit/cli_opts_spec.rb +73 -0
- data/spec/unit/client_spec.rb +284 -0
- metadata +114 -71
- data/README +0 -58
- data/lib/parse.rb +0 -719
- data/lib/vmc_base.rb +0 -205
- data/vendor/gems/httpclient/VERSION +0 -1
- data/vendor/gems/httpclient/lib/http-access2/cookie.rb +0 -1
- data/vendor/gems/httpclient/lib/http-access2/http.rb +0 -1
- data/vendor/gems/httpclient/lib/http-access2.rb +0 -53
- data/vendor/gems/httpclient/lib/httpclient/auth.rb +0 -522
- data/vendor/gems/httpclient/lib/httpclient/cacert.p7s +0 -1579
- data/vendor/gems/httpclient/lib/httpclient/cacert_sha1.p7s +0 -1579
- data/vendor/gems/httpclient/lib/httpclient/connection.rb +0 -84
- data/vendor/gems/httpclient/lib/httpclient/cookie.rb +0 -562
- data/vendor/gems/httpclient/lib/httpclient/http.rb +0 -867
- data/vendor/gems/httpclient/lib/httpclient/session.rb +0 -864
- data/vendor/gems/httpclient/lib/httpclient/ssl_config.rb +0 -417
- data/vendor/gems/httpclient/lib/httpclient/timeout.rb +0 -136
- data/vendor/gems/httpclient/lib/httpclient/util.rb +0 -86
- data/vendor/gems/httpclient/lib/httpclient.rb +0 -1020
- data/vendor/gems/httpclient/lib/tags +0 -908
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Copyright (c) 2010 VMware Inc, All Rights Reserved
|
1
|
+
Copyright (c) 2010-2011 VMware Inc, All Rights Reserved
|
2
2
|
|
3
|
-
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
5
5
|
in the Software without restriction, including without limitation the rights
|
6
6
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
@@ -16,4 +16,9 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
16
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
17
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
18
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
21
|
+
This software downloads additional open source software components upon install
|
22
|
+
that are distributed under separate terms and conditions. Please see the license
|
23
|
+
information provided in the individual software components for more information.
|
24
|
+
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# VMC
|
2
|
+
|
3
|
+
The VMware Cloud CLI. This is the command line interface to VMware's Application Platform
|
4
|
+
|
5
|
+
_Copyright 2010-2011, VMware, Inc. Licensed under the
|
6
|
+
MIT license, please see the LICENSE file. All rights reserved._
|
7
|
+
|
8
|
+
Usage: vmc [options] command [<args>] [command_options]
|
9
|
+
Try 'vmc help [command]' or 'vmc help options' for more information.
|
10
|
+
|
11
|
+
Currently available vmc commands are:
|
12
|
+
|
13
|
+
Getting Started
|
14
|
+
target [url] Reports current target or sets a new target
|
15
|
+
login [email] [--email, --passwd] Login
|
16
|
+
info System and account information
|
17
|
+
|
18
|
+
Applications
|
19
|
+
apps List deployed applications
|
20
|
+
|
21
|
+
Application Creation
|
22
|
+
push [appname] Create, push, map, and start a new application
|
23
|
+
push [appname] --path Push application from specified path
|
24
|
+
push [appname] --url Set the url for the application
|
25
|
+
push [appname] --instances <N> Set the expected number <N> of instances
|
26
|
+
push [appname] --mem M Set the memory reservation for the application
|
27
|
+
push [appname] --no-start Do not auto-start the application
|
28
|
+
|
29
|
+
Application Operations
|
30
|
+
start <appname> Start the application
|
31
|
+
stop <appname> Stop the application
|
32
|
+
restart <appname> Restart the application
|
33
|
+
delete <appname> Delete the application
|
34
|
+
rename <appname> <newname> Rename the application
|
35
|
+
|
36
|
+
Application Updates
|
37
|
+
update <appname> [--path] Update the application bits
|
38
|
+
mem <appname> [memsize] Update the memory reservation for an application
|
39
|
+
map <appname> <url> Register the application to the url
|
40
|
+
unmap <appname> <url> Unregister the application from the url
|
41
|
+
instances <appname> <num|delta> Scale the application instances up or down
|
42
|
+
|
43
|
+
Application Information
|
44
|
+
crashes <appname> List recent application crashes
|
45
|
+
crashlogs <appname> Display log information for crashed applications
|
46
|
+
logs <appname> [--all] Display log information for the application
|
47
|
+
files <appname> [path] [--all] Display directory listing or file download for path
|
48
|
+
stats <appname> Display resource usage for the application
|
49
|
+
instances <appname> List application instances
|
50
|
+
|
51
|
+
Services
|
52
|
+
services Lists of services available and provisioned
|
53
|
+
create-service <service> [--name,--bind] Create a provisioned service
|
54
|
+
create-service <service> <name> Create a provisioned service and assign it <name>
|
55
|
+
create-service <service> <name> <app> Create a provisioned service and assign it <name>, and bind to <app>
|
56
|
+
delete-service [servicename] Delete a provisioned service
|
57
|
+
bind-service <servicename> <appname> Bind a service to an application
|
58
|
+
unbind-service <servicename> <appname> Unbind service from the application
|
59
|
+
clone-services <src-app> <dest-app> Clone service bindings from <src-app> application to <dest-app>
|
60
|
+
|
61
|
+
Administration
|
62
|
+
user Display user account information
|
63
|
+
passwd Change the password for the current user
|
64
|
+
logout Logs current user out of the target system
|
65
|
+
add-user [--email, --passwd] Register a new user (requires admin privileges)
|
66
|
+
delete-user <user> Delete a user and all apps and services (requires admin privileges)
|
67
|
+
|
68
|
+
Misc
|
69
|
+
aliases List aliases
|
70
|
+
alias <alias[=]command> Create an alias for a command
|
71
|
+
unalias <alias> Remove an alias
|
72
|
+
targets List known targets and associated authorization tokens
|
73
|
+
|
74
|
+
Help
|
75
|
+
help [command] Get general help or help on a specific command
|
76
|
+
help options Get help on available options
|
77
|
+
|
78
|
+
## Simple Story (for Ruby apps)
|
79
|
+
|
80
|
+
vmc target api.vcloudlabs.com
|
81
|
+
vmc login
|
82
|
+
bundle package
|
83
|
+
vmc push
|
data/Rakefile
CHANGED
@@ -1,70 +1,16 @@
|
|
1
|
-
require '
|
2
|
-
require 'rake/gempackagetask'
|
3
|
-
require 'rubygems/specification'
|
4
|
-
require 'date'
|
1
|
+
require 'rake'
|
5
2
|
require 'spec/rake/spectask'
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
s.description = s.summary = "A gem that provides command line access to the VMware Cloud Application Platform"
|
14
|
-
s.platform = Gem::Platform::RUBY
|
15
|
-
s.has_rdoc = true
|
16
|
-
s.extra_rdoc_files = ["README", "LICENSE"]
|
17
|
-
s.executables = %w(vmc)
|
18
|
-
# Uncomment this to add a dependency
|
19
|
-
s.add_dependency "main", "~> 4.3.0"
|
20
|
-
s.add_dependency "arrayfields", "~> 4.7.4"
|
21
|
-
s.add_dependency "fattr", "~> 2.2.0"
|
22
|
-
s.add_dependency "json_pure", "~> 1.4.6"
|
23
|
-
s.add_dependency "mime-types", "~> 1.16"
|
24
|
-
s.add_dependency "rubyzip2", "~> 2.0.1"
|
25
|
-
s.add_dependency "highline", "~> 1.6.1"
|
26
|
-
|
27
|
-
s.bindir = "bin"
|
28
|
-
s.require_path = 'lib'
|
29
|
-
s.files = %w(LICENSE README Rakefile) + Dir.glob("{lib,spec,vendor}/**/*")
|
30
|
-
end
|
31
|
-
|
32
|
-
task :default => :package
|
33
|
-
|
34
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
35
|
-
pkg.gem_spec = spec
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "install the gem locally"
|
39
|
-
task :install => [:package] do
|
40
|
-
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "create a gemspec file"
|
44
|
-
task :make_spec do
|
45
|
-
File.open("#{GEM}.gemspec", "w") do |file|
|
46
|
-
file.puts spec.to_ruby
|
4
|
+
desc "Run specs"
|
5
|
+
task :spec do
|
6
|
+
sh('bundle install')
|
7
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
8
|
+
t.spec_opts = %w(-fs -c)
|
9
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
47
10
|
end
|
48
11
|
end
|
49
12
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
desc "Install gems for test"
|
57
|
-
task "install:test" do
|
58
|
-
sh("bundle install --without development production")
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "Install gems for production"
|
62
|
-
task "install:production" do
|
63
|
-
sh("bundle install --without development test")
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "Install gems for development"
|
67
|
-
task "install:development" do
|
68
|
-
sh("bundle install --without test production")
|
69
|
-
end
|
70
|
-
end
|
13
|
+
desc "Synonym for spec"
|
14
|
+
task :test => :spec
|
15
|
+
desc "Synonym for spec"
|
16
|
+
task :tests => :spec
|
data/bin/vmc
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
module VMC::Cli::Command
|
2
|
+
|
3
|
+
class Admin < Base
|
4
|
+
|
5
|
+
def add_user(email=nil)
|
6
|
+
email = @options[:email] unless email
|
7
|
+
password = @options[:password]
|
8
|
+
email = ask("Email: ") unless no_prompt || email
|
9
|
+
unless no_prompt || password
|
10
|
+
password = ask("Password: ") {|q| q.echo = '*'}
|
11
|
+
password2 = ask("Verify Password: ") {|q| q.echo = '*'}
|
12
|
+
err "Passwords did not match, try again" if password != password2
|
13
|
+
end
|
14
|
+
err "Need a valid email" unless email
|
15
|
+
err "Need a password" unless password
|
16
|
+
display 'Creating New User: ', false
|
17
|
+
client.add_user(email, password)
|
18
|
+
display 'OK'.green
|
19
|
+
|
20
|
+
# if we are not logged in, log in as the new user
|
21
|
+
return unless VMC::Cli::Config.auth_token.nil?
|
22
|
+
@options[:password] = password
|
23
|
+
cmd = User.new(@options)
|
24
|
+
cmd.login(email)
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete_user(user_email)
|
28
|
+
# Check to make sure all apps and services are deleted before deleting the user
|
29
|
+
# implicit proxying
|
30
|
+
|
31
|
+
client.proxy_for(user_email)
|
32
|
+
@options[:proxy] = user_email
|
33
|
+
apps = client.apps
|
34
|
+
|
35
|
+
if (apps && !apps.empty?)
|
36
|
+
unless no_prompt
|
37
|
+
proceed = ask("\nDeployed applications and associated services will be DELETED, continue? [yN]: ")
|
38
|
+
err "Aborted" if proceed.upcase != 'Y'
|
39
|
+
end
|
40
|
+
cmd = Apps.new(@options)
|
41
|
+
apps.each { |app| cmd.delete_app(app[:name], true) }
|
42
|
+
end
|
43
|
+
|
44
|
+
services = client.services
|
45
|
+
if (services && !services.empty?)
|
46
|
+
cmd = Services.new(@options)
|
47
|
+
services.each { |s| cmd.delete_service(s[:name])}
|
48
|
+
end
|
49
|
+
|
50
|
+
display 'Deleting User: ', false
|
51
|
+
client.delete_user(user_email)
|
52
|
+
display 'OK'.green
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|