vmc 0.2.6 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cli/commands/apps.rb +34 -29
- data/lib/cli/runner.rb +1 -1
- data/lib/cli/version.rb +1 -1
- data/lib/vmc/client.rb +8 -5
- data/lib/vmc/const.rb +1 -1
- metadata +2 -2
data/lib/cli/commands/apps.rb
CHANGED
@@ -35,7 +35,7 @@ module VMC::Cli::Command
|
|
35
35
|
TAIL_TICKS = 25/SLEEP_TIME
|
36
36
|
GIVEUP_TICKS = 120/SLEEP_TIME
|
37
37
|
|
38
|
-
def start(appname)
|
38
|
+
def start(appname, push = false)
|
39
39
|
app = client.app_info(appname)
|
40
40
|
return display "Application '#{appname}' could not be found".red if app.nil?
|
41
41
|
return display "Application '#{appname}' already started".yellow if app[:state] == 'STARTED'
|
@@ -58,7 +58,7 @@ module VMC::Cli::Command
|
|
58
58
|
# Check for the existance of crashes
|
59
59
|
display "\nError: Application [#{appname}] failed to start, logs information below.\n".red
|
60
60
|
grab_crash_logs(appname, '0', true)
|
61
|
-
if
|
61
|
+
if push
|
62
62
|
display "\n"
|
63
63
|
should_delete = ask 'Should I delete the application? (Y/n)? ' unless no_prompt
|
64
64
|
delete_app(appname, false) unless no_prompt || should_delete.upcase == 'N'
|
@@ -334,6 +334,8 @@ module VMC::Cli::Command
|
|
334
334
|
if appname
|
335
335
|
err "Application '#{appname}' already exists, use update" if app_exists?(appname)
|
336
336
|
app_checked = true
|
337
|
+
else
|
338
|
+
raise VMC::Client::AuthError unless client.logged_in?
|
337
339
|
end
|
338
340
|
|
339
341
|
# check if we have hit our app limit
|
@@ -427,17 +429,18 @@ module VMC::Cli::Command
|
|
427
429
|
display 'OK'.green
|
428
430
|
|
429
431
|
# Services check
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
432
|
+
unless no_prompt || @options[:noservices]
|
433
|
+
services = client.services_info
|
434
|
+
unless services.empty?
|
435
|
+
proceed = ask("Would you like to bind any services to '#{appname}'? [yN]: ")
|
436
|
+
bind_services(appname, services) if proceed.upcase == 'Y'
|
437
|
+
end
|
434
438
|
end
|
435
439
|
|
436
440
|
# Stage and upload the app bits.
|
437
441
|
upload_app_bits(appname, path)
|
438
442
|
|
439
|
-
|
440
|
-
start(appname) unless no_start
|
443
|
+
start(appname, true) unless no_start
|
441
444
|
end
|
442
445
|
|
443
446
|
private
|
@@ -445,7 +448,7 @@ module VMC::Cli::Command
|
|
445
448
|
def app_exists?(appname)
|
446
449
|
app_info = client.app_info(appname)
|
447
450
|
app_info != nil
|
448
|
-
rescue
|
451
|
+
rescue VMC::Client::NotFound
|
449
452
|
false
|
450
453
|
end
|
451
454
|
|
@@ -511,32 +514,34 @@ module VMC::Cli::Command
|
|
511
514
|
|
512
515
|
end
|
513
516
|
|
514
|
-
# It's possible the CC tells us that we don't need to pack anything.
|
515
|
-
# If so, exit early.
|
516
|
-
if VMC::Cli::ZipUtil.get_files_to_pack(explode_dir).empty?
|
517
|
-
display ' No resources need to be uploaded'
|
518
|
-
display 'Push Status: ', false
|
519
|
-
display 'OK'.green
|
520
|
-
return
|
521
|
-
end
|
522
|
-
|
523
517
|
# Perform Packing of the upload bits here.
|
524
|
-
|
525
|
-
|
526
|
-
|
518
|
+
unless VMC::Cli::ZipUtil.get_files_to_pack(explode_dir).empty?
|
519
|
+
display ' Packing application: ', false
|
520
|
+
VMC::Cli::ZipUtil.pack(explode_dir, upload_file)
|
521
|
+
display 'OK'.green
|
527
522
|
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
523
|
+
upload_size = File.size(upload_file);
|
524
|
+
if upload_size > 1024*1024
|
525
|
+
upload_size = (upload_size/(1024.0*1024.0)).round.to_s + 'M'
|
526
|
+
elsif upload_size > 0
|
527
|
+
upload_size = (upload_size/1024.0).round.to_s + 'K'
|
528
|
+
end
|
529
|
+
else
|
530
|
+
upload_size = '0K'
|
533
531
|
end
|
532
|
+
|
534
533
|
upload_str = " Uploading (#{upload_size}): "
|
535
534
|
display upload_str, false
|
536
|
-
|
537
|
-
|
538
|
-
|
535
|
+
|
536
|
+
unless VMC::Cli::ZipUtil.get_files_to_pack(explode_dir).empty?
|
537
|
+
FileWithPercentOutput.display_str = upload_str
|
538
|
+
FileWithPercentOutput.upload_size = File.size(upload_file);
|
539
|
+
file = FileWithPercentOutput.open(upload_file, 'rb')
|
540
|
+
end
|
541
|
+
|
539
542
|
client.upload_app(appname, file, appcloud_resources)
|
543
|
+
display 'OK'.green if VMC::Cli::ZipUtil.get_files_to_pack(explode_dir).empty?
|
544
|
+
|
540
545
|
display 'Push Status: ', false
|
541
546
|
display 'OK'.green
|
542
547
|
end
|
data/lib/cli/runner.rb
CHANGED
@@ -90,7 +90,7 @@ class VMC::Cli::Runner
|
|
90
90
|
|
91
91
|
def check_instances_delta!
|
92
92
|
return unless @args
|
93
|
-
instance_args = @args.select { |arg|
|
93
|
+
instance_args = @args.select { |arg| /^[-]\d+$/ =~ arg } || []
|
94
94
|
@args.delete_if { |arg| instance_args.include? arg}
|
95
95
|
instance_args
|
96
96
|
end
|
data/lib/cli/version.rb
CHANGED
data/lib/vmc/client.rb
CHANGED
@@ -87,12 +87,15 @@ class VMC::Client
|
|
87
87
|
#FIXME, manifest should be allowed to be null, here for compatability with old cc's
|
88
88
|
resource_manifest ||= []
|
89
89
|
check_login_status
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
upload_data = {:_method => 'put'}
|
91
|
+
if zipfile
|
92
|
+
if zipfile.is_a? File
|
93
|
+
file = zipfile
|
94
|
+
else
|
95
|
+
file = File.new(zipfile, 'rb')
|
96
|
+
end
|
97
|
+
upload_data[:application] = file
|
94
98
|
end
|
95
|
-
upload_data = {:application => file, :_method => 'put'}
|
96
99
|
upload_data[:resources] = resource_manifest.to_json if resource_manifest
|
97
100
|
http_post("#{VMC::APPS_PATH}/#{name}/application", upload_data)
|
98
101
|
end
|
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:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.10
|
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-04-
|
13
|
+
date: 2011-04-03 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|