vmc-IronFoundry 0.3.16.IF.1 → 0.3.16.IF.2
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/Rakefile +2 -0
- data/lib/cli/commands/apps.rb +120 -97
- data/lib/cli/frameworks.rb +128 -31
- data/lib/cli/manifest_helper.rb +56 -16
- data/lib/cli/runner.rb +1 -2
- data/lib/cli/version.rb +1 -1
- metadata +22 -22
data/Rakefile
CHANGED
@@ -30,6 +30,8 @@ TESTS_TO_BUILD = ["#{TESTS_PATH}/java_web/java_tiny_app",
|
|
30
30
|
"#{TESTS_PATH}/lift/hello_lift",
|
31
31
|
"#{TESTS_PATH}/spring/roo-guestbook",
|
32
32
|
"#{TESTS_PATH}/spring/spring-osgi-hello",
|
33
|
+
"#{TESTS_PATH}/standalone/java_app",
|
34
|
+
"#{TESTS_PATH}/standalone/python_app"
|
33
35
|
]
|
34
36
|
|
35
37
|
desc "Build the tests. If the git hash associated with the test assets has not changed, nothing is built. To force a build, invoke 'rake build[--force]'"
|
data/lib/cli/commands/apps.rb
CHANGED
@@ -371,7 +371,6 @@ module VMC::Cli::Command
|
|
371
371
|
|
372
372
|
def check_deploy_directory(path)
|
373
373
|
err 'Deployment path does not exist' unless File.exists? path
|
374
|
-
err 'Deployment path is not a directory' unless File.directory? path
|
375
374
|
return if File.expand_path(Dir.tmpdir) != File.expand_path(path)
|
376
375
|
err "Can't deploy applications from staging directory: [#{Dir.tmpdir}]"
|
377
376
|
end
|
@@ -410,101 +409,112 @@ module VMC::Cli::Command
|
|
410
409
|
explode_dir = "#{Dir.tmpdir}/.vmc_#{appname}_files"
|
411
410
|
FileUtils.rm_rf(explode_dir) # Make sure we didn't have anything left over..
|
412
411
|
|
413
|
-
|
414
|
-
#
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
412
|
+
if path =~ /\.(war|zip)$/
|
413
|
+
#single file that needs unpacking
|
414
|
+
VMC::Cli::ZipUtil.unpack(path, explode_dir)
|
415
|
+
elsif !File.directory? path
|
416
|
+
#single file that doesn't need unpacking
|
417
|
+
FileUtils.mkdir(explode_dir)
|
418
|
+
FileUtils.cp(path,explode_dir)
|
419
|
+
else
|
420
|
+
Dir.chdir(path) do
|
421
|
+
# Stage the app appropriately and do the appropriate fingerprinting, etc.
|
422
|
+
if war_file = Dir.glob('*.war').first
|
423
|
+
VMC::Cli::ZipUtil.unpack(war_file, explode_dir)
|
424
|
+
elsif zip_file = Dir.glob('*.zip').first
|
425
|
+
VMC::Cli::ZipUtil.unpack(zip_file, explode_dir)
|
426
|
+
else
|
427
|
+
check_unreachable_links(path)
|
428
|
+
FileUtils.mkdir(explode_dir)
|
420
429
|
|
421
|
-
|
430
|
+
files = Dir.glob('{*,.[^\.]*}')
|
422
431
|
|
423
|
-
|
424
|
-
|
432
|
+
# Do not process .git files
|
433
|
+
files.delete('.git') if files
|
425
434
|
|
426
|
-
|
435
|
+
FileUtils.cp_r(files, explode_dir)
|
427
436
|
|
428
|
-
|
429
|
-
|
437
|
+
find_sockets(explode_dir).each do |s|
|
438
|
+
File.delete s
|
439
|
+
end
|
430
440
|
end
|
431
441
|
end
|
442
|
+
end
|
432
443
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
# Check to see if the resource check is worth the round trip
|
450
|
-
if (total_size > (64*1024)) # 64k for now
|
451
|
-
# Send resource fingerprints to the cloud controller
|
452
|
-
appcloud_resources = client.check_resources(fingerprints)
|
453
|
-
end
|
454
|
-
display 'OK'.green
|
455
|
-
|
456
|
-
if appcloud_resources
|
457
|
-
display ' Processing resources: ', false
|
458
|
-
# We can then delete what we do not need to send.
|
459
|
-
appcloud_resources.each do |resource|
|
460
|
-
FileUtils.rm_f resource[:fn]
|
461
|
-
# adjust filenames sans the explode_dir prefix
|
462
|
-
resource[:fn].sub!("#{explode_dir}/", '')
|
463
|
-
end
|
464
|
-
display 'OK'.green
|
465
|
-
end
|
444
|
+
# Send the resource list to the cloudcontroller, the response will tell us what it already has..
|
445
|
+
unless @options[:noresources]
|
446
|
+
display ' Checking for available resources: ', false
|
447
|
+
fingerprints = []
|
448
|
+
total_size = 0
|
449
|
+
resource_files = Dir.glob("#{explode_dir}/**/*", File::FNM_DOTMATCH)
|
450
|
+
resource_files.each do |filename|
|
451
|
+
next if (File.directory?(filename) || !File.exists?(filename))
|
452
|
+
fingerprints << {
|
453
|
+
:size => File.size(filename),
|
454
|
+
:sha1 => Digest::SHA1.file(filename).hexdigest,
|
455
|
+
:fn => filename
|
456
|
+
}
|
457
|
+
total_size += File.size(filename)
|
458
|
+
end
|
466
459
|
|
460
|
+
# Check to see if the resource check is worth the round trip
|
461
|
+
if (total_size > (64*1024)) # 64k for now
|
462
|
+
# Send resource fingerprints to the cloud controller
|
463
|
+
appcloud_resources = client.check_resources(fingerprints)
|
467
464
|
end
|
465
|
+
display 'OK'.green
|
468
466
|
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
467
|
+
if appcloud_resources
|
468
|
+
display ' Processing resources: ', false
|
469
|
+
# We can then delete what we do not need to send.
|
470
|
+
appcloud_resources.each do |resource|
|
471
|
+
FileUtils.rm_f resource[:fn]
|
472
|
+
# adjust filenames sans the explode_dir prefix
|
473
|
+
resource[:fn].sub!("#{explode_dir}/", '')
|
474
474
|
end
|
475
|
+
display 'OK'.green
|
475
476
|
end
|
476
|
-
# Perform Packing of the upload bits here.
|
477
|
-
display ' Packing application: ', false
|
478
|
-
VMC::Cli::ZipUtil.pack(explode_dir, upload_file)
|
479
|
-
display 'OK'.green
|
480
477
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
478
|
+
end
|
479
|
+
|
480
|
+
# If no resource needs to be sent, add an empty file to ensure we have
|
481
|
+
# a multi-part request that is expected by nginx fronting the CC.
|
482
|
+
if VMC::Cli::ZipUtil.get_files_to_pack(explode_dir).empty?
|
483
|
+
Dir.chdir(explode_dir) do
|
484
|
+
File.new(".__empty__", "w")
|
488
485
|
end
|
486
|
+
end
|
487
|
+
# Perform Packing of the upload bits here.
|
488
|
+
display ' Packing application: ', false
|
489
|
+
VMC::Cli::ZipUtil.pack(explode_dir, upload_file)
|
490
|
+
display 'OK'.green
|
489
491
|
|
490
|
-
|
491
|
-
|
492
|
+
upload_size = File.size(upload_file);
|
493
|
+
if upload_size > 1024*1024
|
494
|
+
upload_size = (upload_size/(1024.0*1024.0)).round.to_s + 'M'
|
495
|
+
elsif upload_size > 0
|
496
|
+
upload_size = (upload_size/1024.0).round.to_s + 'K'
|
497
|
+
else
|
498
|
+
upload_size = '0K'
|
499
|
+
end
|
492
500
|
|
493
|
-
|
494
|
-
|
495
|
-
file = FileWithPercentOutput.open(upload_file, 'rb')
|
501
|
+
upload_str = " Uploading (#{upload_size}): "
|
502
|
+
display upload_str, false
|
496
503
|
|
497
|
-
|
498
|
-
|
504
|
+
FileWithPercentOutput.display_str = upload_str
|
505
|
+
FileWithPercentOutput.upload_size = File.size(upload_file);
|
506
|
+
file = FileWithPercentOutput.open(upload_file, 'rb')
|
499
507
|
|
500
|
-
|
501
|
-
|
502
|
-
end
|
508
|
+
client.upload_app(appname, file, appcloud_resources)
|
509
|
+
display 'OK'.green if VMC::Cli::ZipUtil.get_files_to_pack(explode_dir).empty?
|
503
510
|
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
511
|
+
display 'Push Status: ', false
|
512
|
+
display 'OK'.green
|
513
|
+
|
514
|
+
ensure
|
515
|
+
# Cleanup if we created an exploded directory.
|
516
|
+
FileUtils.rm_f(upload_file) if upload_file
|
517
|
+
FileUtils.rm_rf(explode_dir) if explode_dir
|
508
518
|
end
|
509
519
|
|
510
520
|
def check_app_limit
|
@@ -908,6 +918,8 @@ module VMC::Cli::Command
|
|
908
918
|
url = info(:url) || info(:urls)
|
909
919
|
mem, memswitch = nil, info(:mem)
|
910
920
|
memswitch = normalize_mem(memswitch) if memswitch
|
921
|
+
command = info(:command)
|
922
|
+
runtime = info(:runtime)
|
911
923
|
|
912
924
|
# Check app existing upfront if we have appname
|
913
925
|
app_checked = false
|
@@ -934,9 +946,30 @@ module VMC::Cli::Command
|
|
934
946
|
err "Application '#{appname}' already exists, use update or delete."
|
935
947
|
end
|
936
948
|
|
937
|
-
|
949
|
+
if ignore_framework
|
950
|
+
framework = VMC::Cli::Framework.new
|
951
|
+
elsif f = info(:framework)
|
952
|
+
info = Hash[f["info"].collect { |k, v| [k.to_sym, v] }]
|
953
|
+
|
954
|
+
framework = VMC::Cli::Framework.create(f["name"], info)
|
955
|
+
exec = framework.exec if framework && framework.exec
|
956
|
+
else
|
957
|
+
framework = detect_framework(prompt_ok)
|
958
|
+
end
|
959
|
+
|
960
|
+
err "Application Type undetermined for path '#{@application}'" unless framework
|
961
|
+
|
962
|
+
if not runtime
|
963
|
+
default_runtime = framework.default_runtime @application
|
964
|
+
runtime = detect_runtime(default_runtime, !no_prompt) if framework.prompt_for_runtime?
|
965
|
+
end
|
966
|
+
command = ask("Start Command") if !command && framework.require_start_command?
|
967
|
+
|
968
|
+
default_url = "None"
|
969
|
+
default_url = "#{appname}.#{VMC::Cli::Config.suggest_url}" if framework.require_url?
|
970
|
+
|
938
971
|
|
939
|
-
unless no_prompt || url
|
972
|
+
unless no_prompt || url || !framework.require_url?
|
940
973
|
url = ask(
|
941
974
|
"Application Deployed URL",
|
942
975
|
:default => default_url
|
@@ -947,29 +980,18 @@ module VMC::Cli::Command
|
|
947
980
|
# this common error
|
948
981
|
url = nil if YES_SET.member? url
|
949
982
|
end
|
950
|
-
|
983
|
+
url = nil if url == "None"
|
984
|
+
default_url = nil if default_url == "None"
|
951
985
|
url ||= default_url
|
952
986
|
|
953
|
-
if ignore_framework
|
954
|
-
framework = VMC::Cli::Framework.new
|
955
|
-
elsif f = info(:framework)
|
956
|
-
info = Hash[f["info"].collect { |k, v| [k.to_sym, v] }]
|
957
|
-
|
958
|
-
framework = VMC::Cli::Framework.new(f["name"], info)
|
959
|
-
exec = framework.exec if framework && framework.exec
|
960
|
-
else
|
961
|
-
framework = detect_framework(prompt_ok)
|
962
|
-
end
|
963
|
-
|
964
|
-
err "Application Type undetermined for path '#{@application}'" unless framework
|
965
|
-
|
966
987
|
if memswitch
|
967
988
|
mem = memswitch
|
968
989
|
elsif prompt_ok
|
969
990
|
mem = ask("Memory Reservation",
|
970
|
-
:default => framework.memory,
|
991
|
+
:default => framework.memory(runtime),
|
992
|
+
:choices => mem_choices)
|
971
993
|
else
|
972
|
-
mem = framework.memory
|
994
|
+
mem = framework.memory runtime
|
973
995
|
end
|
974
996
|
|
975
997
|
# Set to MB number
|
@@ -984,14 +1006,15 @@ module VMC::Cli::Command
|
|
984
1006
|
:name => "#{appname}",
|
985
1007
|
:staging => {
|
986
1008
|
:framework => framework.name,
|
987
|
-
:runtime =>
|
1009
|
+
:runtime => runtime
|
988
1010
|
},
|
989
1011
|
:uris => Array(url),
|
990
1012
|
:instances => instances,
|
991
1013
|
:resources => {
|
992
1014
|
:memory => mem_quota
|
993
|
-
}
|
1015
|
+
}
|
994
1016
|
}
|
1017
|
+
manifest[:staging][:command] = command if command
|
995
1018
|
|
996
1019
|
# Send the manifest to the cloud controller
|
997
1020
|
client.create_app(appname, manifest)
|
data/lib/cli/frameworks.rb
CHANGED
@@ -11,6 +11,7 @@ module VMC::Cli
|
|
11
11
|
'Grails' => ['grails', { :mem => '512M', :description => 'Java SpringSource Grails Application'}],
|
12
12
|
'Lift' => ['lift', { :mem => '512M', :description => 'Scala Lift Application'}],
|
13
13
|
'JavaWeb' => ['java_web',{ :mem => '512M', :description => 'Java Web Application'}],
|
14
|
+
'Standalone' => ['standalone', { :mem => '64M', :description => 'Standalone Application'}],
|
14
15
|
'Sinatra' => ['sinatra', { :mem => '128M', :description => 'Sinatra Application'}],
|
15
16
|
'Node' => ['node', { :mem => '64M', :description => 'Node.js Application'}],
|
16
17
|
'PHP' => ['php', { :mem => '128M', :description => 'PHP Application'}],
|
@@ -28,16 +29,33 @@ module VMC::Cli
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def lookup(name)
|
31
|
-
return
|
32
|
+
return create(*FRAMEWORKS[name])
|
32
33
|
end
|
33
34
|
|
34
35
|
def lookup_by_framework(name)
|
35
36
|
FRAMEWORKS.each do |key,fw|
|
36
|
-
return
|
37
|
+
return create(fw[0],fw[1]) if fw[0] == name
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def create(name,opts)
|
42
|
+
if name == "standalone"
|
43
|
+
return StandaloneFramework.new(name, opts)
|
44
|
+
else
|
45
|
+
return Framework.new(name,opts)
|
37
46
|
end
|
38
47
|
end
|
39
48
|
|
40
49
|
def detect(path, available_frameworks)
|
50
|
+
if !File.directory? path
|
51
|
+
if path.end_with?('.war')
|
52
|
+
return detect_framework_from_war path
|
53
|
+
elsif available_frameworks.include?(["standalone"])
|
54
|
+
return Framework.lookup('Standalone')
|
55
|
+
else
|
56
|
+
return nil
|
57
|
+
end
|
58
|
+
end
|
41
59
|
Dir.chdir(path) do
|
42
60
|
# Rails
|
43
61
|
if File.exist?('config/environment.rb')
|
@@ -47,30 +65,13 @@ module VMC::Cli
|
|
47
65
|
elsif File.exist?('config.ru') && available_frameworks.include?(["rack"])
|
48
66
|
return Framework.lookup('Rack')
|
49
67
|
|
50
|
-
# Java
|
51
|
-
elsif Dir.glob('*.war').first
|
52
|
-
|
68
|
+
# Java Web Apps
|
69
|
+
elsif Dir.glob('*.war').first
|
70
|
+
return detect_framework_from_war(Dir.glob('*.war').first)
|
53
71
|
|
54
|
-
|
55
|
-
|
56
|
-
else
|
57
|
-
contents = Dir['**/*'].join("\n")
|
58
|
-
end
|
72
|
+
elsif File.exist?('WEB-INF/web.xml')
|
73
|
+
return detect_framework_from_war
|
59
74
|
|
60
|
-
# Spring/Lift Variations
|
61
|
-
if contents =~ /WEB-INF\/lib\/grails-web.*\.jar/
|
62
|
-
return Framework.lookup('Grails')
|
63
|
-
elsif contents =~ /WEB-INF\/lib\/lift-webkit.*\.jar/
|
64
|
-
return Framework.lookup('Lift')
|
65
|
-
elsif contents =~ /WEB-INF\/classes\/org\/springframework/
|
66
|
-
return Framework.lookup('Spring')
|
67
|
-
elsif contents =~ /WEB-INF\/lib\/spring-core.*\.jar/
|
68
|
-
return Framework.lookup('Spring')
|
69
|
-
elsif contents =~ /WEB-INF\/lib\/org\.springframework\.core.*\.jar/
|
70
|
-
return Framework.lookup('Spring')
|
71
|
-
else
|
72
|
-
return Framework.lookup('JavaWeb')
|
73
|
-
end
|
74
75
|
# Simple Ruby Apps
|
75
76
|
elsif !Dir.glob('*.rb').empty?
|
76
77
|
matched_file = nil
|
@@ -82,11 +83,11 @@ module VMC::Cli
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
if matched_file
|
86
|
+
# Sinatra apps
|
85
87
|
f = Framework.lookup('Sinatra')
|
86
88
|
f.exec = "ruby #{matched_file}"
|
87
89
|
return f
|
88
90
|
end
|
89
|
-
|
90
91
|
# Node.js
|
91
92
|
elsif !Dir.glob('*.js').empty?
|
92
93
|
if File.exist?('server.js') || File.exist?('app.js') || File.exist?('index.js') || File.exist?('main.js')
|
@@ -98,7 +99,6 @@ module VMC::Cli
|
|
98
99
|
if File.exist?('web.config')
|
99
100
|
return Framework.lookup('ASP.NET 4.0')
|
100
101
|
end
|
101
|
-
|
102
102
|
# PHP
|
103
103
|
elsif !Dir.glob('*.php').empty?
|
104
104
|
return Framework.lookup('PHP')
|
@@ -115,19 +115,42 @@ module VMC::Cli
|
|
115
115
|
# Python
|
116
116
|
elsif !Dir.glob('wsgi.py').empty?
|
117
117
|
return Framework.lookup('WSGI')
|
118
|
-
|
119
118
|
end
|
119
|
+
|
120
|
+
# Default to Standalone if no other match was made
|
121
|
+
return Framework.lookup('Standalone') if available_frameworks.include?(["standalone"])
|
120
122
|
end
|
121
|
-
nil
|
122
123
|
end
|
123
124
|
|
125
|
+
private
|
126
|
+
def detect_framework_from_war(war_file=nil)
|
127
|
+
if war_file
|
128
|
+
contents = ZipUtil.entry_lines(war_file)
|
129
|
+
else
|
130
|
+
#assume we are working with current dir
|
131
|
+
contents = Dir['**/*'].join("\n")
|
132
|
+
end
|
133
|
+
|
134
|
+
# Spring/Lift Variations
|
135
|
+
if contents =~ /WEB-INF\/lib\/grails-web.*\.jar/
|
136
|
+
return Framework.lookup('Grails')
|
137
|
+
elsif contents =~ /WEB-INF\/lib\/lift-webkit.*\.jar/
|
138
|
+
return Framework.lookup('Lift')
|
139
|
+
elsif contents =~ /WEB-INF\/classes\/org\/springframework/
|
140
|
+
return Framework.lookup('Spring')
|
141
|
+
elsif contents =~ /WEB-INF\/lib\/spring-core.*\.jar/
|
142
|
+
return Framework.lookup('Spring')
|
143
|
+
elsif contents =~ /WEB-INF\/lib\/org\.springframework\.core.*\.jar/
|
144
|
+
return Framework.lookup('Spring')
|
145
|
+
else
|
146
|
+
return Framework.lookup('JavaWeb')
|
147
|
+
end
|
148
|
+
end
|
124
149
|
end
|
125
150
|
|
126
|
-
attr_reader :name, :description, :
|
151
|
+
attr_reader :name, :description, :console
|
127
152
|
attr_accessor :exec
|
128
153
|
|
129
|
-
alias :mem :memory
|
130
|
-
|
131
154
|
def initialize(framework=nil, opts={})
|
132
155
|
@name = framework || DEFAULT_FRAMEWORK
|
133
156
|
@memory = opts[:mem] || DEFAULT_MEM
|
@@ -139,6 +162,80 @@ module VMC::Cli
|
|
139
162
|
def to_s
|
140
163
|
description
|
141
164
|
end
|
165
|
+
|
166
|
+
def require_url?
|
167
|
+
true
|
168
|
+
end
|
169
|
+
|
170
|
+
def require_start_command?
|
171
|
+
false
|
172
|
+
end
|
173
|
+
|
174
|
+
def prompt_for_runtime?
|
175
|
+
false
|
176
|
+
end
|
177
|
+
|
178
|
+
def default_runtime(path)
|
179
|
+
nil
|
180
|
+
end
|
181
|
+
|
182
|
+
def memory(runtime=nil)
|
183
|
+
@memory
|
184
|
+
end
|
185
|
+
|
186
|
+
alias :mem :memory
|
187
|
+
end
|
188
|
+
|
189
|
+
class StandaloneFramework < Framework
|
190
|
+
def require_url?
|
191
|
+
false
|
192
|
+
end
|
193
|
+
|
194
|
+
def require_start_command?
|
195
|
+
true
|
196
|
+
end
|
197
|
+
|
198
|
+
def prompt_for_runtime?
|
199
|
+
true
|
200
|
+
end
|
201
|
+
|
202
|
+
def default_runtime(path)
|
203
|
+
if !File.directory? path
|
204
|
+
if path =~ /\.(jar|class)$/
|
205
|
+
return "java"
|
206
|
+
elsif path =~ /\.(rb)$/
|
207
|
+
return "ruby18"
|
208
|
+
elsif path =~ /\.(zip)$/
|
209
|
+
return detect_runtime_from_zip path
|
210
|
+
end
|
211
|
+
else
|
212
|
+
Dir.chdir(path) do
|
213
|
+
return "ruby18" if not Dir.glob('**/*.rb').empty?
|
214
|
+
if !Dir.glob('**/*.class').empty? || !Dir.glob('**/*.jar').empty?
|
215
|
+
return "java"
|
216
|
+
elsif Dir.glob('*.zip').first
|
217
|
+
zip_file = Dir.glob('*.zip').first
|
218
|
+
return detect_runtime_from_zip zip_file
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
return nil
|
223
|
+
end
|
224
|
+
|
225
|
+
def memory(runtime=nil)
|
226
|
+
default_mem = @memory
|
227
|
+
default_mem = '128M' if runtime =~ /\Aruby/ || runtime == "php"
|
228
|
+
default_mem = '512M' if runtime == "java"
|
229
|
+
default_mem
|
230
|
+
end
|
231
|
+
|
232
|
+
private
|
233
|
+
def detect_runtime_from_zip(zip_file)
|
234
|
+
contents = ZipUtil.entry_lines(zip_file)
|
235
|
+
if contents =~ /\.(jar)$/
|
236
|
+
return "java"
|
237
|
+
end
|
238
|
+
end
|
142
239
|
end
|
143
240
|
|
144
241
|
end
|
data/lib/cli/manifest_helper.rb
CHANGED
@@ -82,22 +82,11 @@ module VMC::Cli::ManifestHelper
|
|
82
82
|
name = manifest("name") ||
|
83
83
|
set(ask("Application Name", :default => manifest("name")), "name")
|
84
84
|
|
85
|
-
url_template = manifest("url") || DEFAULTS["url"]
|
86
|
-
url_resolved = url_template.dup
|
87
|
-
resolve_lexically(url_resolved)
|
88
|
-
|
89
|
-
url = ask("Application Deployed URL", :default => url_resolved)
|
90
|
-
|
91
|
-
url = url_template if url == url_resolved
|
92
|
-
|
93
|
-
# common error case is for prompted users to answer y or Y or yes or
|
94
|
-
# YES to this ask() resulting in an unintended URL of y. Special
|
95
|
-
# case this common error
|
96
|
-
url = DEFAULTS["url"] if YES_SET.member? url
|
97
85
|
|
98
|
-
set url, "url"
|
99
86
|
|
100
|
-
|
87
|
+
if manifest "framework"
|
88
|
+
framework = VMC::Cli::Framework.lookup_by_framework manifest("framework","name")
|
89
|
+
else
|
101
90
|
framework = detect_framework
|
102
91
|
set framework.name, "framework", "name"
|
103
92
|
set(
|
@@ -110,11 +99,44 @@ module VMC::Cli::ManifestHelper
|
|
110
99
|
)
|
111
100
|
end
|
112
101
|
|
102
|
+
default_runtime = manifest "runtime"
|
103
|
+
if not default_runtime
|
104
|
+
default_runtime = framework.default_runtime(@application)
|
105
|
+
set(detect_runtime(default_runtime), "runtime") if framework.prompt_for_runtime?
|
106
|
+
end
|
107
|
+
default_command = manifest "command"
|
108
|
+
set ask("Start Command", :default => default_command), "command" if framework.require_start_command?
|
109
|
+
|
110
|
+
url_template = manifest("url") || DEFAULTS["url"]
|
111
|
+
url_resolved = url_template.dup
|
112
|
+
resolve_lexically(url_resolved)
|
113
|
+
|
114
|
+
if !framework.require_url?
|
115
|
+
url_resolved = "None"
|
116
|
+
end
|
117
|
+
url = ask("Application Deployed URL", :default => url_resolved)
|
118
|
+
|
119
|
+
if url == url_resolved && url != "None"
|
120
|
+
url = url_template
|
121
|
+
end
|
122
|
+
|
123
|
+
# common error case is for prompted users to answer y or Y or yes or
|
124
|
+
# YES to this ask() resulting in an unintended URL of y. Special
|
125
|
+
# case this common error
|
126
|
+
url = url_resolved if YES_SET.member? url
|
127
|
+
|
128
|
+
if(url == "None")
|
129
|
+
url = nil
|
130
|
+
end
|
131
|
+
|
132
|
+
set url, "url"
|
133
|
+
|
134
|
+
default_mem = manifest("mem")
|
135
|
+
default_mem = framework.memory(manifest("runtime")) if not default_mem
|
113
136
|
set ask(
|
114
137
|
"Memory reservation",
|
115
138
|
:default =>
|
116
|
-
|
117
|
-
manifest("framework", "info", "mem") ||
|
139
|
+
default_mem ||
|
118
140
|
DEFAULTS["mem"],
|
119
141
|
:choices => ["128M", "256M", "512M", "1G", "2G"]
|
120
142
|
), "mem"
|
@@ -184,6 +206,24 @@ module VMC::Cli::ManifestHelper
|
|
184
206
|
framework
|
185
207
|
end
|
186
208
|
|
209
|
+
# Detect the appropriate runtime.
|
210
|
+
def detect_runtime(default, prompt_ok=true)
|
211
|
+
runtime = nil
|
212
|
+
runtime_keys=[]
|
213
|
+
runtimes_info.keys.each {|runtime_key| runtime_keys << runtime_key.dup }
|
214
|
+
runtime_keys.sort!
|
215
|
+
if prompt_ok
|
216
|
+
runtime = ask(
|
217
|
+
"Select Runtime",
|
218
|
+
:indexed => true,
|
219
|
+
:default => default,
|
220
|
+
:choices => runtime_keys
|
221
|
+
)
|
222
|
+
display "Selected #{runtime}"
|
223
|
+
end
|
224
|
+
runtime
|
225
|
+
end
|
226
|
+
|
187
227
|
def bind_services(user_services, chosen = 0)
|
188
228
|
svcname = ask(
|
189
229
|
"Which one?",
|
data/lib/cli/runner.rb
CHANGED
@@ -289,7 +289,7 @@ class VMC::Cli::Runner
|
|
289
289
|
set_cmd(:apps, :instances, 2)
|
290
290
|
else
|
291
291
|
usage('vmc instances <appname>')
|
292
|
-
set_cmd(:apps, :instances,
|
292
|
+
set_cmd(:apps, :instances, 1)
|
293
293
|
end
|
294
294
|
|
295
295
|
when 'crashes'
|
@@ -489,7 +489,6 @@ class VMC::Cli::Runner
|
|
489
489
|
@exit_status = false
|
490
490
|
rescue VMC::Client::TargetError, VMC::Client::NotFound, VMC::Client::BadTarget => e
|
491
491
|
puts e.message.red
|
492
|
-
puts e.backtrace
|
493
492
|
@exit_status = false
|
494
493
|
rescue VMC::Client::HTTPException => e
|
495
494
|
puts e.message.red
|
data/lib/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmc-IronFoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.16.IF.
|
4
|
+
version: 0.3.16.IF.2
|
5
5
|
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_pure
|
16
|
-
requirement: &
|
16
|
+
requirement: &26653476 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 1.7.0
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *26653476
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rubyzip
|
30
|
-
requirement: &
|
30
|
+
requirement: &26652336 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 0.9.4
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *26652336
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: rest-client
|
41
|
-
requirement: &
|
41
|
+
requirement: &26687004 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
@@ -49,10 +49,10 @@ dependencies:
|
|
49
49
|
version: 1.7.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *26687004
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: terminal-table
|
55
|
-
requirement: &
|
55
|
+
requirement: &26685744 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
version: 1.4.2
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *26685744
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: interact
|
66
|
-
requirement: &
|
66
|
+
requirement: &26685108 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ~>
|
@@ -71,10 +71,10 @@ dependencies:
|
|
71
71
|
version: 0.4.0
|
72
72
|
type: :runtime
|
73
73
|
prerelease: false
|
74
|
-
version_requirements: *
|
74
|
+
version_requirements: *26685108
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: addressable
|
77
|
-
requirement: &
|
77
|
+
requirement: &26684808 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
@@ -82,10 +82,10 @@ dependencies:
|
|
82
82
|
version: 2.2.6
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
|
-
version_requirements: *
|
85
|
+
version_requirements: *26684808
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: uuidtools
|
88
|
-
requirement: &
|
88
|
+
requirement: &26683728 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
@@ -93,10 +93,10 @@ dependencies:
|
|
93
93
|
version: 2.1.0
|
94
94
|
type: :runtime
|
95
95
|
prerelease: false
|
96
|
-
version_requirements: *
|
96
|
+
version_requirements: *26683728
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
|
-
requirement: &
|
99
|
+
requirement: &26683392 !ruby/object:Gem::Requirement
|
100
100
|
none: false
|
101
101
|
requirements:
|
102
102
|
- - ! '>='
|
@@ -104,10 +104,10 @@ dependencies:
|
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
|
-
version_requirements: *
|
107
|
+
version_requirements: *26683392
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: rspec
|
110
|
-
requirement: &
|
110
|
+
requirement: &26682936 !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
113
113
|
- - ~>
|
@@ -115,10 +115,10 @@ dependencies:
|
|
115
115
|
version: 1.3.0
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
|
-
version_requirements: *
|
118
|
+
version_requirements: *26682936
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: webmock
|
121
|
-
requirement: &
|
121
|
+
requirement: &26682372 !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
124
124
|
- - =
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
version: 1.5.0
|
127
127
|
type: :development
|
128
128
|
prerelease: false
|
129
|
-
version_requirements: *
|
129
|
+
version_requirements: *26682372
|
130
130
|
description: Client library and CLI that provides access to the VMware Cloud Application
|
131
131
|
Platform.
|
132
132
|
email: help@ironfoundry.org
|