vmc 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/lib/vmc.rb +2 -5
  2. data/lib/vmc/cli/app/apps.rb +4 -1
  3. data/lib/vmc/cli/app/push.rb +38 -221
  4. data/lib/vmc/cli/app/push/create.rb +125 -0
  5. data/lib/vmc/cli/app/push/interaction.rb +64 -0
  6. data/lib/vmc/cli/app/push/sync.rb +59 -0
  7. data/lib/vmc/cli/app/rename.rb +1 -1
  8. data/lib/vmc/cli/organization/base.rb +14 -0
  9. data/lib/vmc/cli/organization/create_org.rb +28 -0
  10. data/lib/vmc/cli/organization/delete_org.rb +65 -0
  11. data/lib/vmc/cli/organization/org.rb +46 -0
  12. data/lib/vmc/cli/organization/orgs.rb +35 -0
  13. data/lib/vmc/cli/organization/rename.rb +32 -0
  14. data/lib/vmc/cli/service/base.rb +8 -0
  15. data/lib/vmc/cli/service/binding.rb +66 -0
  16. data/lib/vmc/cli/service/create.rb +104 -0
  17. data/lib/vmc/cli/service/delete.rb +84 -0
  18. data/lib/vmc/cli/service/rename.rb +32 -0
  19. data/lib/vmc/cli/service/service.rb +45 -0
  20. data/lib/vmc/cli/service/services.rb +118 -0
  21. data/lib/vmc/cli/space/base.rb +21 -0
  22. data/lib/vmc/cli/space/create.rb +57 -0
  23. data/lib/vmc/cli/space/delete.rb +92 -0
  24. data/lib/vmc/cli/space/rename.rb +36 -0
  25. data/lib/vmc/cli/space/space.rb +67 -0
  26. data/lib/vmc/cli/space/spaces.rb +57 -0
  27. data/lib/vmc/cli/space/take.rb +18 -0
  28. data/lib/vmc/cli/start/base.rb +100 -0
  29. data/lib/vmc/cli/start/colors.rb +14 -0
  30. data/lib/vmc/cli/start/info.rb +124 -0
  31. data/lib/vmc/cli/start/login.rb +94 -0
  32. data/lib/vmc/cli/start/logout.rb +14 -0
  33. data/lib/vmc/cli/start/register.rb +38 -0
  34. data/lib/vmc/cli/start/target.rb +68 -0
  35. data/lib/vmc/cli/start/targets.rb +17 -0
  36. data/lib/vmc/version.rb +1 -1
  37. data/spec/factories/app_factory.rb +5 -0
  38. data/spec/factories/client_factory.rb +10 -1
  39. data/spec/factories/domain_factory.rb +2 -1
  40. data/spec/factories/factory.rb +1 -0
  41. data/spec/factories/framework_factory.rb +1 -0
  42. data/spec/factories/organization_factory.rb +18 -0
  43. data/spec/factories/route_factory.rb +1 -0
  44. data/spec/factories/runtime_factory.rb +10 -0
  45. data/spec/factories/service_binding_factory.rb +9 -0
  46. data/spec/factories/service_factory.rb +17 -0
  47. data/spec/factories/service_instance_factory.rb +10 -0
  48. data/spec/factories/service_plan_factory.rb +11 -0
  49. data/spec/factories/space_factory.rb +10 -0
  50. data/spec/support/interact_helpers.rb +7 -3
  51. data/spec/vmc/cli/app/push/create_spec.rb +450 -0
  52. data/spec/vmc/cli/app/push_spec.rb +303 -9
  53. data/spec/vmc/cli/app/rename_spec.rb +9 -4
  54. data/spec/vmc/cli/organization/rename_spec.rb +113 -0
  55. data/spec/vmc/cli/route/delete_route_spec.rb +2 -2
  56. data/spec/vmc/cli/service/rename_spec.rb +114 -0
  57. data/spec/vmc/cli/space/rename_spec.rb +114 -0
  58. metadata +109 -64
  59. data/lib/vmc/cli/organization.rb +0 -176
  60. data/lib/vmc/cli/service.rb +0 -387
  61. data/lib/vmc/cli/space.rb +0 -284
  62. data/lib/vmc/cli/start.rb +0 -432
  63. data/spec/assets/hello-sinatra/Gemfile.lock +0 -17
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require "vmc/cli/route/delete_route"
3
3
 
