vmc 0.4.0.beta.47 → 0.4.0.beta.48
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/vmc-ng/lib/vmc/cli/app.rb +18 -9
- data/vmc-ng/lib/vmc/detect.rb +9 -5
- data/vmc-ng/lib/vmc/version.rb +1 -1
- metadata +7 -7
data/vmc-ng/lib/vmc/cli/app.rb
CHANGED
|
@@ -131,6 +131,8 @@ module VMC
|
|
|
131
131
|
input(:command, :desc => "Startup command for standalone app") {
|
|
132
132
|
ask("Startup command")
|
|
133
133
|
}
|
|
134
|
+
input :plan, :default => "D100",
|
|
135
|
+
:desc => "Application plan (e.g. D100, P200)"
|
|
134
136
|
input :start, :type => :boolean, :default => true,
|
|
135
137
|
:desc => "Start app after pushing?"
|
|
136
138
|
input :restart, :type => :boolean, :default => true,
|
|
@@ -162,20 +164,21 @@ module VMC
|
|
|
162
164
|
app.name = name
|
|
163
165
|
app.space = client.current_space if client.current_space
|
|
164
166
|
app.total_instances = input[:instances]
|
|
167
|
+
app.production = input[:plan].capitalize.start_with?("P")
|
|
165
168
|
|
|
166
169
|
detector = Detector.new(client, path)
|
|
167
170
|
frameworks = detector.all_frameworks
|
|
168
171
|
detected, default = detector.frameworks
|
|
169
172
|
|
|
170
173
|
if detected.empty?
|
|
171
|
-
framework = input[:framework, frameworks
|
|
174
|
+
framework = input[:framework, frameworks]
|
|
172
175
|
else
|
|
173
176
|
detected_names = detected.collect(&:name).sort
|
|
174
|
-
framework = input[:framework, detected, default,
|
|
177
|
+
framework = input[:framework, detected, default, :other]
|
|
175
178
|
|
|
176
179
|
if framework == :other
|
|
177
180
|
input.forget(:framework)
|
|
178
|
-
framework = input[:framework, frameworks
|
|
181
|
+
framework = input[:framework, frameworks]
|
|
179
182
|
end
|
|
180
183
|
end
|
|
181
184
|
|
|
@@ -188,10 +191,10 @@ module VMC
|
|
|
188
191
|
app.framework = framework
|
|
189
192
|
app.runtime = runtime
|
|
190
193
|
|
|
191
|
-
app.command = input[:command] if framework == "standalone"
|
|
194
|
+
app.command = input[:command] if framework.name == "standalone"
|
|
192
195
|
|
|
193
196
|
url =
|
|
194
|
-
if framework == "standalone"
|
|
197
|
+
if framework.name == "standalone"
|
|
195
198
|
if (given = input[:url, "none"]) != "none"
|
|
196
199
|
given
|
|
197
200
|
end
|
|
@@ -412,6 +415,8 @@ module VMC
|
|
|
412
415
|
:allow_other => true,
|
|
413
416
|
:default => human_size(default * 1024 * 1024, 0))
|
|
414
417
|
}
|
|
418
|
+
input :plan, :default => "D100",
|
|
419
|
+
:desc => "Application plan (e.g. D100, P200)"
|
|
415
420
|
input :restart, :type => :boolean, :default => true,
|
|
416
421
|
:desc => "Restart app after updating?"
|
|
417
422
|
def scale
|
|
@@ -419,22 +424,26 @@ module VMC
|
|
|
419
424
|
|
|
420
425
|
instances = input.given(:instances)
|
|
421
426
|
memory = input.given(:memory)
|
|
427
|
+
plan_name = input.given(:plan)
|
|
422
428
|
|
|
423
|
-
unless instances || memory
|
|
429
|
+
unless instances || memory || plan_name
|
|
424
430
|
instances = input[:instances, app.total_instances]
|
|
425
431
|
memory = input[:memory, app.memory]
|
|
426
432
|
end
|
|
427
433
|
|
|
428
434
|
megs = megabytes(memory)
|
|
435
|
+
production = plan_name && plan_name.capitalize.start_with?("P")
|
|
429
436
|
|
|
430
437
|
memory_changed = megs != app.memory
|
|
431
438
|
instances_changed = instances != app.total_instances
|
|
439
|
+
plan_changed = production != app.production
|
|
432
440
|
|
|
433
|
-
return unless memory_changed || instances_changed
|
|
441
|
+
return unless memory_changed || instances_changed || plan_changed
|
|
434
442
|
|
|
435
443
|
with_progress("Scaling #{c(app.name, :name)}") do
|
|
436
|
-
app.total_instances = instances.to_i if
|
|
437
|
-
app.memory = megs if
|
|
444
|
+
app.total_instances = instances.to_i if instances_changed
|
|
445
|
+
app.memory = megs if memory_changed
|
|
446
|
+
app.production = production if plan_changed
|
|
438
447
|
app.update!
|
|
439
448
|
end
|
|
440
449
|
|
data/vmc-ng/lib/vmc/detect.rb
CHANGED
|
@@ -38,7 +38,7 @@ module VMC
|
|
|
38
38
|
matched = false
|
|
39
39
|
|
|
40
40
|
# e.g. standalone has no detection
|
|
41
|
-
next if framework.detection.nil?
|
|
41
|
+
next if framework.detection.nil? || framework.detection.empty?
|
|
42
42
|
|
|
43
43
|
framework.detection.first.each do |file, match|
|
|
44
44
|
files =
|
|
@@ -67,11 +67,15 @@ module VMC
|
|
|
67
67
|
matched = false
|
|
68
68
|
break
|
|
69
69
|
else
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
begin
|
|
71
|
+
files.each do |f|
|
|
72
|
+
contents = File.open(f, &:read)
|
|
73
|
+
if contents =~ Regexp.new(match)
|
|
74
|
+
matched = true
|
|
75
|
+
end
|
|
74
76
|
end
|
|
77
|
+
rescue RegexpError
|
|
78
|
+
# some regexps may fail on 1.8 as the server runs 1.9
|
|
75
79
|
end
|
|
76
80
|
end
|
|
77
81
|
end
|
data/vmc-ng/lib/vmc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vmc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: -3893770324
|
|
5
5
|
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 4
|
|
9
9
|
- 0
|
|
10
10
|
- beta
|
|
11
|
-
-
|
|
12
|
-
version: 0.4.0.beta.
|
|
11
|
+
- 48
|
|
12
|
+
version: 0.4.0.beta.48
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- VMware
|
|
@@ -17,7 +17,7 @@ autorequire:
|
|
|
17
17
|
bindir: bin
|
|
18
18
|
cert_chain: []
|
|
19
19
|
|
|
20
|
-
date: 2012-09-
|
|
20
|
+
date: 2012-09-10 00:00:00 Z
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
23
23
|
name: json_pure
|
|
@@ -265,12 +265,12 @@ dependencies:
|
|
|
265
265
|
requirements:
|
|
266
266
|
- - ~>
|
|
267
267
|
- !ruby/object:Gem::Version
|
|
268
|
-
hash:
|
|
268
|
+
hash: 45
|
|
269
269
|
segments:
|
|
270
270
|
- 0
|
|
271
271
|
- 3
|
|
272
|
-
-
|
|
273
|
-
version: 0.3.
|
|
272
|
+
- 31
|
|
273
|
+
version: 0.3.31
|
|
274
274
|
type: :runtime
|
|
275
275
|
version_requirements: *id015
|
|
276
276
|
- !ruby/object:Gem::Dependency
|