vmc 0.5.1.rc1 → 0.5.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -41
- data/lib/vmc/cli/space/create.rb +3 -0
- data/lib/vmc/version.rb +1 -1
- data/spec/features/v1/new_user_flow_spec.rb +1 -1
- data/spec/features/v2/account_lifecycle_spec.rb +29 -8
- data/spec/features/v2/push_flow_spec.rb +2 -2
- data/spec/features/v2/switching_targets_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/command_helper.rb +1 -0
- data/spec/support/tracking_expector.rb +1 -1
- data/spec/vmc/cli/space/create_spec.rb +54 -34
- metadata +55 -55
data/Rakefile
CHANGED
@@ -8,44 +8,5 @@ CURRENT_VERSION = SPEC.version.to_s.freeze
|
|
8
8
|
RSpec::Core::RakeTask.new(:spec)
|
9
9
|
task :default => :spec
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
`git rev-parse latest-staging`.strip
|
14
|
-
end
|
15
|
-
|
16
|
-
def last_release_sha
|
17
|
-
`git rev-parse latest-release`.strip
|
18
|
-
end
|
19
|
-
|
20
|
-
def last_staging_ref_was_released?
|
21
|
-
last_staging_sha == last_release_sha
|
22
|
-
end
|
23
|
-
|
24
|
-
def next_minor
|
25
|
-
Gem::Version.new(CURRENT_VERSION + ".0").bump.to_s
|
26
|
-
end
|
27
|
-
|
28
|
-
def next_rc
|
29
|
-
unless CURRENT_VERSION =~ /rc/
|
30
|
-
"#{next_minor}.rc1"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
task :staging, :version do |_, args|
|
35
|
-
version = args.version || next_rc
|
36
|
-
sh "gem bump --push #{"--version #{version}" if version}" if last_staging_ref_was_released?
|
37
|
-
sh "git tag -f latest-staging"
|
38
|
-
sh "git push origin :latest-staging"
|
39
|
-
sh "git push origin latest-staging"
|
40
|
-
end
|
41
|
-
|
42
|
-
task :candidate do
|
43
|
-
sh "git fetch"
|
44
|
-
sh "git checkout latest-staging"
|
45
|
-
sh "gem release"
|
46
|
-
sh "git tag -f v#{CURRENT_VERSION}"
|
47
|
-
sh "git tag -f latest-release"
|
48
|
-
sh "git push origin :latest-release"
|
49
|
-
sh "git push origin latest-release"
|
50
|
-
end
|
51
|
-
end
|
11
|
+
# looking for a way to push gems? check out the new frontend-release git repo!
|
12
|
+
# git@github.com:pivotal-vmware/frontend-release.git
|
data/lib/vmc/cli/space/create.rb
CHANGED
@@ -16,6 +16,7 @@ module VMC::Space
|
|
16
16
|
input :auditor, :desc => "Add yourself as auditor", :default => false
|
17
17
|
|
18
18
|
def create_space
|
19
|
+
# TODO: ask org instead
|
19
20
|
return invoke :help,
|
20
21
|
:command => "create-space" if input[:organization].nil?
|
21
22
|
|
@@ -48,6 +49,8 @@ module VMC::Space
|
|
48
49
|
if input[:target]
|
49
50
|
invoke :target, :organization => space.organization,
|
50
51
|
:space => space
|
52
|
+
else
|
53
|
+
line c("Space created! Use #{b("switch-space #{space.name}")} to target it.", :good)
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
data/lib/vmc/version.rb
CHANGED
@@ -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 =
|
14
|
+
fuzz = TRAVIS_BUILD_ID || Time.new.to_f.to_s.gsub(".", "_")
|
15
15
|
"hello-sinatra-#{fuzz}"
|
16
16
|
end
|
17
17
|
|
@@ -1,14 +1,27 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "webmock/rspec"
|
3
|
+
require "ffaker"
|
3
4
|
|
4
5
|
if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TARGET']
|
5
6
|
describe 'A new user tries to use VMC against v2 production', :ruby19 => true do
|
6
|
-
|
7
|
+
before(:all) do
|
8
|
+
WebMock.allow_net_connect!
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:all) do
|
12
|
+
WebMock.disable_net_connect!
|
13
|
+
end
|
7
14
|
|
8
15
|
let(:target) { ENV['VMC_V2_TEST_TARGET'] }
|
9
16
|
let(:username) { ENV['VMC_V2_TEST_USER'] }
|
10
17
|
let(:password) { ENV['VMC_V2_TEST_PASSWORD'] }
|
11
18
|
|
19
|
+
let(:client) do
|
20
|
+
client = CFoundry::V2::Client.new("https://#{target}")
|
21
|
+
client.login(username, password)
|
22
|
+
client
|
23
|
+
end
|
24
|
+
|
12
25
|
before do
|
13
26
|
Interact::Progress::Dots.start!
|
14
27
|
end
|
@@ -18,7 +31,7 @@ if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TA
|
|
18
31
|
end
|
19
32
|
|
20
33
|
it "registers a new account and deletes it" do
|
21
|
-
pending "until we get some v2 admin credentials somewhere to actually run this with"
|
34
|
+
pending "until we get some v2 admin credentials somewhere to actually run this with" if TRAVIS_BUILD_ID
|
22
35
|
|
23
36
|
email = Faker::Internet.email
|
24
37
|
run("#{vmc_bin} target #{target}") do |runner|
|
@@ -52,13 +65,21 @@ if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TA
|
|
52
65
|
runner.send_keys "1"
|
53
66
|
end
|
54
67
|
|
55
|
-
run("#{vmc_bin} delete-user #{email}") do |runner|
|
56
|
-
expect(runner).to say "Really delete user #{email}?>"
|
57
|
-
runner.send_keys "y"
|
58
|
-
expect(runner).to say "Deleting #{email}... OK"
|
59
|
-
end
|
68
|
+
# run("#{vmc_bin} delete-user #{email}") do |runner|
|
69
|
+
# expect(runner).to say "Really delete user #{email}?>"
|
70
|
+
# runner.send_keys "y"
|
71
|
+
# expect(runner).to say "Deleting #{email}... OK"
|
72
|
+
# end
|
73
|
+
|
74
|
+
puts "deleting #{email}"
|
75
|
+
client.login(email, "p")
|
76
|
+
user = client.current_user
|
77
|
+
guid = user.guid
|
78
|
+
client.login(username, password)
|
79
|
+
user.delete!
|
80
|
+
client.base.uaa.delete_user(guid)
|
60
81
|
end
|
61
82
|
end
|
62
83
|
else
|
63
84
|
$stderr.puts 'Skipping v2 integration specs; please provide $VMC_V2_TEST_TARGET, $VMC_V2_TEST_USER, and $VMC_V2_TEST_PASSWORD'
|
64
|
-
end
|
85
|
+
end
|
@@ -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 =
|
14
|
+
fuzz = TRAVIS_BUILD_ID || Time.new.to_f.to_s.gsub(".", "_")
|
15
15
|
"hello-sinatra-#{fuzz}"
|
16
16
|
end
|
17
17
|
|
@@ -103,7 +103,7 @@ if ENV['VMC_V2_TEST_USER'] && ENV['VMC_V2_TEST_PASSWORD'] && ENV['VMC_V2_TEST_TA
|
|
103
103
|
expect(runner).to say "Uploading #{app}... OK"
|
104
104
|
expect(runner).to say "Starting #{app}... OK"
|
105
105
|
|
106
|
-
expect(runner).to say
|
106
|
+
expect(runner).to say /(Using|Installing) Ruby/i, 10
|
107
107
|
expect(runner).to say "Your bundle is complete!", 30
|
108
108
|
|
109
109
|
expect(runner).to say "Checking #{app}..."
|
@@ -16,7 +16,7 @@ if ENV['VMC_V2_TEST_TARGET']
|
|
16
16
|
|
17
17
|
it "can switch targets, even if a target is invalid" do
|
18
18
|
run("#{vmc_bin} target invalid-target") do |runner|
|
19
|
-
expect(runner).to say
|
19
|
+
expect(runner).to say "Target refused"
|
20
20
|
runner.wait_for_exit
|
21
21
|
end
|
22
22
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,25 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require "vmc/cli/space/create"
|
3
3
|
|
4
|
-
|
5
|
-
let(:spaces) { fake_list(:space, 3) }
|
6
|
-
let(:organization) { fake(:organization, :spaces => spaces) }
|
7
|
-
let(:new_space) { stub! }
|
8
|
-
let(:client) { fake_client(:current_organization => organization, :spaces => spaces) }
|
9
|
-
let(:new_name) { "some-new-name" }
|
10
|
-
|
11
|
-
before do
|
12
|
-
%w{create! organization= name= name add_manager add_developer add_auditor organization}.each do |method|
|
13
|
-
new_space.__send__(method.to_sym)
|
14
|
-
end
|
15
|
-
|
16
|
-
stub(client).space { new_space }
|
17
|
-
any_instance_of described_class do |cli|
|
18
|
-
stub(cli).client { client }
|
19
|
-
stub(cli).precondition { nil }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
4
|
+
command VMC::Space::Create do
|
23
5
|
describe 'metadata' do
|
24
6
|
let(:command) { Mothership.commands[:create_space] }
|
25
7
|
|
@@ -42,31 +24,69 @@ describe VMC::Space::Create do
|
|
42
24
|
end
|
43
25
|
end
|
44
26
|
|
45
|
-
|
46
|
-
|
27
|
+
describe "running the command" do
|
28
|
+
let(:client) do
|
29
|
+
fake_client(:current_organization => organization)
|
30
|
+
end
|
47
31
|
|
48
|
-
|
49
|
-
|
50
|
-
|
32
|
+
let(:organization) { fake(:organization) }
|
33
|
+
|
34
|
+
let(:new_space) { fake :space, :name => new_name }
|
35
|
+
let(:new_name) { "some-new-name" }
|
36
|
+
|
37
|
+
before do
|
38
|
+
stub(client).space { new_space }
|
39
|
+
stub(new_space).create!
|
40
|
+
stub(new_space).add_manager
|
41
|
+
stub(new_space).add_developer
|
42
|
+
stub(new_space).add_auditor
|
43
|
+
end
|
51
44
|
|
52
|
-
|
53
|
-
|
45
|
+
context "when --target is given" do
|
46
|
+
subject { vmc %W[create-space #{new_space.name} --target] }
|
47
|
+
|
48
|
+
it "switches them to the new space" do
|
49
|
+
mock_invoke :target, :organization => organization,
|
50
|
+
:space => new_space
|
51
|
+
subject
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
57
|
-
context "when
|
58
|
-
|
55
|
+
context "when --target is NOT given" do
|
56
|
+
subject { vmc %W[create-space #{new_space.name}] }
|
59
57
|
|
60
|
-
it "
|
58
|
+
it "tells the user how they can switch to the new space" do
|
61
59
|
subject
|
60
|
+
expect(output).to say("Space created! Use switch-space #{new_space.name} to target it.")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when we don't specify an organization" do
|
65
|
+
subject { vmc %W[create-space #{new_space.name}] }
|
62
66
|
|
63
|
-
|
64
|
-
|
67
|
+
context "when we have a default organization" do
|
68
|
+
it "uses that organization to create a space" do
|
69
|
+
subject
|
70
|
+
|
71
|
+
stdout.rewind
|
72
|
+
expect(stdout.readline).to include "Creating space"
|
73
|
+
end
|
65
74
|
end
|
66
75
|
|
67
|
-
|
68
|
-
|
69
|
-
|
76
|
+
context "when we don't have a default organization" do
|
77
|
+
let(:organization) { nil }
|
78
|
+
|
79
|
+
it "shows the help for the command" do
|
80
|
+
subject
|
81
|
+
|
82
|
+
stdout.rewind
|
83
|
+
expect(stdout.readline).to include "Create a space in an organization"
|
84
|
+
end
|
85
|
+
|
86
|
+
it "does not try to create the space" do
|
87
|
+
new_space.create! { raise "should not call this method" } # rr not behaving
|
88
|
+
subject
|
89
|
+
end
|
70
90
|
end
|
71
91
|
end
|
72
92
|
end
|
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:
|
4
|
+
hash: -656826288
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
9
|
- 1
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 0.5.1.
|
11
|
+
- 2
|
12
|
+
version: 0.5.1.rc2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Cloud Foundry Team
|
@@ -18,12 +18,10 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2013-03-
|
21
|
+
date: 2013-03-07 00:00:00 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
25
|
-
prerelease: false
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
27
25
|
none: false
|
28
26
|
requirements:
|
29
27
|
- - ~>
|
@@ -33,12 +31,12 @@ dependencies:
|
|
33
31
|
- 1
|
34
32
|
- 6
|
35
33
|
version: "1.6"
|
34
|
+
prerelease: false
|
36
35
|
type: :runtime
|
37
|
-
|
36
|
+
name: json_pure
|
37
|
+
requirement: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
|
40
|
-
prerelease: false
|
41
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
40
|
none: false
|
43
41
|
requirements:
|
44
42
|
- - ~>
|
@@ -48,12 +46,12 @@ dependencies:
|
|
48
46
|
- 1
|
49
47
|
- 3
|
50
48
|
version: "1.3"
|
49
|
+
prerelease: false
|
51
50
|
type: :runtime
|
52
|
-
|
51
|
+
name: multi_json
|
52
|
+
requirement: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
55
|
-
prerelease: false
|
56
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
58
56
|
requirements:
|
59
57
|
- - ~>
|
@@ -63,24 +61,24 @@ dependencies:
|
|
63
61
|
- 0
|
64
62
|
- 5
|
65
63
|
version: "0.5"
|
64
|
+
prerelease: false
|
66
65
|
type: :runtime
|
67
|
-
|
66
|
+
name: interact
|
67
|
+
requirement: *id003
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
|
70
|
-
prerelease: false
|
71
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
70
|
none: false
|
73
71
|
requirements:
|
74
72
|
- - ">="
|
75
73
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
74
|
+
hash: -656826304
|
77
75
|
segments:
|
78
76
|
- 0
|
79
77
|
- 5
|
80
78
|
- 3
|
81
79
|
- rc
|
82
|
-
-
|
83
|
-
version: 0.5.3.
|
80
|
+
- 2
|
81
|
+
version: 0.5.3.rc2
|
84
82
|
- - <
|
85
83
|
- !ruby/object:Gem::Version
|
86
84
|
hash: 7
|
@@ -88,12 +86,12 @@ dependencies:
|
|
88
86
|
- 0
|
89
87
|
- 6
|
90
88
|
version: "0.6"
|
89
|
+
prerelease: false
|
91
90
|
type: :runtime
|
92
|
-
|
91
|
+
name: cfoundry
|
92
|
+
requirement: *id004
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
|
95
|
-
prerelease: false
|
96
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
94
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
97
95
|
none: false
|
98
96
|
requirements:
|
99
97
|
- - ~>
|
@@ -103,12 +101,12 @@ dependencies:
|
|
103
101
|
- 0
|
104
102
|
- 0
|
105
103
|
version: "0.0"
|
104
|
+
prerelease: false
|
106
105
|
type: :runtime
|
107
|
-
|
106
|
+
name: clouseau
|
107
|
+
requirement: *id005
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
|
-
|
110
|
-
prerelease: false
|
111
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
109
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
112
110
|
none: false
|
113
111
|
requirements:
|
114
112
|
- - ">="
|
@@ -126,12 +124,12 @@ dependencies:
|
|
126
124
|
- 1
|
127
125
|
- 0
|
128
126
|
version: "1.0"
|
127
|
+
prerelease: false
|
129
128
|
type: :runtime
|
130
|
-
|
129
|
+
name: mothership
|
130
|
+
requirement: *id006
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
|
133
|
-
prerelease: false
|
134
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
132
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
135
133
|
none: false
|
136
134
|
requirements:
|
137
135
|
- - ~>
|
@@ -142,12 +140,12 @@ dependencies:
|
|
142
140
|
- 6
|
143
141
|
- 2
|
144
142
|
version: 0.6.2
|
143
|
+
prerelease: false
|
145
144
|
type: :runtime
|
146
|
-
|
145
|
+
name: manifests-vmc-plugin
|
146
|
+
requirement: *id007
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
|
-
|
149
|
-
prerelease: false
|
150
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
148
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
151
149
|
none: false
|
152
150
|
requirements:
|
153
151
|
- - ~>
|
@@ -158,12 +156,12 @@ dependencies:
|
|
158
156
|
- 2
|
159
157
|
- 2
|
160
158
|
version: 0.2.2
|
159
|
+
prerelease: false
|
161
160
|
type: :runtime
|
162
|
-
|
161
|
+
name: tunnel-vmc-plugin
|
162
|
+
requirement: *id008
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
|
-
|
165
|
-
prerelease: false
|
166
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
164
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
167
165
|
none: false
|
168
166
|
requirements:
|
169
167
|
- - ~>
|
@@ -173,12 +171,12 @@ dependencies:
|
|
173
171
|
- 0
|
174
172
|
- 9
|
175
173
|
version: "0.9"
|
174
|
+
prerelease: false
|
176
175
|
type: :development
|
177
|
-
|
176
|
+
name: rake
|
177
|
+
requirement: *id009
|
178
178
|
- !ruby/object:Gem::Dependency
|
179
|
-
|
180
|
-
prerelease: false
|
181
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
179
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
182
180
|
none: false
|
183
181
|
requirements:
|
184
182
|
- - ~>
|
@@ -188,12 +186,12 @@ dependencies:
|
|
188
186
|
- 2
|
189
187
|
- 11
|
190
188
|
version: "2.11"
|
189
|
+
prerelease: false
|
191
190
|
type: :development
|
192
|
-
|
191
|
+
name: rspec
|
192
|
+
requirement: *id010
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
|
-
|
195
|
-
prerelease: false
|
196
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
194
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
197
195
|
none: false
|
198
196
|
requirements:
|
199
197
|
- - ~>
|
@@ -203,12 +201,12 @@ dependencies:
|
|
203
201
|
- 1
|
204
202
|
- 9
|
205
203
|
version: "1.9"
|
204
|
+
prerelease: false
|
206
205
|
type: :development
|
207
|
-
|
206
|
+
name: webmock
|
207
|
+
requirement: *id011
|
208
208
|
- !ruby/object:Gem::Dependency
|
209
|
-
|
210
|
-
prerelease: false
|
211
|
-
requirement: &id012 !ruby/object:Gem::Requirement
|
209
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
212
210
|
none: false
|
213
211
|
requirements:
|
214
212
|
- - ~>
|
@@ -218,8 +216,10 @@ dependencies:
|
|
218
216
|
- 1
|
219
217
|
- 0
|
220
218
|
version: "1.0"
|
219
|
+
prerelease: false
|
221
220
|
type: :development
|
222
|
-
|
221
|
+
name: rr
|
222
|
+
requirement: *id012
|
223
223
|
description:
|
224
224
|
email:
|
225
225
|
- vcap-dev@googlegroups.com
|