Permalink
Browse files

don't grab frameworks to suggest memory

[#46139447]
  • Loading branch information...
1 parent 177a09f commit 03cf727fb36f39385152ad65ea3e802494f8eb3f Alex Suraci & Ian Baker committed Mar 14, 2013
Showing with 24 additions and 5 deletions.
  1. +7 −3 lib/vmc/cli/app/push/create.rb
  2. +2 −2 lib/vmc/detect.rb
  3. +15 −0 spec/vmc/cli/app/push/create_spec.rb
@@ -14,8 +14,6 @@ def get_inputs
if v2?
inputs[:production] = !!(input[:plan] =~ /^p/i)
inputs[:command] = input[:command] if input.has?(:command) || !has_procfile?
-
- framework = detector.detect_framework
else
framework = inputs[:framework] = determine_framework
inputs[:runtime] = determine_runtime(framework)
@@ -24,7 +22,13 @@ def get_inputs
inputs[:buildpack] = input[:buildpack] if v2?
- human_mb = human_mb(detector.suggested_memory(framework) || 64)
+ if v2?
+ detected = detector.detected
+ human_mb = human_mb((detected && detected.memory_suggestion) || 64)
+ else
+ human_mb = human_mb(detector.suggested_memory(framework) || 64)
+ end
+
inputs[:memory] = megabytes(input[:memory, human_mb])
inputs[:stack] = input[:stack] if v2?
View
@@ -76,12 +76,12 @@ def all_frameworks
@all_frameworks ||= @client.frameworks
end
- private
-
def detected
@detected ||= Clouseau.detect(@path)
end
+ private
+
def map_detectors!
@framework_detectors = {}
@detector_frameworks = {}
@@ -187,14 +187,29 @@
subject
end
+ # this is hacky, but will get better once we remove all the v1-specific
+ # logic, as we won't have to worry about this anyway as the code will be gone
+ #
+ # we wanted to spec for this because frameworks/runtimes will be gone on
+ # v2, and if we don't fix it now, vmc push will blow up
it 'asks for the memory' do
given.delete(:memory)
memory_choices = %w(64M 128M 256M 512M 1G)
stub(create).memory_choices { memory_choices }
+ detector = mock
+ detected = mock
+ dont_allow(detector).detect_framework
+
+ stub(detected).memory_suggestion { 128 }
+
+ stub(create).detector { detector }
+ stub(detector).detected { detected }
+
mock_ask('Memory Limit', anything) do |_, options|
expect(options[:choices]).to eq memory_choices
+ expect(options[:default]).to eq "128M"
"1G"
end

0 comments on commit 03cf727

Please sign in to comment.