vmc 0.5.1.rc2 → 0.5.1.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,13 +24,17 @@ module VMC::App
24
24
  }
25
25
  input :memory, :desc => "Memory limit"
26
26
  input :instances, :desc => "Number of instances to run", :type => :integer
27
- input :framework, :desc => "Framework to use", :from_given => by_name(:framework)
28
- input :runtime, :desc => "Runtime to use", :from_given => by_name(:runtime)
27
+ input :framework, :desc => "Framework to use",
28
+ :from_given => by_name(:framework)
29
+ input :runtime, :desc => "Runtime to use",
30
+ :from_given => by_name(:runtime)
29
31
  input :command, :desc => "Startup command"
30
32
  input :plan, :desc => "Application plan", :default => "D100"
31
33
  input :start, :desc => "Start app after pushing?", :default => true
32
34
  input :restart, :desc => "Restart app after updating?", :default => true
33
35
  input :buildpack, :desc => "Custom buildpack URL", :default => nil
36
+ input :stack, :desc => "Stack to use", :default => nil,
37
+ :from_given => by_name(:stack)
34
38
  input :create_services, :desc => "Interactively create services?",
35
39
  :type => :boolean, :default => proc { force? ? false : interact }
36
40
  input :bind_services, :desc => "Interactively bind services?",
@@ -13,7 +13,7 @@ module VMC::App
13
13
 
14
14
  if v2?
15
15
  inputs[:production] = !!(input[:plan] =~ /^p/i)
16
- inputs[:command] = input[:command] unless has_procfile?
16
+ inputs[:command] = input[:command] if input.has?(:command) || !has_procfile?
17
17
 
18
18
  framework = detector.detect_framework
19
19
  else
@@ -27,6 +27,8 @@ module VMC::App
27
27
  human_mb = human_mb(detector.suggested_memory(framework) || 64)
28
28
  inputs[:memory] = megabytes(input[:memory, human_mb])
29
29
 
30
+ inputs[:stack] = input[:stack] if v2?
31
+
30
32
  inputs
31
33
  end
32
34
 
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.5.1.rc2".freeze
2
+ VERSION = "0.5.1.rc3".freeze
3
3
  end
@@ -11,7 +11,7 @@ if ENV['VMC_TEST_USER'] && ENV['VMC_TEST_PASSWORD'] && ENV['VMC_TEST_TARGET']
11
11
  let(:password) { ENV['VMC_TEST_PASSWORD'] }
12
12
 
13
13
  let(:app) do
14
- fuzz = TRAVIS_BUILD_ID || Time.new.to_f.to_s.gsub(".", "_")
14
+ fuzz = TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_")
15
15
  "hello-sinatra-#{fuzz}"
16
16
  end
17
17
 
@@ -11,7 +11,7 @@ if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TA
11
11
  let(:password) { ENV['VMC_V2_TEST_PASSWORD'] }
12
12
 
13
13
  let(:app) do
14
- fuzz = TRAVIS_BUILD_ID || Time.new.to_f.to_s.gsub(".", "_")
14
+ fuzz = TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_")
15
15
  "hello-sinatra-#{fuzz}"
16
16
  end
17
17
 
@@ -16,11 +16,14 @@ describe VMC::App::Create do
16
16
 
17
17
  let(:service_instances) { fake_list(:service_instance, 5) }
18
18
 
19
+ let(:lucid64) { fake :stack, :name => "lucid64" }
20
+
19
21
  let(:client) do
20
22
  fake_client(
21
23
  :frameworks => frameworks,
22
24
  :runtimes => runtimes,
23
- :service_instances => service_instances)
25
+ :service_instances => service_instances,
26
+ :stacks => [lucid64])
24
27
  end
25
28
 
26
29
  before do
@@ -43,13 +46,14 @@ describe VMC::App::Create do
43
46
  describe '#get_inputs' do
44
47
  subject { create.get_inputs }
45
48
 
