Permalink
Browse files

implement setting app stack during push

  • Loading branch information...
1 parent efcf0fa commit b7a5d131d68eec005fb2973f3789ca368d8f6920 Alex Suraci & Dmitriy Kalinin committed Mar 12, 2013
Showing with 22 additions and 11 deletions.
  1. +1 −1 Gemfile.lock
  2. +6 −2 lib/vmc/cli/app/push.rb
  3. +2 −0 lib/vmc/cli/app/push/create.rb
  4. +13 −8 spec/vmc/cli/app/push/create_spec.rb
View
@@ -38,7 +38,7 @@ GIT
GIT
remote: git://github.com/cloudfoundry/vmc-lib.git
- revision: 759dd7fd042b50ea8e51cd52f5fd541462a17548
+ revision: 56fe2331303c353c8fdec0dcb4a632bfc432c322
submodules: true
specs:
cfoundry (0.5.3.rc3)
View
@@ -24,13 +24,17 @@ class Push < Base
}
input :memory, :desc => "Memory limit"
input :instances, :desc => "Number of instances to run", :type => :integer
- input :framework, :desc => "Framework to use", :from_given => by_name(:framework)
- input :runtime, :desc => "Runtime to use", :from_given => by_name(:runtime)
+ input :framework, :desc => "Framework to use",
+ :from_given => by_name(:framework)
+ input :runtime, :desc => "Runtime to use",
+ :from_given => by_name(:runtime)
input :command, :desc => "Startup command"
input :plan, :desc => "Application plan", :default => "D100"
input :start, :desc => "Start app after pushing?", :default => true
input :restart, :desc => "Restart app after updating?", :default => true
input :buildpack, :desc => "Custom buildpack URL", :default => nil
+ input :stack, :desc => "Stack to use", :default => nil,
+ :from_given => by_name(:stack)
input :create_services, :desc => "Interactively create services?",
:type => :boolean, :default => proc { force? ? false : interact }
input :bind_services, :desc => "Interactively bind services?",
@@ -27,6 +27,8 @@ def get_inputs
human_mb = human_mb(detector.suggested_memory(framework) || 64)
inputs[:memory] = megabytes(input[:memory, human_mb])
+ inputs[:stack] = input[:stack] if v2?
+
inputs
end
@@ -16,11 +16,14 @@
let(:service_instances) { fake_list(:service_instance, 5) }
+ let(:lucid64) { fake :stack, :name => "lucid64" }
+
let(:client) do
fake_client(
:frameworks => frameworks,
:runtimes => runtimes,
- :service_instances => service_instances)
+ :service_instances => service_instances,
+ :stacks => [lucid64])
end
before do
@@ -43,13 +46,14 @@
describe '#get_inputs' do
subject { create.get_inputs }
- let(:inputs) do
+ let(:given) do
{ :name => "some-name",
- :instances => 1,
+ :instances => "1",
:plan => "p100",
:memory => "1G",
:command => "ruby main.rb",
- :buildpack => "git://example.com"
+ :buildpack => "git://example.com",
+ :stack => "lucid64"
}
end
@@ -63,6 +67,7 @@
its([:command]) { should eq "ruby main.rb" }
its([:memory]) { should eq 1024 }
its([:buildpack]) { should eq "git://example.com" }
+ its([:stack]) { should eq lucid64 }
end
context 'when the command is given' do
@@ -89,13 +94,13 @@
context 'when certain inputs are not given' do
it 'asks for the name' do
- inputs.delete(:name)
+ given.delete(:name)
mock_ask("Name") { "some-name" }
subject
end
it 'asks for the total instances' do
- inputs.delete(:instances)
+ given.delete(:instances)
mock_ask("Instances", anything) { 1 }
subject
end
@@ -109,7 +114,7 @@
end
context 'when the command is not given' do
- before { inputs.delete(:command) }
+ before { given.delete(:command) }
shared_examples 'an app that can have a custom start command' do
it "asks for a start command with a default as 'none'" do
@@ -188,7 +193,7 @@
end
it 'asks for the memory' do
- inputs.delete(:memory)
+ given.delete(:memory)
memory_choices = %w(64M 128M 256M 512M 1G)
stub(create).memory_choices { memory_choices }

0 comments on commit b7a5d13

Please sign in to comment.