4
4
  describe VMC::Route::DeleteRoute do
5
- let(:global_inputs) { { :color => false, :quiet => true } }
5
+ let(:global) { { :color => false, :quiet => true } }
6
6
  let(:inputs) { {} }
7
7
  let(:given) { {} }
8
8
  let(:client) { FactoryGirl.build(:client) }
@@ -14,7 +14,7 @@ describe VMC::Route::DeleteRoute do
14
14
  end
15
15
  end
16
16
 
17
- subject { Mothership.new.invoke(:delete_route, inputs, given, global_inputs) }
17
+ subject { Mothership.new.invoke(:delete_route, inputs, given, global) }
18
18
 
19
19
  describe 'metadata' do
20
20
  let(:command) { Mothership.commands[:delete_route] }
@@ -0,0 +1,114 @@
1
+ require 'spec_helper'
2
+ require "vmc/cli/service/rename"
3
+
4
+ describe VMC::Service::Rename do
5
+ let(:global) { { :color => false, :quiet => true } }
6
+ let(:inputs) { {} }
7
+ let(:given) { {} }
8
+ let(:client) { FactoryGirl.build(:client) }
9
+ let(:service) {}
10
+ let(:new_name) { "some-new-name" }
11
+
12
+ before do
13
+ any_instance_of(VMC::CLI) do |cli|
14
+ stub(cli).client { client }
15
+ stub(cli).precondition { nil }
16
+ end
17
+ end
18
+
19
+ subject { Mothership.new.invoke(:rename_service, inputs, given, global) }
20
+
21
+ describe 'metadata' do
22
+ let(:command) { Mothership.commands[:rename_service] }
23
+
24
+ describe 'command' do
25
+ subject { command }
26
+ its(:description) { should eq "Rename a service" }
27
+ it { expect(Mothership::Help.group(:services, :manage)).to include(subject) }
28
+ end
29
+
30
+ describe 'inputs' do
31
+ subject { command.inputs }
32
+
33
+ it "is not missing any descriptions" do
34
+ subject.each do |input, attrs|
35
+ expect(attrs[:description]).to be
36
+ expect(attrs[:description].strip).to_not be_empty
37
+ end
38
+ end
39
+ end
40
+
41
+ describe 'arguments' do
42
+ subject { command.arguments }
43
+ it 'has the correct argument order' do
44
+ should eq([
45
+ { :type => :optional, :value => nil, :name => :service },
46
+ { :type => :optional, :value => nil, :name => :name }
47
+ ])
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when there are no services' do
53
+ context 'and a service is given' do
54
+ let(:given) { { :service => "some-service" } }
55
+ it { expect { subject }.to raise_error(VMC::UserError, "Unknown service 'some-service'.") }
56
+ end
57
+
58
+ context 'and a service is not given' do
59
+ it { expect { subject }.to raise_error(VMC::UserError, "No services.") }
60
+ end
61
+ end
62
+
63
+ context 'when there are services' do
64
+ let(:client) { FactoryGirl.build(:client, :service_instances => services) }
65
+ let(:services) { FactoryGirl.build_list(:service_instance, 2) }
66
+ let(:renamed_service) { services.first }
67
+
68
+ context 'when the defaults are used' do
69
+ it 'asks for the service and new name and renames' do
70
+ mock_ask("Rename which service?", anything) { renamed_service }
71
+ mock_ask("New name") { new_name }
72
+ mock(renamed_service).name=(new_name)
73
+ mock(renamed_service).update!
74
+ subject
75
+ end
76
+ end
77
+
78
+ context 'when no name is provided, but a service is' do
79
+ let(:given) { { :service => renamed_service.name } }
80
+
81
+ it 'asks for the new name and renames' do
82
+ dont_allow_ask("Rename which service?", anything)
83
+ mock_ask("New name") { new_name }
84
+ mock(renamed_service).name=(new_name)
85
+ mock(renamed_service).update!
86
+ subject
87
+ end
88
+ end
89
+
90
+ context 'when a service is provided and a name' do
91
+ let(:inputs) { { :service => renamed_service, :name => new_name } }
92
+
93
+ it 'renames the service' do
94
+ mock(renamed_service).update!
95
+ subject
96
+ end
97
+
98
+ it 'displays the progress' do
99
+ mock_with_progress("Renaming to #{new_name}")
100
+ mock(renamed_service).update!
101
+
102
+ subject
103
+ end
104
+
105
+ context 'and the name already exists' do
106
+ it 'fails' do
107
+ mock(renamed_service).update! { raise CFoundry::ServiceInstanceNameTaken }
108
+ expect { subject }.to raise_error(CFoundry::ServiceInstanceNameTaken)
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+
@@ -0,0 +1,114 @@
1
+ require 'spec_helper'
2
+ require "vmc/cli/space/rename"
3
+
4
+ describe VMC::Space::Rename do
5
+ let(:global) { { :color => false, :quiet => true } }
6
+ let(:inputs) { {} }
7
+ let(:given) { {} }
8
+ let(:spaces) { FactoryGirl.build_list(:space, 3) }
9
+ let(:organization) { FactoryGirl.build(:organization, :spaces => spaces) }
10
+ let(:client) { FactoryGirl.build(:client, :current_organization => organization, :spaces => spaces) }
11
+ let(:new_name) { "some-new-name" }
12
+
13
+ before do
14
+ any_instance_of(VMC::CLI) do |cli|
15
+ stub(cli).client { client }
16
+ stub(cli).precondition { nil }
17
+ end
18
+ end
19
+
20
+ subject { Mothership.new.invoke(:rename_space, inputs, given, global) }
21
+
22
+ describe 'metadata' do
23
+ let(:command) { Mothership.commands[:rename_space] }
24
+
25
+ describe 'command' do
26
+ subject { command }
27
+ its(:description) { should eq "Rename a space" }
28
+ it { expect(Mothership::Help.group(:spaces)).to include(subject) }
29
+ end
30
+
31
+ describe 'inputs' do
32
+ subject { command.inputs }
33
+
34
+ it "is not missing any descriptions" do
35
+ subject.each do |input, attrs|
36
+ expect(attrs[:description]).to be
37
+ expect(attrs[:description].strip).to_not be_empty
38
+ end
39
+ end
40
+ end
41
+
42
+ describe 'arguments' do
43
+ subject { command.arguments }
44
+ it 'has the correct argument order' do
45
+ should eq([
46
+ { :type => :optional, :value => nil, :name => :space },
47
+ { :type => :optional, :value => nil, :name => :name }
48
+ ])
49
+ end
50
+ end
51
+ end
52
+
53
+ context 'when there are no spaces' do
54
+ let(:spaces) { [] }
55
+
56
+ context 'and a space is given' do
57
+ let(:given) { { :space => "some-invalid-space" } }
58
+ it { expect { subject }.to raise_error(VMC::UserError, "Unknown space 'some-invalid-space'.") }
59
+ end
60
+
61
+ context 'and a space is not given' do
62
+ it { expect { subject }.to raise_error(VMC::UserError, "No spaces.") }
63
+ end
64
+ end
65
+
66
+ context 'when there are spaces' do
67
+ let(:renamed_space) { spaces.first }
68
+
69
+ context 'when the defaults are used' do
70
+ it 'asks for the space and new name and renames' do
71
+ mock_ask("Rename which space?", anything) { renamed_space }
72
+ mock_ask("New name") { new_name }
73
+ mock(renamed_space).name=(new_name)
74
+ mock(renamed_space).update!
75
+ subject
76
+ end
77
+ end
78
+
79
+ context 'when no name is provided, but a space is' do
80
+ let(:given) { { :space => renamed_space.name } }
81
+
82
+ it 'asks for the new name and renames' do
83
+ dont_allow_ask("Rename which space?", anything)
84
+ mock_ask("New name") { new_name }
85
+ mock(renamed_space).name=(new_name)
86
+ mock(renamed_space).update!
87
+ subject
88
+ end
89
+ end
90
+
91
+ context 'when a space is provided and a name' do
92
+ let(:inputs) { { :space => renamed_space, :name => new_name } }
93
+
94
+ it 'renames the space' do
95
+ mock(renamed_space).update!
96
+ subject
97
+ end
98
+
99
+ it 'displays the progress' do
100
+ mock_with_progress("Renaming to #{new_name}")
101
+ mock(renamed_space).update!
102
+
103
+ subject
104
+ end
105
+
106
+ context 'and the name already exists' do
107
+ it 'fails' do
108
+ mock(renamed_space).update! { raise CFoundry::SpaceNameTaken }
109
+ expect { subject }.to raise_error(CFoundry::SpaceNameTaken)
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Suraci
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-30 00:00:00 -08:00
19
- default_executable:
18
+ date: 2012-12-06 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: json_pure
@@ -58,12 +57,12 @@ dependencies:
58
57
  requirements:
59
58
  - - ~>
60
59
  - !ruby/object:Gem::Version
61
- hash: 11
60
+ hash: 5
62
61
  segments:
63
62
  - 0
64
63
  - 4
65
- - 2
66
- version: 0.4.2
64
+ - 5
65
+ version: 0.4.5
67
66
  type: :runtime
68
67
  version_requirements: *id003
69
68
  - !ruby/object:Gem::Dependency
@@ -90,12 +89,12 @@ dependencies:
90
89
  requirements:
91
90
  - - ~>
92
91
  - !ruby/object:Gem::Version
93
- hash: 19
92
+ hash: 27
94
93
  segments:
95
94
  - 0
96
95
  - 3
97
- - 0
98
- version: 0.3.0
96
+ - 4
97
+ version: 0.3.4
99
98
  type: :runtime
100
99
  version_requirements: *id005
101
100
  - !ruby/object:Gem::Dependency
@@ -255,66 +254,102 @@ extra_rdoc_files: []
255
254
  files:
256
255
  - LICENSE
257
256
  - Rakefile
258
- - lib/vmc/version.rb
259
- - lib/vmc/detect.rb
260
- - lib/vmc/errors.rb
261
- - lib/vmc/spacing.rb
262
- - lib/vmc/spec_helper.rb
263
- - lib/vmc/plugin.rb
264
- - lib/vmc/constants.rb
265
- - lib/vmc/cli.rb
266
- - lib/vmc/cli/service.rb
267
- - lib/vmc/cli/user.rb
268
- - lib/vmc/cli/route/create_route.rb
269
- - lib/vmc/cli/route/routes.rb
270
- - lib/vmc/cli/route/base.rb
271
- - lib/vmc/cli/route/delete_route.rb
272
- - lib/vmc/cli/app/scale.rb
273
- - lib/vmc/cli/app/health.rb
257
+ - lib/vmc/cli/app/app.rb
258
+ - lib/vmc/cli/app/apps.rb
259
+ - lib/vmc/cli/app/base.rb
260
+ - lib/vmc/cli/app/crashes.rb
261
+ - lib/vmc/cli/app/delete.rb
262
+ - lib/vmc/cli/app/deprecated.rb
263
+ - lib/vmc/cli/app/env.rb
274
264
  - lib/vmc/cli/app/files.rb
