cf 4.1.4 → 4.1.5.rc1

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.
@@ -13,7 +13,12 @@ module CF
13
13
  private
14
14
 
15
15
  def choices
16
- client.organizations(:depth => 0)
16
+ organization_response = client.organizations_first_page(:depth => 0)
17
+ if organization_response[:next_page]
18
+ "Login successful. Too many organizations (>50) to list. Remember to set your target organization using 'target -o [ORGANIZATION]'."
19
+ else
20
+ organization_response[:results]
21
+ end
17
22
  end
18
23
 
19
24
  def valid?(organization)
@@ -51,6 +51,8 @@ module CF
51
51
  raise CF::UserFriendlyError.new(
52
52
  "There are no #{type}s. You may want to create one with #{c("create-#{type == :organization ? "org" : type}", :good)}."
53
53
  )
54
+ elsif object_choices.is_a?(String)
55
+ raise CF::UserFriendlyError.new(object_choices)
54
56
  elsif object_choices.size == 1 && !input.interactive?(type)
55
57
  object_choices.first
56
58
  else
@@ -1,3 +1,3 @@
1
1
  module CF
2
- VERSION = "4.1.4".freeze
2
+ VERSION = "4.1.5.rc1".freeze
3
3
  end
@@ -116,7 +116,7 @@ module CF
116
116
 
117
117
  context "but that organization doesn't exist anymore (not valid)" do
118
118
  before do
119
- client.stub(:organizations).and_return(organizations)
119
+ client.stub(:organizations_first_page).and_return({:results => organizations})
120
120
  organization.stub(:users).and_raise(CFoundry::APIError)
121
121
  end
122
122
 
@@ -130,7 +130,7 @@ module CF
130
130
  context "without an organization in the config file" do
131
131
  context "when the user has organizations" do
132
132
  before do
133
- client.stub(:organizations).and_return(organizations)
133
+ client.stub(:organizations_first_page).and_return({:results => organizations})
134
134
  write_token_file({})
135
135
  end
136
136
 
@@ -151,7 +151,7 @@ module CF
151
151
 
152
152
  context "when the user has no organizations" do
153
153
  before do
154
- client.stub(:organizations).and_return([])
154
+ client.stub(:organizations_first_page).and_return({:results => []})
155
155
  write_token_file({})
156
156
  end
157
157
 
@@ -159,6 +159,17 @@ module CF
159
159
  expect { execute_populate_and_save }.to raise_error(CF::UserFriendlyError, "There are no organizations. You may want to create one with create-org.")
160
160
  end
161
161
  end
162
+
163
+ context "when the user has too many organizations" do
164
+ before do
165
+ client.stub(:organizations_first_page).and_return({:results => organizations, :next_page => true})
166
+ write_token_file({})
167
+ end
168
+
169
+ it "tells the user to set their target" do
170
+ expect { execute_populate_and_save }.to raise_error(CF::UserFriendlyError, "Login successful. Too many organizations (>50) to list. Remember to set your target organization using 'target -o [ORGANIZATION]'.")
171
+ end
172
+ end
162
173
  end
163
174
  end
164
175
  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: 4.1.4
5
- prerelease:
4
+ version: 4.1.5.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cloud Foundry Team
@@ -51,7 +51,7 @@ dependencies:
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 2.3.6
54
+ version: 2.3.7.rc1
55
55
  - - <
56
56
  - !ruby/object:Gem::Version
57
57
  version: '3.0'
@@ -62,7 +62,7 @@ dependencies:
62
62
  requirements:
63
63
  - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 2.3.6
65
+ version: 2.3.7.rc1
66
66
  - - <
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
@@ -617,16 +617,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
617
617
  version: '0'
618
618
  segments:
619
619
  - 0
620
- hash: -2711379081338960177
620
+ hash: 1032550194868071774
621
621
  required_rubygems_version: !ruby/object:Gem::Requirement
622
622
  none: false
623
623
  requirements:
624
- - - ! '>='
624
+ - - ! '>'
625
625
  - !ruby/object:Gem::Version
626
- version: '0'
627
- segments:
628
- - 0
629
- hash: -2711379081338960177
626
+ version: 1.3.1
630
627
  requirements: []
631
628
  rubyforge_project: cf
632
629
  rubygems_version: 1.8.25