vmc 0.5.1.rc6 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module App
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  # choose the right color for app/instance state
7
7
  def state_color(s)
8
8
  case s
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module Domain
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  def precondition
7
7
  super
8
8
  fail "This command is v2-only." unless v2?
@@ -1,9 +1,10 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module Organization
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  def precondition
7
+ super
7
8
  check_target
8
9
  check_logged_in
9
10
 
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module Route
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  def precondition
7
7
  super
8
8
  fail "This command is v2-only." unless v2?
@@ -2,7 +2,9 @@ require "vmc/cli/route/base"
2
2
 
3
3
  module VMC::Route
4
4
  class Map < Base
5
- def precondition; end
5
+ def precondition
6
+ fail_on_v2
7
+ end
6
8
 
7
9
  desc "Add a URL mapping"
8
10
  group :apps, :info, :hidden => true
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module Service
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module Space
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  def precondition
7
7
  check_target
8
8
  check_logged_in
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module Start
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  # Make sure we only show the target once
7
7
  @@displayed_target = false
8
8
 
@@ -10,9 +10,10 @@ module VMC
10
10
  @@displayed_target
11
11
  end
12
12
 
13
-
14
13
  # These commands don't require authentication.
15
- def precondition; end
14
+ def precondition
15
+ fail_on_v2
16
+ end
16
17
 
17
18
  private
18
19
 
@@ -5,6 +5,7 @@ module VMC::Start
5
5
  class Login < Base
6
6
  def precondition
7
7
  check_target
8
+ super
8
9
  end
9
10
 
10
11
  desc "Authenticate with the target"
@@ -3,6 +3,8 @@ require "vmc/cli/start/target_interactions"
3
3
 
4
4
  module VMC::Start
5
5
  class Target < Base
6
+ def precondition; end
7
+
6
8
  desc "Set or display the target cloud, organization, and space"
7
9
  group :start
8
10
  input :url, :desc => "Target URL to switch to", :argument => :optional
@@ -34,23 +36,10 @@ module VMC::Start
34
36
  end
35
37
  end
36
38
 
37
- return unless v2? && client.logged_in?
38
-
39
- if input.has?(:organization) || input.has?(:space)
40
- info = target_info
41
-
42
- select_org_and_space(input, info)
43
-
44
- save_target_info(info)
39
+ if v2?
40
+ puts "Warning: Targeting a v2 instance. Further commands will fail until a v1 instance is targeted. Please use the 'cf' command to target v2 instances."
45
41
  end
46
42
 
47
- return if quiet?
48
-
49
- invalidate_client
50
-
51
- line
52
- display_target
53
- display_org_and_space
54
43
  end
55
44
 
56
45
  private
@@ -1,8 +1,8 @@
1
- require "vmc/cli"
1
+ require "vmc/cli/v2_check_cli"
2
2
 
3
3
  module VMC
4
4
  module User
5
- class Base < CLI
5
+ class Base < V2CheckCLI
6
6
  def precondition
7
7
  check_logged_in
8
8
  end
@@ -0,0 +1,16 @@
1
+ require "vmc/cli/v2_check_cli"
2
+
3
+ module VMC
4
+ class V2CheckCLI < CLI
5
+ def precondition
6
+ fail_on_v2
7
+ end
8
+
9
+ def fail_on_v2
10
+ if v2?
11
+ fail "You are targeting a version 2 instance of Cloud Foundry: you must use the 'cf' command line client (which you can get with 'gem install cf')."
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.5.1.rc6".freeze
2
+ VERSION = "0.5.1".freeze
3
3
  end