265
+ - lib/vmc/cli/app/health.rb
266
+ - lib/vmc/cli/app/instances.rb
267
+ - lib/vmc/cli/app/logs.rb
268
+ - lib/vmc/cli/app/push/create.rb
269
+ - lib/vmc/cli/app/push/interaction.rb
270
+ - lib/vmc/cli/app/push/sync.rb
271
+ - lib/vmc/cli/app/push.rb
275
272
  - lib/vmc/cli/app/rename.rb
273
+ - lib/vmc/cli/app/restart.rb
276
274
  - lib/vmc/cli/app/routes.rb
277
- - lib/vmc/cli/app/deprecated.rb
278
- - lib/vmc/cli/app/logs.rb
279
- - lib/vmc/cli/app/instances.rb
275
+ - lib/vmc/cli/app/scale.rb
280
276
  - lib/vmc/cli/app/start.rb
281
- - lib/vmc/cli/app/app.rb
282
- - lib/vmc/cli/app/stop.rb
283
- - lib/vmc/cli/app/env.rb
284
- - lib/vmc/cli/app/base.rb
285
277
  - lib/vmc/cli/app/stats.rb
286
- - lib/vmc/cli/app/apps.rb
287
- - lib/vmc/cli/app/restart.rb
288
- - lib/vmc/cli/app/delete.rb
289
- - lib/vmc/cli/app/push.rb
290
- - lib/vmc/cli/app/crashes.rb
291
- - lib/vmc/cli/interactive.rb
278
+ - lib/vmc/cli/app/stop.rb
279
+ - lib/vmc/cli/domain/add_domain.rb
280
+ - lib/vmc/cli/domain/base.rb
292
281
  - lib/vmc/cli/domain/create_domain.rb
