cf 0.6.0 → 0.6.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,12 +56,11 @@ module CF::App
56
56
 
57
57
  def display_apps_table(apps)
58
58
  table(
59
- ["name", "status", "usage", "plan", "url"],
59
+ ["name", "status", "usage", "url"],
60
60
  apps.collect { |a|
61
61
  [ c(a.name, :name),
62
62
  app_status(a),
63
63
  "#{a.total_instances} x #{human_mb(a.memory)}",
64
- a.production ? "prod" : "dev",
65
64
  if a.urls.empty?
66
65
  d("none")
67
66
  elsif a.urls.size == 1
@@ -25,7 +25,7 @@ module CF::App
25
25
  input :memory, :desc => "Memory limit"
26
26
  input :instances, :desc => "Number of instances to run", :type => :integer
27
27
  input :command, :desc => "Startup command"
28
- input :plan, :desc => "Application plan", :default => "D100"
28
+ input :plan, :desc => "Application plan"
29
29
  input :start, :desc => "Start app after pushing?", :default => true
30
30
  input :restart, :desc => "Restart app after updating?", :default => true
31
31
  input :buildpack, :desc => "Custom buildpack URL", :default => nil
@@ -9,8 +9,6 @@ module CF::App
9
9
  inputs[:total_instances] = input[:instances]
10
10
  inputs[:space] = client.current_space if client.current_space
11
11
 
12
- inputs[:production] = !!(input[:plan] =~ /^p/i)
13
-
14
12
  inputs[:buildpack] = input[:buildpack]
15
13
  inputs[:command] = input[:command] if input.has?(:command) || !has_procfile?
16
14
 
@@ -4,7 +4,6 @@ module CF::App
4
4
  app.memory = megabytes(input[:memory]) if input.has?(:memory)
5
5
  app.total_instances = input[:instances] if input.has?(:instances)
6
6
  app.command = input[:command] if input.has?(:command)
7
- app.production = input[:plan].upcase.start_with?("P") if input.has?(:plan)
8
7
  app.buildpack = input[:buildpack] if input.has?(:buildpack)
9
8
  end
10
9
 
@@ -42,8 +41,6 @@ module CF::App
42
41
  human_mb(val)
43
42
  when :command, :buildpack
44
43
  "'#{val}'"
45
- when :production
46
- bool(val)
47
44
  else
48
45
  val
49
46
  end
@@ -10,7 +10,7 @@ module CF::App
10
10
  :type => :numeric
11
11
  input :memory, :desc => "Memory limit"
12
12
  input :disk, :desc => "Disk quota"
13
- input :plan, :desc => "Application plan", :default => "D100"
13
+ input :plan, :desc => "Application plan"
14
14
  input :restart, :desc => "Restart app after updating?", :default => true
15
15
  def scale
16
16
  app = input[:app]
@@ -29,7 +29,6 @@ module CF::App
29
29
 
30
30
  if input.has?(:plan)
31
31
  plan_name = input[:plan]
32
- production = !!(plan_name =~ /^p/i)
33
32
  end
34
33
 
35
34
  unless instances || memory || disk || plan_name
@@ -40,7 +39,6 @@ module CF::App
40
39
  app.total_instances = instances if input.has?(:instances)
41
40
  app.memory = megabytes(memory) if input.has?(:memory)
42
41
  app.disk_quota = megabytes(disk) if input.has?(:disk)
43
- app.production = production if input.has?(:plan)
44
42
 
45
43
  fail "No changes!" unless app.changed?
46
44
 
@@ -13,8 +13,7 @@ module CF::Service
13
13
  input :name, :desc => "Name for your service", :argument => :optional
14
14
  input :plan, :desc => "Service plan",
15
15
  :from_given => find_by_name_insensitive("plan"),
16
- :default => proc { |plans|
17
- plans.find { |p| p.name == "D100" } ||
16
+ :default => proc {
18
17
  interact
19
18
  }
20
19
  input :provider, :desc => "Service provider"
@@ -1,3 +1,3 @@
1
1
  module CF
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.6.1.rc1".freeze
3
3
  end
@@ -36,7 +36,7 @@ describe CF::App::Create do
36
36
  let(:given) do
37
37
  { :name => "some-name",
38
38
  :instances => "1",
39
- :plan => "p100",
39
+ :plan => "100",
40
40
  :memory => "1G",
41
41
  :command => "ruby main.rb",
42
42
  :buildpack => "git://example.com",
@@ -48,7 +48,6 @@ describe CF::App::Create do
48
48
  its([:name]) { should eq "some-name" }
49
49
  its([:total_instances]) { should eq 1 }
50
50
  its([:space]) { should eq client.current_space }
51
- its([:production]) { should eq true }
52
51
  its([:command]) { should eq "ruby main.rb" }
53
52
  its([:memory]) { should eq 1024 }
54
53
  its([:stack]) { should eq lucid64 }
@@ -171,7 +170,6 @@ describe CF::App::Create do
171
170
  let(:attributes) do
172
171
  { :name => "some-app",
173
172
  :total_instances => 2,
174
- :production => false,
175
173
  :memory => 1024,
176
174
  :buildpack => "git://example.com"
177
175
  }
@@ -153,54 +153,6 @@ describe CF::App::Push do
153
153
  include_examples 'common tests for inputs', :command
154
154
  end
155
155
 
156
- context 'when plan is given' do
157
- let(:old) { "d100" }
158
- let(:new) { "p100" }
159
- let(:inputs) { { :plan => new } }
160
-
161
- include_examples 'common tests for inputs', :production, :plan
162
-
163
- %w{p100 P100 P200}.each do |plan|
164
- context "when the given plan is #{plan}" do
165
- let(:inputs) { { :plan => plan } }
166
-
167
- it 'sets production to true' do
168
- stub(push).line(anything)
169
- mock(app).update!
170
- expect { subject }.to change { app.production }.from(false).to(true)
171
- end
172
-
173
- it 'outputs the changed plan in single quotes' do
174
- mock(push).line("Changes:")
175
- mock(push).line("production: false -> true")
176
- stub(app).update!
177
- subject
178
- end
179
- end
180
- end
181
-
182
- %w{d100 D100 D200 fizzbuzz}.each do |plan|
183
- context "when the given plan is #{plan}" do
184
- let(:app) { fake(:app, :production => true) }
185
-
186
- let(:inputs) { { :plan => plan } }
187
-
188
- it 'sets production to false' do
189
- stub(push).line(anything)
190
- mock(app).update!
191
- expect { subject }.to change { app.production }.from(true).to(false)
192
- end
193
-
194
- it 'outputs the changed plan in single quotes' do
195
- mock(push).line("Changes:")
196
- mock(push).line("production: true -> false")
197
- stub(app).update!
198
- subject
199
- end
200
- end
201
- end
202
- end
203
-
204
156
  context 'when restart is given' do
205
157
  let(:inputs) { { :restart => true, :memory => 4096 } }
206
158
 
@@ -48,28 +48,4 @@ command CF::App::Scale do
48
48
  expect { subject }.to change(app, :total_instances).from(before_value).to(5)
49
49
  end
50
50
  end
51
-
52
- context "when the --plan flag is given" do
53
- context "when the plan name begins with a 'p'" do
54
- let(:app) { fake :app, :production => false }
55
-
56
- subject { cf %W[scale #{app.name} --plan P100] }
57
-
58
- it "changes the application's 'production' flag to true" do
59
- mock(app).update!
60
- expect { subject }.to change(app, :production).from(false).to(true)
61
- end
62
- end
63
-
64
- context "when the plan name does not begin with a 'p'" do
65
- let(:app) { fake :app, :production => true }
66
-
67
- subject { cf %W[scale #{app.name} --plan D100] }
68
-
69
- it "changes the application's 'production' flag to false" do
70
- mock(app).update!
71
- expect { subject }.to change(app, :production).from(true).to(false)
72
- end
73
- end
74
- end
75
51
  end
@@ -31,8 +31,6 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE
31
31
  end
32
32
 
33
33
  it "registers a new account and deletes it" do
34
- pending "until we get some v2 admin credentials somewhere to actually run this with"
35
-
36
34
  email = Faker::Internet.email
37
35
  run("#{cf_bin} target #{target}") do |runner|
38
36
  runner.wait_for_exit
@@ -75,18 +73,24 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE
75
73
  runner.send_keys "1"
76
74
  end
77
75
 
78
- # run("#{cf_bin} delete-user #{email}") do |runner|
79
- # expect(runner).to say "Really delete user #{email}?>"
80
- # runner.send_keys "y"
81
- # expect(runner).to say "Deleting #{email}... OK"
82
- # end
76
+ # TODO: do this when cf delete-user is implemented
77
+ #run("#{cf_bin} delete-user #{email}") do |runner|
78
+ # expect(runner).to say "Really delete user #{email}?>"
79
+ # runner.send_keys "y"
80
+ # expect(runner).to say "Deleting #{email}... OK"
81
+ #end
83
82
 
83
+ # TODO: not this.
84
84
  client.login(email, "p")
85
85
  user = client.current_user
86
86
  guid = user.guid
87
87
  client.login(username, password)
88
88
  user.delete!
89
89
  client.base.uaa.delete_user(guid)
90
+
91
+ run("#{cf_bin} login #{email} --password p") do |runner|
92
+ expect(runner).to say "Authenticating... FAILED"
93
+ end
90
94
  end
91
95
  end
92
96
  else
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "webmock/rspec"
3
3
 
4
- if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGET']
4
+ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGET'] && ENV['CF_V2_OTHER_TEST_ORGANIZATION']
5
5
  describe 'A new user tries to use CF against v2', :ruby19 => true do
6
6
  include ConsoleAppSpeckerMatchers
7
7
  include CF::Interactive
@@ -9,6 +9,7 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE
9
9
  let(:target) { ENV['CF_V2_TEST_TARGET'] }
10
10
  let(:username) { ENV['CF_V2_TEST_USER'] }
11
11
  let(:password) { ENV['CF_V2_TEST_PASSWORD'] }
12
+ let(:organization) { ENV['CF_V2_OTHER_TEST_ORGANIZATION'] }
12
13
 
13
14
  let(:app) do
14
15
  fuzz = TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_")
@@ -44,7 +45,7 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE
44
45
 
45
46
  expect(runner).to say(
46
47
  "Organization>" => proc {
47
- runner.send_keys "1"
48
+ runner.send_keys organization
48
49
  expect(runner).to say /Switching to organization .*\.\.\. OK/
49
50
  },
50
51
  "Switching to organization" => proc {}
@@ -90,6 +91,22 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE
90
91
  expect(runner).to say(/Binding #{app}\..* to #{app}\.\.\. OK/)
91
92
 
92
93
  expect(runner).to say "Create services for application?> n"
94
+ runner.send_keys "y"
95
+
96
+ # create a service here
97
+ expect(runner).to say "What kind?>"
98
+ runner.send_keys "redis"
99
+
100
+ expect(runner).to say "Name?>"
101
+ runner.send_keys ""
102
+
103
+ expect(runner).to say "Which plan?>"
104
+ runner.send_keys "1"
105
+
106
+ expect(runner).to say /Creating service redis-.* OK/
107
+ expect(runner).to say /Binding redis-.* to .+ OK/
108
+
109
+ expect(runner).to say "Create another service?> n"
93
110
  runner.send_keys ""
94
111
 
95
112
  # skip this
@@ -111,11 +128,14 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE
111
128
  run("#{cf_bin} delete #{app}") do |runner|
112
129
  expect(runner).to say "Really delete #{app}?>"
113
130
  runner.send_keys "y"
114
-
115
131
  expect(runner).to say "Deleting #{app}... OK"
132
+
133
+ expect(runner).to say "Delete orphaned service"
134
+ runner.send_keys "y"
135
+ expect(runner).to say /Deleting redis.* OK/
116
136
  end
117
137
  end
118
138
  end
119
139
  else
120
- $stderr.puts 'Skipping v2 integration specs; please provide $CF_V2_TEST_TARGET, $CF_V2_TEST_USER, and $CF_V2_TEST_PASSWORD'
140
+ $stderr.puts 'Skipping v2 integration specs; please provide $CF_V2_TEST_TARGET, $CF_V2_TEST_USER, $CF_V2_TEST_PASSWORD, and $CF_V2_OTHER_TEST_ORGANIZATION'
121
141
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
5
- prerelease:
4
+ version: 0.6.1.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cloud Foundry Team
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-26 00:00:00.000000000 Z
13
+ date: 2013-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_pure
@@ -348,13 +348,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
348
  version: '0'
349
349
  segments:
350
350
  - 0
351
- hash: 4009648261134416659
351
+ hash: 4118664530804261355
352
352
  required_rubygems_version: !ruby/object:Gem::Requirement
353
353
  none: false
354
354
  requirements:
355
- - - ! '>='
355
+ - - ! '>'
356
356
  - !ruby/object:Gem::Version
357
- version: '0'
357
+ version: 1.3.1
358
358
  requirements: []
359
359
  rubyforge_project: cf
360
360
  rubygems_version: 1.8.25