46
- let(:inputs) do
49
+ let(:given) do
47
50
  { :name => "some-name",
48
- :instances => 1,
51
+ :instances => "1",
49
52
  :plan => "p100",
50
53
  :memory => "1G",
51
54
  :command => "ruby main.rb",
52
- :buildpack => "git://example.com"
55
+ :buildpack => "git://example.com",
56
+ :stack => "lucid64"
53
57
  }
54
58
  end
55
59
 
@@ -63,17 +67,40 @@ describe VMC::App::Create do
63
67
  its([:command]) { should eq "ruby main.rb" }
64
68
  its([:memory]) { should eq 1024 }
65
69
  its([:buildpack]) { should eq "git://example.com" }
70
+ its([:stack]) { should eq lucid64 }
71
+ end
72
+
73
+ context 'when the command is given' do
74
+ context "and there is a Procfile in the application's root" do
75
+ before do
76
+ FakeFS.activate!
77
+ Dir.mkdir(path)
78
+
79
+ # fakefs removes fnmatch :'(
80
+ stub(create.send(:detector)).detect_framework
81
+ File.open("#{path}/Procfile", "w") do |file|
82
+ file.write("this is a procfile")
83
+ end
84
+ end
85
+
86
+ after do
87
+ FakeFS.deactivate!
88
+ FakeFS::FileSystem.clear
89
+ end
90
+
91
+ its([:command]) { should eq "ruby main.rb" }
92
+ end
66
93
  end
67
94
 
68
95
  context 'when certain inputs are not given' do
69
96
  it 'asks for the name' do
70
- inputs.delete(:name)
97
+ given.delete(:name)
71
98
  mock_ask("Name") { "some-name" }
72
99
  subject
73
100
  end
74
101
 
75
102
  it 'asks for the total instances' do
76
- inputs.delete(:instances)
103
+ given.delete(:instances)
77
104
  mock_ask("Instances", anything) { 1 }
78
105
  subject
79
106
  end
@@ -87,7 +114,7 @@ describe VMC::App::Create do
87
114
  end
88
115
 
89
116
  context 'when the command is not given' do
90
- before { inputs.delete(:command) }
117
+ before { given.delete(:command) }
91
118
 
92
119
  shared_examples 'an app that can have a custom start command' do
93
120
  it "asks for a start command with a default as 'none'" do
@@ -166,7 +193,7 @@ describe VMC::App::Create do
166
193
  end
167
194
 
168
195
  it 'asks for the memory' do
169
- inputs.delete(:memory)
196
+ given.delete(:memory)
170
197
 
171
198
  memory_choices = %w(64M 128M 256M 512M 1G)
172
199
  stub(create).memory_choices { memory_choices }
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: -656826288
4
+ hash: 3495541125
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 1
10
10
  - rc
11
- - 2
12
- version: 0.5.1.rc2
11
+ - 3
12
+ version: 0.5.1.rc3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Cloud Foundry Team
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2013-03-07 00:00:00 Z
21
+ date: 2013-03-12 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -71,14 +71,14 @@ dependencies:
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- hash: -656826304
74
+ hash: 3495541147
75
75
  segments:
76
76
  - 0
77
77
  - 5
78
78
  - 3
79
79
  - rc
80
- - 2
81
- version: 0.5.3.rc2
80
+ - 4
81
+ version: 0.5.3.rc4
82
82
  - - <
83
83
  - !ruby/object:Gem::Version
84
84
  hash: 7
@@ -132,14 +132,23 @@ dependencies:
132
132
  version_requirements: &id007 !ruby/object:Gem::Requirement
133
133
  none: false
134
134
  requirements:
135
- - - ~>
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
- hash: 3
137
+ hash: 3495541159
138
138
  segments:
139
139
  - 0
140
140
  - 6
141
+ - 3
142
+ - rc
141
143
  - 2
142
- version: 0.6.2
144
+ version: 0.6.3.rc2
145
+ - - <
146
+ - !ruby/object:Gem::Version
147
+ hash: 5
148
+ segments:
149
+ - 0
150
+ - 7
151
+ version: "0.7"
143
152
  prerelease: false
144
153
  type: :runtime
145
154
  name: manifests-vmc-plugin