293
- - lib/vmc/cli/domain/domains.rb
294
282
  - lib/vmc/cli/domain/delete_domain.rb
295
- - lib/vmc/cli/domain/base.rb
283
+ - lib/vmc/cli/domain/domains.rb
296
284
  - lib/vmc/cli/domain/remove_domain.rb
297
- - lib/vmc/cli/domain/add_domain.rb
298
- - lib/vmc/cli/space.rb
299
- - lib/vmc/cli/start.rb
300
285
  - lib/vmc/cli/help.rb
301
- - lib/vmc/cli/organization.rb
286
+ - lib/vmc/cli/interactive.rb
287
+ - lib/vmc/cli/organization/base.rb
288
+ - lib/vmc/cli/organization/create_org.rb
289
+ - lib/vmc/cli/organization/delete_org.rb
290
+ - lib/vmc/cli/organization/org.rb
291
+ - lib/vmc/cli/organization/orgs.rb
292
+ - lib/vmc/cli/organization/rename.rb
293
+ - lib/vmc/cli/route/base.rb
294
+ - lib/vmc/cli/route/create_route.rb
295
+ - lib/vmc/cli/route/delete_route.rb
296
+ - lib/vmc/cli/route/routes.rb
297
+ - lib/vmc/cli/service/base.rb
298
+ - lib/vmc/cli/service/binding.rb
299
+ - lib/vmc/cli/service/create.rb
300
+ - lib/vmc/cli/service/delete.rb
301
+ - lib/vmc/cli/service/rename.rb
302
+ - lib/vmc/cli/service/service.rb
303
+ - lib/vmc/cli/service/services.rb
304
+ - lib/vmc/cli/space/base.rb
305
+ - lib/vmc/cli/space/create.rb
306
+ - lib/vmc/cli/space/delete.rb
307
+ - lib/vmc/cli/space/rename.rb
308
+ - lib/vmc/cli/space/space.rb
309
+ - lib/vmc/cli/space/spaces.rb
310
+ - lib/vmc/cli/space/take.rb
311
+ - lib/vmc/cli/start/base.rb
312
+ - lib/vmc/cli/start/colors.rb
313
+ - lib/vmc/cli/start/info.rb
314
+ - lib/vmc/cli/start/login.rb
315
+ - lib/vmc/cli/start/logout.rb
316
+ - lib/vmc/cli/start/register.rb
317
+ - lib/vmc/cli/start/target.rb
318
+ - lib/vmc/cli/start/targets.rb
319
+ - lib/vmc/cli/user.rb
320
+ - lib/vmc/cli.rb
321
+ - lib/vmc/constants.rb
322
+ - lib/vmc/detect.rb
323
+ - lib/vmc/errors.rb
324
+ - lib/vmc/plugin.rb
325
+ - lib/vmc/spacing.rb
326
+ - lib/vmc/spec_helper.rb
327
+ - lib/vmc/version.rb
302
328
  - lib/vmc.rb
