cf 4.2.8.rc2 → 4.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,6 @@
1
1
  require "cf/cli/service/base"
2
2
 
3
3
  module CF::Service
4
- USER_PROVIDED_OFFERING = "user-provided" # I'd rather move this to CFoundry
5
-
6
- class UPDummy
7
- def label
8
- "user-provided"
9
- end
10
-
11
- attr_reader :version, :provider
12
- end
13
-
14
4
  class Create < Base
15
5
  offerings_from_label = proc { |label, offerings|
16
6
  offerings.select { |s| s.label == label }
@@ -56,8 +46,6 @@ module CF::Service
56
46
  end
57
47
  finalize
58
48
 
59
- offerings << UPDummy.new
60
-
61
49
  selected_offerings = offerings.any? ? Array(input[:offering, offerings.sort_by(&:label)]) : []
62
50
  finalize
63
51
 
@@ -67,80 +55,48 @@ module CF::Service
67
55
 
68
56
  offering = selected_offerings.first
69
57
 
70
- if offering.label == CF::Service::USER_PROVIDED_OFFERING
71
- service_instance = client.user_provided_service_instance
72
- service_instance.name = input[:name, offering]
73
- finalize
74
-
75
- service_instance.credentials = ask_credentials # input[:credentials]
76
- else
77
- service_instance = client.service_instance
78
- service_instance.name = input[:name, offering]
79
- finalize
80
-
81
- plan = input[:plan, offering.service_plans]
82
- finalize
83
- service_instance.service_plan = if plan.is_a?(String)
84
- offering.service_plans.find { |p| p.name.casecmp(plan) == 0 }
85
- else
86
- plan
87
- end
88
- end
89
-
90
- service_instance.space = client.current_space
91
-
92
- with_progress("Creating service #{c(service_instance.name, :name)}") do
93
- service_instance.create!
58
+ service = client.service_instance
59
+ service.name = input[:name, offering]
60
+ finalize
61
+ plan = input[:plan, offering.service_plans]
62
+ finalize
63
+ service.service_plan = if plan.is_a?(String)
64
+ offering.service_plans.find { |p| p.name.casecmp(plan) == 0 }
65
+ else
66
+ plan
67
+ end
68
+ service.space = client.current_space
69
+
70
+ with_progress("Creating service #{c(service.name, :name)}") do
71
+ service.create!
94
72
  end
95
73
 
96
74
  app = input[:app]
97
75
  finalize
98
76
 
99
77
  if app
100
- invoke :bind_service, :service => service_instance, :app => app
78
+ invoke :bind_service, :service => service, :app => app
101
79
  end
102
- service_instance
80
+ service
103
81
  end
104
82
 
105
83
  private
106
84
 
107
- def ask_credentials
108
- credentials = {}
109
- line("What credentials parameters should applications use to connect to this service instance? (e.g. key: uri, value: mysql://username:password@hostname:port/name)")
110
-
111
- while true
112
- key = ask("Key")
113
- finalize
114
- value = ask("Value")
115
- finalize
116
- credentials[key] = value
117
-
118
- break unless ask("Another credentials parameter?", :default => false)
119
- end
120
-
121
- credentials
122
- end
123
-
124
85
  def ask_offering(offerings)
125
86
  [ask("What kind?", :choices => offerings.sort_by(&:label),
126
- :display => proc do |s|
87
+ :display => proc { |s|
127
88
  str = "#{c(s.label, :name)} #{s.version}"
128
89
  if s.provider != "core"
129
90
  str << ", via #{s.provider}"
130
91
  end
131
92
  str
132
- end,
93
+ },
133
94
  :complete => proc { |s| "#{s.label} #{s.version}" })]
134
95
  end
135
96
 
136
97
  def ask_name(offering)
137
- default = nil
138
- unless offering == CF::Service::USER_PROVIDED_OFFERING
139
- random = sprintf("%x", rand(1000000))
140
- default = "#{offering.label}-#{random}"
141
- end
142
-
143
- ask "Name?", :default => default
98
+ random = sprintf("%x", rand(1000000))
99
+ ask "Name?", :default => "#{offering.label}-#{random}"
144
100
  end
145
101
 
146
102
  def ask_plan(plans)
@@ -76,7 +76,7 @@ module CF::Service
76
76
  plan = i.service_plan
77
77
 
78
78
  unless plan
79
- [ c(i.name, :name), "user-provided", "none", "none", "none", apps]
79
+ [ c(i.name, :name), "none", "none", "none", "none", apps]
80
80
  else
81
81
  service = plan.service
82
82
  label = service.label
@@ -1,3 +1,3 @@
1
1
  module CF
2
- VERSION = "4.2.8.rc2".freeze
2
+ VERSION = "4.2.8".freeze
3
3
  end
@@ -94,38 +94,6 @@ module CF
94
94
  capture_output { command }
95
95
  end
96
96
  end
97
-
98
- describe "when selecting the user-provided service" do
99
- let(:services) { [build(:service), build(:service)] }
100
- let(:user_provided_service) { build(:service, label: "user-provided")}
101
-
102
- before do
103
- client.stub(:services).and_return(services)
104
- end
105
-
106
- it "asks for an instance name and credentials" do
107
- should_ask("What kind?", hash_including(choices: include(has_label("user-provided")))) { user_provided_service }
108
- should_ask("Name?", anything) { "user-provided-service-name-1" }
109
-
110
- should_print("What credentials parameters should applications use to connect to this service instance? (e.g. key: uri, value: mysql://username:password@hostname:port/name)")
111
- should_ask("Key") { "host" }
112
- should_ask("Value") { "example.com" }
113
- should_ask("Another credentials parameter?", anything) { true }
114
- should_ask("Key") { "port" }
115
- should_ask("Value") { 8080 }
116
- should_ask("Another credentials parameter?", anything) { false }
117
- mock_with_progress("Creating service user-provided-service-name-1")
118
-
119
- instance = client.user_provided_service_instance
120
- client.should_receive(:user_provided_service_instance).and_return(instance)
121
- instance.should_receive(:create!)
122
-
123
- capture_output { command }
124
-
125
- instance.credentials['host'].should == 'example.com'
126
- instance.credentials['port'].should == 8080
127
- end
128
- end
129
97
  end
130
98
  end
131
99
  end
@@ -48,28 +48,23 @@ module CF
48
48
  let(:current_space) { build(:space, :name => "the space") }
49
49
 
50
50
  subject do
51
- capture_output { CF::CLI.new.invoke(:services, inputs, given, global) }
51
+ capture_output { Mothership.new.invoke(:services, inputs, given, global) }
52
52
  end
53
53
 
54
54
  before do
55
- stub_client
55
+ stub_client_and_precondition
56
56
  client.stub(:service_bindings).and_return([service_binding])
57
57
  end
58
58
 
59
- context "when the user is targeted to a space" do
60
- before do
61
- stub_precondition
62
- end
63
-
64
- it "produces a table of services" do
65
- subject
66
- stdout.rewind
67
- output = stdout.read
59
+ it "produces a table of services" do
60
+ subject
61
+ stdout.rewind
62
+ output = stdout.read
68
63
 
69
- expect(output).to match /Getting services in the space.*OK/
64
+ expect(output).to match /Getting services in the space.*OK/
70
65
 
71
- expect(output).to match /name\s+service\s+provider\s+version\s+plan\s+bound apps/
72
- expect(output).to match /service-instance-.+?\s+ # name
66
+ expect(output).to match /name\s+service\s+provider\s+version\s+plan\s+bound apps/
67
+ expect(output).to match /service-instance-.+?\s+ # name
73
68
  service-.*?\s+ # service
74
69
  provider.*?\s+ # provider
75
70
  service_version\s+ # version
@@ -77,69 +72,45 @@ module CF
77
72
  app-name-\d+\s+ # bound apps
78
73
  /x
79
74
 
80
- end
81
-
82
- context "when one of the services does not have a service plan" do
83
- let(:service_instances) { [service1, service2]}
84
- let(:service2) { build(:service_instance, :service_plan => nil, :service_bindings => [service_binding]) }
75
+ end
85
76
 
86
- it 'still produces a table of service' do
87
- subject
88
- stdout.rewind
89
- output = stdout.read
77
+ context "when one of the services does not have a service plan" do
78
+ let(:service_instances) { [service1, service2]}
79
+ let(:service2) { build(:service_instance, :service_plan => nil, :service_bindings => [service_binding]) }
80
+ it 'still produces a table of service' do
81
+ subject
82
+ stdout.rewind
83
+ output = stdout.read
90
84
 
91
- expect(output).to match /Getting services in the space.*OK/
85
+ expect(output).to match /Getting services in the space.*OK/
92
86
 
93
- expect(output).to match /name\s+service\s+provider\s+version\s+plan\s+bound apps/
87
+ expect(output).to match /name\s+service\s+provider\s+version\s+plan\s+bound apps/
94
88
 
95
- expect(output).to match /service-instance-.+?\s+ # name
89
+ expect(output).to match /service-instance-.+?\s+ # name
96
90
  service-.*?\s+ # service
97
91
  provider.*?\s+ # provider
98
92
  service_version\s+ # version
99
93
  service-plan-.*?\s+ # plan
100
- app-name-\d+\s+ # bound apps
94
+ app-name-\d+\s+ # bound apps
101
95
  /x
102
96
 
103
- expect(output).to match /service-instance-.+?\s+ # name
104
- user-provided\s+ # service
105
- none\s+ # provider
106
- none\s+ # version
107
- none\s+ # plan
108
- app-name-\d+\s+ # bound apps
97
+ expect(output).to match /service-instance-.+?\s+ # name
98
+ none\s+ # service
99
+ none\s+ # provider
100
+ none\s+ # version
101
+ none\s+ # plan
102
+ app-name-\d+\s+ # bound apps
109
103
  /x
110
- end
111
- end
112
-
113
- context 'when given --marketplace argument' do
114
- it 'lists services on the target' do
115
- client.stub(:services => Array.new(3) { build(:service) })
116
- cf %W[services --marketplace]
117
- expect(output).to say("Getting services... OK")
118
- expect(output).to say(/service\s+version\s+provider\s+plans\s+description/)
119
- end
120
104
  end
121
105
  end
122
106
 
123
- context "when the user is not targeted to a space" do
124
- before do
125
- service_command.stub(:check_logged_in).and_return(true)
126
- client.stub(:current_organization).and_return(true)
127
- end
128
- let(:service_command) { CF::Service::Services.new(nil, {}) }
129
- let(:current_space) { nil }
130
-
131
- subject do
132
- capture_output { service_command.execute(:services, inputs, global) }
133
-
134
- #capture_output { CF::CLI.new.invoke(:services, inputs, given, global) }
135
- end
136
-
137
- it "returns an error" do
138
- subject
139
- stdout.rewind
140
- output = stderr.read
141
107
 
142
- expect(output.to_s).to match "Please select a space with 'cf target --space SPACE_NAME'"
108
+ context 'when given --marketplace argument' do
109
+ it 'lists services on the target' do
110
+ client.stub(:services => Array.new(3) { build(:service) })
111
+ cf %W[services --marketplace]
112
+ expect(output).to say("Getting services... OK")
113
+ expect(output).to say(/service\s+version\s+provider\s+plans\s+description/)
143
114
  end
144
115
  end
145
116
  end
@@ -6,20 +6,6 @@ if ENV['CF_V2_RUN_INTEGRATION']
6
6
  login
7
7
  end
8
8
 
9
- describe "listing services" do
10
- it "shows all service instances in the space" do
11
- service1 = "some-provided-instance-#{Time.now.to_i}"
12
- service2 = "cf-managed-instance-#{Time.now.to_i}"
13
- create_service_instance("user-provided", service1, credentials: { hostname: "myservice.com"} )
14
- create_service_instance("dummy-dev", service2, plan: "small")
15
-
16
- BlueShell::Runner.run("#{cf_bin} services") do |runner|
17
- expect(runner).to say /#{service1}\s+none\s+none\s+none\s+none\s+.*/
18
- end
19
-
20
- end
21
- end
22
-
23
9
  describe "creating a service" do
24
10
  describe "when the user leaves the line blank for a plan" do
25
11
  it "re-prompts for the plan" do
@@ -34,76 +20,6 @@ if ENV['CF_V2_RUN_INTEGRATION']
34
20
  end
35
21
  end
36
22
  end
37
-
38
- describe "when the service is a user-provided instance" do
39
- let(:service_name) { "my-private-db-#{Random.rand(1000) + 1000}"}
40
-
41
- it "can create a service instance" do
42
- BlueShell::Runner.run("#{cf_bin} create-service") do |runner|
43
- expect(runner).to say "What kind?"
44
- runner.send_keys "user-provided"
45
-
46
- expect(runner).to say "Name?"
47
- runner.send_keys service_name
48
-
49
- expect(runner).to say "What credentials parameters should applications use to connect to this service instance? (e.g. key: uri, value: mysql://username:password@hostname:port/name)
50
- Key"
51
- runner.send_keys "hostname"
52
- expect(runner).to say "Value"
53
- runner.send_keys "myserviceinstance.com"
54
- expect(runner).to say "Another credentials parameter?"
55
- runner.send_keys "n"
56
-
57
- expect(runner).to say /Creating service #{service_name}.+ OK/
58
- end
59
- end
60
- end
61
- end
62
-
63
- describe "binding to a service" do
64
- let(:app_folder) { "env" }
65
- let(:app_name) { "services_env_test_app-#{Time.now.to_i}" }
66
-
67
- let(:service_name) { "some-provided-instance-#{Time.now.to_i}" }
68
-
69
- it "can bind and unbind user-provided services to apps" do
70
- push_app(app_folder, app_name, start_command: "'bundle exec ruby env_test.rb -p $PORT'", timeout: 90)
71
- create_service_instance("user-provided", service_name, credentials: { hostname: "myservice.com"} )
72
-
73
- BlueShell::Runner.run("#{cf_bin} bind-service") do |runner|
74
- expect(runner).to say "Which application?>"
75
- runner.send_keys app_name
76
-
77
- expect(runner).to say "Which service?>"
78
- runner.send_keys service_name
79
-
80
- expect(runner).to say "Binding #{service_name} to #{app_name}... OK"
81
- end
82
-
83
- BlueShell::Runner.run("#{cf_bin} unbind-service") do |runner|
84
- expect(runner).to say "Which application?"
85
- runner.send_keys app_name
86
-
87
- expect(runner).to say "Which service?>"
88
- runner.send_keys service_name
89
-
90
- expect(runner).to say "Unbinding #{service_name} from #{app_name}... OK"
91
- end
92
- end
93
-
94
- after do
95
- delete_app(app_name)
96
- end
97
-
98
- def delete_app(app_name, routes=true)
99
- delete_cmd = "#{cf_bin} delete #{app_name}"
100
- delete_cmd + " --routes" if routes
101
- BlueShell::Runner.run(delete_cmd) do |runner|
102
- expect(runner).to say "Really delete #{app_name}?"
103
- runner.send_keys "y"
104
- expect(runner).to say "Deleting #{app_name}... OK"
105
- end
106
- end
107
23
  end
108
24
  end
109
25
  end
@@ -28,45 +28,9 @@ module FeaturesHelper
28
28
  end
29
29
  end
30
30
 
31
- def create_service_instance(service_name, instance_name, opts = {})
32
- plan_name = opts[:plan]
33
- credentials = opts[:credentials]
34
-
35
- BlueShell::Runner.run("#{cf_bin} create-service") do |runner|
36
- expect(runner).to say "What kind?>"
37
- runner.send_keys service_name
38
-
39
- expect(runner).to say "Name?>"
40
- runner.send_keys instance_name
41
-
42
- if service_name == "user-provided"
43
- credentials.keys.each_with_index do |k, i|
44
- expect(runner).to say "Key"
45
- runner.send_keys k
46
- expect(runner).to say "Value"
47
- runner.send_keys credentials[k]
48
- expect(runner).to say "Another credentials parameter?"
49
- if i < credentials.size - 1
50
- runner.send_keys "y"
51
- else
52
- runner.send_keys "n"
53
- end
54
- end
55
- else
56
- expect(runner).to say "Which plan?"
57
- runner.send_keys plan_name
58
- end
59
-
60
- expect(runner).to say "Creating service #{instance_name}... OK"
61
- end
62
- end
63
-
64
- def push_app(app_folder, deployed_app_name, opts = {})
65
- push_cmd = "#{cf_bin} push --no-manifest"
66
- push_cmd += " --command #{opts[:start_command]}" if opts[:start_command]
67
-
31
+ def push_app(app_folder, deployed_app_name)
68
32
  Dir.chdir("#{SPEC_ROOT}/assets/#{app_folder}") do
69
- BlueShell::Runner.run(push_cmd) do |runner|
33
+ BlueShell::Runner.run("#{cf_bin} push --no-manifest") do |runner|
70
34
  expect(runner).to say "Name>"
71
35
  runner.send_keys deployed_app_name
72
36
 
@@ -95,9 +59,7 @@ module FeaturesHelper
95
59
  runner.send_return
96
60
  end
97
61
 
98
- expect(runner).to say "Push successful!"
99
-
100
- runner.wait_for_exit opts[:timeout] || 30
62
+ runner.wait_for_exit
101
63
  end
102
64
  end
103
65
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.8.rc2
4
+ version: 4.2.8
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Cloud Foundry Team
@@ -14,6 +15,7 @@ dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: addressable
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ~>
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ~>
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: caldecott-client
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ~>
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ~>
40
45
  - !ruby/object:Gem::Version
@@ -42,20 +47,23 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: cfoundry
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ~>
47
53
  - !ruby/object:Gem::Version
48
- version: 4.0.2.rc5
54
+ version: 4.0.3
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
60
  - - ~>
54
61
  - !ruby/object:Gem::Version
55
- version: 4.0.2.rc5
62
+ version: 4.0.3
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: interact
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
68
  - - ~>
61
69
  - !ruby/object:Gem::Version
@@ -63,6 +71,7 @@ dependencies:
63
71
  type: :runtime
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
76
  - - ~>
68
77
  - !ruby/object:Gem::Version
@@ -70,6 +79,7 @@ dependencies:
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: json_pure
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
84
  - - ~>
75
85
  - !ruby/object:Gem::Version
@@ -77,6 +87,7 @@ dependencies:
77
87
  type: :runtime
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
92
  - - ~>
82
93
  - !ruby/object:Gem::Version
@@ -84,6 +95,7 @@ dependencies:
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: mothership
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
100
  - - ! '>='
89
101
  - !ruby/object:Gem::Version
@@ -94,6 +106,7 @@ dependencies:
94
106
  type: :runtime
95
107
  prerelease: false
96
108
  version_requirements: !ruby/object:Gem::Requirement
109
+ none: false
97
110
  requirements:
98
111
  - - ! '>='
99
112
  - !ruby/object:Gem::Version
@@ -104,6 +117,7 @@ dependencies:
104
117
  - !ruby/object:Gem::Dependency
105
118
  name: multi_json
106
119
  requirement: !ruby/object:Gem::Requirement
120
+ none: false
107
121
  requirements:
108
122
  - - ~>
109
123
  - !ruby/object:Gem::Version
@@ -111,6 +125,7 @@ dependencies:
111
125
  type: :runtime
112
126
  prerelease: false
113
127
  version_requirements: !ruby/object:Gem::Requirement
128
+ none: false
114
129
  requirements:
115
130
  - - ~>
116
131
  - !ruby/object:Gem::Version
@@ -118,6 +133,7 @@ dependencies:
118
133
  - !ruby/object:Gem::Dependency
119
134
  name: rest-client
120
135
  requirement: !ruby/object:Gem::Requirement
136
+ none: false
121
137
  requirements:
122
138
  - - ~>
123
139
  - !ruby/object:Gem::Version
@@ -125,6 +141,7 @@ dependencies:
125
141
  type: :runtime
126
142
  prerelease: false
127
143
  version_requirements: !ruby/object:Gem::Requirement
144
+ none: false
128
145
  requirements:
129
146
  - - ~>
130
147
  - !ruby/object:Gem::Version
@@ -132,6 +149,7 @@ dependencies:
132
149
  - !ruby/object:Gem::Dependency
133
150
  name: uuidtools
134
151
  requirement: !ruby/object:Gem::Requirement
152
+ none: false
135
153
  requirements:
136
154
  - - ~>
137
155
  - !ruby/object:Gem::Version
@@ -139,6 +157,7 @@ dependencies:
139
157
  type: :runtime
140
158
  prerelease: false
141
159
  version_requirements: !ruby/object:Gem::Requirement
160
+ none: false
142
161
  requirements:
143
162
  - - ~>
144
163
  - !ruby/object:Gem::Version
@@ -146,6 +165,7 @@ dependencies:
146
165
  - !ruby/object:Gem::Dependency
147
166
  name: anchorman
148
167
  requirement: !ruby/object:Gem::Requirement
168
+ none: false
149
169
  requirements:
150
170
  - - ! '>='
151
171
  - !ruby/object:Gem::Version
@@ -153,6 +173,7 @@ dependencies:
153
173
  type: :development
154
174
  prerelease: false
155
175
  version_requirements: !ruby/object:Gem::Requirement
176
+ none: false
156
177
  requirements:
157
178
  - - ! '>='
158
179
  - !ruby/object:Gem::Version
@@ -160,6 +181,7 @@ dependencies:
160
181
  - !ruby/object:Gem::Dependency
161
182
  name: blue-shell
162
183
  requirement: !ruby/object:Gem::Requirement
184
+ none: false
163
185
  requirements:
164
186
  - - ! '>='
165
187
  - !ruby/object:Gem::Version
@@ -167,6 +189,7 @@ dependencies:
167
189
  type: :development
168
190
  prerelease: false
169
191
  version_requirements: !ruby/object:Gem::Requirement
192
+ none: false
170
193
  requirements:
171
194
  - - ! '>='
172
195
  - !ruby/object:Gem::Version
@@ -174,6 +197,7 @@ dependencies:
174
197
  - !ruby/object:Gem::Dependency
175
198
  name: factory_girl
176
199
  requirement: !ruby/object:Gem::Requirement
200
+ none: false
177
201
  requirements:
178
202
  - - ! '>='
179
203
  - !ruby/object:Gem::Version
@@ -181,6 +205,7 @@ dependencies:
181
205
  type: :development
182
206
  prerelease: false
183
207
  version_requirements: !ruby/object:Gem::Requirement
208
+ none: false
184
209
  requirements:
185
210
  - - ! '>='
186
211
  - !ruby/object:Gem::Version
@@ -188,6 +213,7 @@ dependencies:
188
213
  - !ruby/object:Gem::Dependency
189
214
  name: fakefs
190
215
  requirement: !ruby/object:Gem::Requirement
216
+ none: false
191
217
  requirements:
192
218
  - - ~>
193
219
  - !ruby/object:Gem::Version
@@ -195,6 +221,7 @@ dependencies:
195
221
  type: :development
196
222
  prerelease: false
197
223
  version_requirements: !ruby/object:Gem::Requirement
224
+ none: false
198
225
  requirements:
199
226
  - - ~>
200
227
  - !ruby/object:Gem::Version
@@ -202,6 +229,7 @@ dependencies:
202
229
  - !ruby/object:Gem::Dependency
203
230
  name: ffaker
204
231
  requirement: !ruby/object:Gem::Requirement
232
+ none: false
205
233
  requirements:
206
234
  - - '='
207
235
  - !ruby/object:Gem::Version
@@ -209,6 +237,7 @@ dependencies:
209
237
  type: :development
210
238
  prerelease: false
211
239
  version_requirements: !ruby/object:Gem::Requirement
240
+ none: false
212
241
  requirements:
213
242
  - - '='
214
243
  - !ruby/object:Gem::Version
@@ -216,6 +245,7 @@ dependencies:
216
245
  - !ruby/object:Gem::Dependency
217
246
  name: gem-release
218
247
  requirement: !ruby/object:Gem::Requirement
248
+ none: false
219
249
  requirements:
220
250
  - - ! '>='
221
251
  - !ruby/object:Gem::Version
@@ -223,6 +253,7 @@ dependencies:
223
253
  type: :development
224
254
  prerelease: false
225
255
  version_requirements: !ruby/object:Gem::Requirement
256
+ none: false
226
257
  requirements:
227
258
  - - ! '>='
228
259
  - !ruby/object:Gem::Version
@@ -230,6 +261,7 @@ dependencies:
230
261
  - !ruby/object:Gem::Dependency
231
262
  name: rake
232
263
  requirement: !ruby/object:Gem::Requirement
264
+ none: false
233
265
  requirements:
234
266
  - - ~>
235
267
  - !ruby/object:Gem::Version
@@ -237,6 +269,7 @@ dependencies:
237
269
  type: :development
238
270
  prerelease: false
239
271
  version_requirements: !ruby/object:Gem::Requirement
272
+ none: false
240
273
  requirements:
241
274
  - - ~>
242
275
  - !ruby/object:Gem::Version
@@ -244,6 +277,7 @@ dependencies:
244
277
  - !ruby/object:Gem::Dependency
245
278
  name: rspec
246
279
  requirement: !ruby/object:Gem::Requirement
280
+ none: false
247
281
  requirements:
248
282
  - - ~>
249
283
  - !ruby/object:Gem::Version
@@ -251,6 +285,7 @@ dependencies:
251
285
  type: :development
252
286
  prerelease: false
253
287
  version_requirements: !ruby/object:Gem::Requirement
288
+ none: false
254
289
  requirements:
255
290
  - - ~>
256
291
  - !ruby/object:Gem::Version
@@ -258,6 +293,7 @@ dependencies:
258
293
  - !ruby/object:Gem::Dependency
259
294
  name: rspec-instafail
260
295
  requirement: !ruby/object:Gem::Requirement
296
+ none: false
261
297
  requirements:
262
298
  - - ~>
263
299
  - !ruby/object:Gem::Version
@@ -265,6 +301,7 @@ dependencies:
265
301
  type: :development
266
302
  prerelease: false
267
303
  version_requirements: !ruby/object:Gem::Requirement
304
+ none: false
268
305
  requirements:
269
306
  - - ~>
270
307
  - !ruby/object:Gem::Version
@@ -272,6 +309,7 @@ dependencies:
272
309
  - !ruby/object:Gem::Dependency
273
310
  name: webmock
274
311
  requirement: !ruby/object:Gem::Requirement
312
+ none: false
275
313
  requirements:
276
314
  - - ~>
277
315
  - !ruby/object:Gem::Version
@@ -279,6 +317,7 @@ dependencies:
279
317
  type: :development
280
318
  prerelease: false
281
319
  version_requirements: !ruby/object:Gem::Requirement
320
+ none: false
282
321
  requirements:
283
322
  - - ~>
284
323
  - !ruby/object:Gem::Version
@@ -411,9 +450,6 @@ files:
411
450
  - spec/admin/curl_spec.rb
412
451
  - spec/admin/guid_spec.rb
413
452
  - spec/admin/set_quota_spec.rb
414
- - spec/assets/env/env_test.rb
415
- - spec/assets/env/Gemfile
416
- - spec/assets/env/Gemfile.lock
417
453
  - spec/assets/hello-sinatra/config.ru
418
454
  - spec/assets/hello-sinatra/fat-cat-makes-app-larger.png
419
455
  - spec/assets/hello-sinatra/Gemfile
@@ -566,34 +602,38 @@ files:
566
602
  homepage: http://github.com/cloudfoundry/cf
567
603
  licenses:
568
604
  - Apache 2.0
569
- metadata: {}
570
605
  post_install_message:
571
606
  rdoc_options: []
572
607
  require_paths:
573
608
  - lib
574
609
  required_ruby_version: !ruby/object:Gem::Requirement
610
+ none: false
575
611
  requirements:
576
612
  - - ! '>='
577
613
  - !ruby/object:Gem::Version
578
614
  version: '0'
615
+ segments:
616
+ - 0
617
+ hash: 1212679267713831030
579
618
  required_rubygems_version: !ruby/object:Gem::Requirement
619
+ none: false
580
620
  requirements:
581
- - - ! '>'
621
+ - - ! '>='
582
622
  - !ruby/object:Gem::Version
583
- version: 1.3.1
623
+ version: '0'
624
+ segments:
625
+ - 0
626
+ hash: 1212679267713831030
584
627
  requirements: []
585
628
  rubyforge_project: cf
586
- rubygems_version: 2.0.5
629
+ rubygems_version: 1.8.25
587
630
  signing_key:
588
- specification_version: 4
631
+ specification_version: 3
589
632
  summary: Friendly command-line interface for Cloud Foundry.
590
633
  test_files:
591
634
  - spec/admin/curl_spec.rb
592
635
  - spec/admin/guid_spec.rb
593
636
  - spec/admin/set_quota_spec.rb
594
- - spec/assets/env/env_test.rb
595
- - spec/assets/env/Gemfile
596
- - spec/assets/env/Gemfile.lock
597
637
  - spec/assets/hello-sinatra/config.ru
598
638
  - spec/assets/hello-sinatra/fat-cat-makes-app-larger.png
599
639
  - spec/assets/hello-sinatra/Gemfile
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZGFmMTYzNDMzMzMwYTdiODgyNDI3OGNmOThjZjliMmI1MjdiZGU2OQ==
5
- data.tar.gz: !binary |-
6
- NGU3YjQ1NTQxMDc3MzMzMzE3NzljODdiZTQ0MTgzZDg4NmM2YTE3Yw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZmFmNWIzZGU1MmRmNmNjZTFiODVmYjViNjg5YjVmM2EyNGQwNjc3MTFmNjg5
10
- MTU0YjFiOTEzZTlkNDU1MmE3YTk4Njg5ZWNlYzU0YjNmZjM1MDAxY2U5YzYx
11
- NzI4ZjQzNzYyNWRhYmJkYzJiYmMzYjU0NzdjODZkNGE2YmEyMGY=
12
- data.tar.gz: !binary |-
13
- OTQzYmExMGQ0MjY0Zjk3ZGY5ZmU2NmUyYzhhMzU2ZjAyNTQzMjE0NDlmMjFk
14
- MjAyZTA0YjkzYTQ2YzEzMTMwZjg2MzcyOTY2NDkzZTlhNWFhZTc0MzM1YWJj
15
- Mzc3YzdhOTU2MWQ1MzYwZDlmNWNlMmZiZWVjMWJiNjBiMjlmYTA=
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
- gem 'bundler'
3
- gem 'sinatra'
4
- gem 'json'
@@ -1,17 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- json (1.5.1)
5
- rack (1.2.2)
6
- sinatra (1.2.1)
7
- rack (~> 1.1)
8
- tilt (>= 1.2.2, < 2.0)
9
- tilt (1.2.2)
10
-
11
- PLATFORMS
12
- ruby
13
-
14
- DEPENDENCIES
15
- bundler
16
- json
17
- sinatra
@@ -1,58 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'sinatra'
4
- require 'json'
5
-
6
- $stdout.sync = true
7
-
8
- def dump_env(fmt)
9
- if fmt == 'html' || fmt == nil
10
- res = ''
11
- ENV.each do |k, v|
12
- res << "#{k}: #{v}<br/>"
13
- end
14
- res
15
- elsif fmt == 'json'
16
- res = {}
17
- ENV.each do |k, v|
18
- res[k] = v
19
- end
20
- puts res
21
- res.to_json
22
- end
23
- end
24
-
25
- get '/' do
26
- dump_env('html')
27
- end
28
-
29
- get '/healthcheck' do
30
- "OK"
31
- end
32
-
33
- get '/env' do
34
- dump_env('json')
35
- end
36
-
37
-
38
- get '/services' do
39
- app_instance = JSON.parse(ENV['VCAP_APPLICATION'])
40
- services = JSON.parse(ENV['VCAP_SERVICES'])
41
-
42
- valid_services = false
43
- service_list = []
44
- services.each do |k, v|
45
- v.each do |i|
46
- s = {}
47
- s['vendor'] = k.split('-')[0]
48
- s['name'] = i['name']
49
- service_list << s
50
- valid_services = true
51
- end
52
- end
53
- response = "{\"status\":\"ok\", \"services\": #{service_list.to_json}}" if valid_services
54
- response = "{\"status\":\"fail\", \"services\": []}" if !valid_services
55
-
56
- puts "my response: #{response}"
57
- response
58
- end