@@ -0,0 +1,56 @@
1
+ require "spec_helper"
2
+
3
+ if ENV['VMC_V2_TEST_TARGET']
4
+ describe 'v2 deprecation', :ruby19 => true do
5
+ include ConsoleAppSpeckerMatchers
6
+
7
+ let(:target) { ENV['VMC_V2_TEST_TARGET'] }
8
+
9
+ before do
10
+ Interact::Progress::Dots.start!
11
+ end
12
+
13
+ after do
14
+ Interact::Progress::Dots.stop!
15
+ end
16
+
17
+ it "targeting a v2 instance informs the user to use CF to target v2 instances" do
18
+ run("#{vmc_bin} target #{target}") do |runner|
19
+ expect(runner).to say "Setting target"
20
+ expect(runner).to say target
21
+ expect(runner).to say "Warning: Targeting a v2 instance. Further commands will fail until a v1 instance is targeted. Please use the 'cf' command to target v2 instances."
22
+ runner.wait_for_exit
23
+ end
24
+ end
25
+
26
+ it "running any command against a targeted v2 instance produces an error" do
27
+ run("#{vmc_bin} target #{target}") { |runner| runner.wait_for_exit }
28
+
29
+ error_message = "You are targeting a version 2 instance of Cloud Foundry: you must use the 'cf' command line client (which you can get with 'gem install cf')."
30
+
31
+ run("#{vmc_bin} push") do |runner|
32
+ expect(runner).to say error_message
33
+ runner.wait_for_exit
34
+ end
35
+
36
+ run("#{vmc_bin} create-service") do |runner|
37
+ expect(runner).to say error_message
38
+ runner.wait_for_exit
39
+ end
40
+
41
+ run("#{vmc_bin} start") do |runner|
42
+ expect(runner).to say error_message
43
+ runner.wait_for_exit
44
+ end
45
+
46
+ run("#{vmc_bin} login") do |runner|
47
+ expect(runner).to say error_message
48
+ runner.wait_for_exit
49
+ end
50
+ end
51
+
52
+ end
53
+
54
+ else
55
+ $stderr.puts 'Skipping v2 integration specs; please provide $VMC_V2_TEST_TARGET'
56
+ end
@@ -98,26 +98,6 @@ command VMC::Start::Target do
98
98
  end
99
99
  end
100
100
  end