303
- - spec/support/interact_helpers.rb
304
- - spec/factories/route_factory.rb
329
+ - spec/factories/app_factory.rb
330
+ - spec/factories/client_factory.rb
331
+ - spec/factories/domain_factory.rb
305
332
  - spec/factories/factory.rb
306
333
  - spec/factories/framework_factory.rb
307
- - spec/factories/domain_factory.rb
308
- - spec/factories/client_factory.rb
309
- - spec/factories/app_factory.rb
334
+ - spec/factories/organization_factory.rb
335
+ - spec/factories/route_factory.rb
336
+ - spec/factories/runtime_factory.rb
337
+ - spec/factories/service_binding_factory.rb
338
+ - spec/factories/service_factory.rb
339
+ - spec/factories/service_instance_factory.rb
340
+ - spec/factories/service_plan_factory.rb
341
+ - spec/factories/space_factory.rb
310
342
  - spec/spec_helper.rb
311
- - spec/vmc/detect_spec.rb
312
- - spec/vmc/cli/route/delete_route_spec.rb
343
+ - spec/support/interact_helpers.rb
344
+ - spec/vmc/cli/app/push/create_spec.rb
313
345
  - spec/vmc/cli/app/push_spec.rb
314
346
  - spec/vmc/cli/app/rename_spec.rb
315
- - spec/assets/hello-sinatra/Gemfile.lock
347
+ - spec/vmc/cli/organization/rename_spec.rb
348
+ - spec/vmc/cli/route/delete_route_spec.rb
349
+ - spec/vmc/cli/service/rename_spec.rb
350
+ - spec/vmc/cli/space/rename_spec.rb
351
+ - spec/vmc/detect_spec.rb
316
352
  - bin/vmc
317
- has_rdoc: true
318
353
  homepage: http://cloudfoundry.com/
319
354
  licenses: []
320
355
 
@@ -344,21 +379,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
379
  requirements: []
345
380
 
346
381
  rubyforge_project: vmc
347
- rubygems_version: 1.6.2
382
+ rubygems_version: 1.8.24
348
383
  signing_key:
349
384
  specification_version: 3
350
385
  summary: Friendly command-line interface for Cloud Foundry.
351
386
  test_files:
352
- - spec/support/interact_helpers.rb
353
- - spec/factories/route_factory.rb
387
+ - spec/factories/app_factory.rb
388
+ - spec/factories/client_factory.rb
389
+ - spec/factories/domain_factory.rb
354
390
  - spec/factories/factory.rb
355
391
  - spec/factories/framework_factory.rb
356
- - spec/factories/domain_factory.rb
357
- - spec/factories/client_factory.rb
358
- - spec/factories/app_factory.rb
392
+ - spec/factories/organization_factory.rb
393
+ - spec/factories/route_factory.rb
394
+ - spec/factories/runtime_factory.rb
395
+ - spec/factories/service_binding_factory.rb
396
+ - spec/factories/service_factory.rb
397
+ - spec/factories/service_instance_factory.rb
398
+ - spec/factories/service_plan_factory.rb
399
+ - spec/factories/space_factory.rb
359
400
  - spec/spec_helper.rb
360
- - spec/vmc/detect_spec.rb
361
- - spec/vmc/cli/route/delete_route_spec.rb
401
+ - spec/support/interact_helpers.rb
402
+ - spec/vmc/cli/app/push/create_spec.rb
362
403
  - spec/vmc/cli/app/push_spec.rb
363
404
  - spec/vmc/cli/app/rename_spec.rb
364
- - spec/assets/hello-sinatra/Gemfile.lock
405
+ - spec/vmc/cli/organization/rename_spec.rb
406
+ - spec/vmc/cli/route/delete_route_spec.rb
407
+ - spec/vmc/cli/service/rename_spec.rb
408
+ - spec/vmc/cli/space/rename_spec.rb
409
+ - spec/vmc/detect_spec.rb