101
-
102
- describe "switching the space" do
103
- let(:space) { spaces.last }
104
- let(:tokens_yaml) { YAML.load_file(File.expand_path(tokens_file_path)) }
105
- let(:tokens_file_path) { '~/.vmc/tokens.yml' }
106
-
107
- def run_command
108
- vmc %W[target -s #{space.name}]
109
- end
110
-
111
- it "should not reprompt for organization" do
112
- dont_allow_ask("Organization", anything)
113
- run_command
114
- end
115
-
116
- it "sets the space param in the token file" do
117
- run_command
118
- expect(tokens_yaml["https://api.some-domain.com"][:space]).to be == 'space-id-2'
119
- end
120
- end
121
101
  end
122
102
  end
123
103
  end
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 2937694537
5
- prerelease: 6
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 1
10
- - rc
11
- - 6
12
- version: 0.5.1.rc6
10
+ version: 0.5.1
13
11
  platform: ruby
14
12
  authors:
15
13
  - Cloud Foundry Team
@@ -18,7 +16,7 @@ autorequire:
18
16
  bindir: bin
19
17
  cert_chain: []
20
18
 
21
- date: 2013-04-09 00:00:00 Z
19
+ date: 2013-06-14 00:00:00 Z
22
20
  dependencies:
23
21
  - !ruby/object:Gem::Dependency
24
22
  name: json_pure
@@ -73,7 +71,7 @@ dependencies:
73
71
  requirements:
74
72
  - - ">="
75
73
  - !ruby/object:Gem::Version
76
- hash: 2937694555
74
+ hash: 4187602971
77
75
  segments:
78
76
  - 0
79
77
  - 5
@@ -136,7 +134,7 @@ dependencies:
136
134
  requirements:
137
135
  - - ">="
138
136
  - !ruby/object:Gem::Version
139
- hash: 2937694561
137
+ hash: 4187602977
140
138
  segments:
141
139
  - 0
142
140
  - 6
@@ -307,6 +305,7 @@ files:
307
305
  - lib/vmc/cli/user/passwd.rb
308
306
  - lib/vmc/cli/user/register.rb
309
307
  - lib/vmc/cli/user/users.rb
308
+ - lib/vmc/cli/v2_check_cli.rb
310
309
  - lib/vmc/cli.rb
311
310
  - lib/vmc/constants.rb
312
311
  - lib/vmc/detect.rb
@@ -327,9 +326,7 @@ files:
327
326
  - spec/console_app_specker/specker_runner_spec.rb
328
327
  - spec/features/v1/new_user_flow_spec.rb
329
328
  - spec/features/v1/push_flow_spec.rb
330
- - spec/features/v2/account_lifecycle_spec.rb
331
- - spec/features/v2/login_spec.rb
332
- - spec/features/v2/switching_targets_spec.rb
329
+ - spec/features/v2/v2_deprecation_spec.rb
333
330
  - spec/spec_helper.rb
334
331
  - spec/support/command_helper.rb
335
332
  - spec/support/config_helper.rb
@@ -395,14 +392,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
395
392
  required_rubygems_version: !ruby/object:Gem::Requirement
396
393
  none: false
397
394
  requirements:
398
- - - ">"
395
+ - - ">="
399
396
  - !ruby/object:Gem::Version
400
- hash: 25
397
+ hash: 3
401
398
  segments:
402
- - 1
403
- - 3
404
- - 1
405
- version: 1.3.1
399
+ - 0
400
+ version: "0"
406
401
  requirements: []
407
402
 
408
403
  rubyforge_project: vmc
@@ -421,9 +416,7 @@ test_files:
421
416
  - spec/console_app_specker/specker_runner_spec.rb
422
417
  - spec/features/v1/new_user_flow_spec.rb
423
418
  - spec/features/v1/push_flow_spec.rb
424
- - spec/features/v2/account_lifecycle_spec.rb
425
- - spec/features/v2/login_spec.rb
426
- - spec/features/v2/switching_targets_spec.rb
419
+ - spec/features/v2/v2_deprecation_spec.rb
427
420
  - spec/spec_helper.rb
428
421
  - spec/support/command_helper.rb
429
422
  - spec/support/config_helper.rb
@@ -1,96 +0,0 @@
1
- require "spec_helper"
2
- require "webmock/rspec"
3
- require "ffaker"
4
-
5
- if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TARGET']
6
- describe 'A new user tries to use VMC against v2 production', :ruby19 => true do
7
- before(:all) do
8
- WebMock.allow_net_connect!
9
- end
10
-
11
- after(:all) do
12
- WebMock.disable_net_connect!
13
- end
14
-
15
- let(:target) { ENV['VMC_V2_TEST_TARGET'] }
16
- let(:username) { ENV['VMC_V2_TEST_USER'] }
17
- let(:password) { ENV['VMC_V2_TEST_PASSWORD'] }
18
-
19
- let(:client) do
20
- client = CFoundry::V2::Client.new("https://#{target}")
21
- client.login(username, password)
22
- client
23
- end
24
-
25
- before do
26
- Interact::Progress::Dots.start!
27
- end
28
-
29
- after do
30
- Interact::Progress::Dots.stop!
31
- end
32
-
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" if TRAVIS_BUILD_ID
35
-
36
- email = Faker::Internet.email
37
- run("#{vmc_bin} target #{target}") do |runner|
38
- runner.wait_for_exit
39
- end
40
-
41
- run("#{vmc_bin} login #{username} --password #{password}") do |runner|
42
- expect(runner).to say(
43
- "Organization>" => proc {
44
- runner.send_keys "1"
45
- expect(runner).to say /Switching to organization .*\.\.\. OK/
46
- },
47
- "Switching to organization" => proc {}
48
- )
49
-
50
- expect(runner).to say(
51
- "Space>" => proc {
52
- runner.send_keys "1"
53
- expect(runner).to say /Switching to space .*\.\.\. OK/
54
- },
55
- "Switching to space" => proc {}
56
- )
57
- end
58
-
59
- puts "registering #{email}"
60
- run("#{vmc_bin} register #{email} --password p") do |runner|
61
- expect(runner).to say "Confirm Password>"
62
- runner.send_keys 'p'
63
- expect(runner).to say "Your password strength is: good"
64
- expect(runner).to say "Creating user... OK"
65
- expect(runner).to say "Authenticating... OK"
66
- end
67
-
68
- run("#{vmc_bin} logout") do |runner|
69
- runner.wait_for_exit
70
- end
71
-
72
- run("#{vmc_bin} login #{username} --password #{password}") do |runner|
73
- expect(runner).to say "Organization>"
74
- runner.send_keys "1"
75
- expect(runner).to say "Space>"
76
- runner.send_keys "1"
77
- end
78
-
79
- # run("#{vmc_bin} delete-user #{email}") do |runner|
80
- # expect(runner).to say "Really delete user #{email}?>"
81
- # runner.send_keys "y"
82
- # expect(runner).to say "Deleting #{email}... OK"
83
- # end
84
-
85
- puts "deleting #{email}"
86
- client.login(email, "p")
87
- user = client.current_user
88
- guid = user.guid
89
- client.login(username, password)
90
- user.delete!
91
- client.base.uaa.delete_user(guid)
92
- end
93
- end
94
- else
95
- $stderr.puts 'Skipping v2 integration specs; please provide $VMC_V2_TEST_TARGET, $VMC_V2_TEST_USER, and $VMC_V2_TEST_PASSWORD'
96
- end
@@ -1,66 +0,0 @@
1
- require "spec_helper"
2
-
3
- if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TARGET'] && ENV['VMC_V2_OTHER_TEST_USER']
4
- describe 'A user logs in and switches spaces, after a different user has logged in', :ruby19 => true do
5
- include ConsoleAppSpeckerMatchers
6
-
7
- let(:target) { ENV['VMC_V2_TEST_TARGET'] }
8
- let(:username) { ENV['VMC_V2_TEST_USER'] }
9
- let(:password) { ENV['VMC_V2_TEST_PASSWORD'] }
10
-
11
- let(:second_username) { ENV['VMC_V2_OTHER_TEST_USER'] }
12
- let(:second_organization) { ENV['VMC_V2_OTHER_TEST_ORGANIZATION'] }
13
- let(:second_space) { ENV['VMC_V2_OTHER_TEST_SPACE'] }
14
- let(:second_password) { ENV['VMC_V2_OTHER_TEST_PASSWORD'] || ENV['VMC_V2_TEST_PASSWORD'] }
15
-
16
- before do
17
- Interact::Progress::Dots.start!
18
-
19
- run("#{vmc_bin} target #{target}") do |runner|
20
- expect(runner).to say "Setting target"
21
- expect(runner).to say target
22
- runner.wait_for_exit
23
- end
24
-
25
- run("#{vmc_bin} logout") do |runner|
26
- runner.wait_for_exit
27
- end
28
- end
29
-
30
- after do
31
- Interact::Progress::Dots.stop!
32
- end
33
-
34
- context "when a different user is already logged in" do
35
- before do
36
- run("#{vmc_bin} login #{username} --password #{password}") do |runner|
37
- expect(runner).to say "Authenticating... OK"
38
- expect(runner).to say "Organization>"
39
- runner.send_keys("pivotal")
40
-
41
- expect(runner).to say "Switching to organization"
42
- expect(runner).to say "OK"
43
-
44
- expect(runner).to say "Space"
45
- runner.send_keys("1")
46
-
47
- expect(runner).to say "Switching to space"
48
- expect(runner).to say "OK"
49
-
50
- runner.wait_for_exit
51
- end
52
- end
53
-
54
- it "can switch spaces on login" do
55
- run("#{vmc_bin} login #{second_username} --password #{second_password} --organization #{second_organization} --space #{second_space}") do |runner|
56
- expect(runner).to say "Authenticating... OK"
57
- expect(runner).to say "Switching to organization #{second_organization}... OK"
58
- expect(runner).to say "Switching to space #{second_space}... OK"
59
- runner.wait_for_exit
60
- end
61
- end
62
- end
63
- end
64
- else
65
- $stderr.puts 'Skipping v2 integration specs; please provide $VMC_V2_TEST_TARGET, $VMC_V2_TEST_USER, $VMC_V2_TEST_PASSWORD, and $VMC_V2_OTHER_TEST_USER'
66
- end
@@ -1,32 +0,0 @@
1
- require "spec_helper"
2
-
3
- if ENV['VMC_V2_TEST_TARGET']
4
- describe 'A new user tries to use VMC against v2 production', :ruby19 => true do
5
- include ConsoleAppSpeckerMatchers
6
-
7
- let(:target) { ENV['VMC_V2_TEST_TARGET'] }
8
-
9
- before do
10
- Interact::Progress::Dots.start!
11
- end
12
-
13
- after do
14
- Interact::Progress::Dots.stop!
15
- end
16
-
17
- it "can switch targets, even if a target is invalid" do
18
- run("#{vmc_bin} target invalid-target") do |runner|
19
- expect(runner).to say "Target refused"
20
- runner.wait_for_exit
21
- end
22
-
23
- run("#{vmc_bin} target #{target}") do |runner|
24
- expect(runner).to say "Setting target"
25
- expect(runner).to say target
26
- runner.wait_for_exit
27
- end
28
- end
29
- end
30
- else
31
- $stderr.puts 'Skipping v2 integration specs; please provide $VMC_V2_TEST_TARGET'
32
- end