cfoundry_helper 0.2.1 → 0.2.2
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.
- checksums.yaml +15 -0
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/cfoundry_helper.rb +45 -0
- data/lib/cfoundry_helper/helpers/client_helper.rb +7 -43
- data/lib/cfoundry_helper/version.rb +2 -2
- metadata +5 -34
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmNmZDdhZDg0NmU3YTYzZDA3YWRhOGFhMmUzMTk4ODk5OGJkZjlmYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NWQ4OWNkM2JmNmNhMjM1MDE0OWIwZmRmMGQxZGI3MmMyZmJjMGQzNQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDY5MzQ4Nzc1YTA2MmQ4MjJlM2M4Nzk5Y2MwN2NiNTQ1ZDI2Nzc4YTYwZjQw
|
10
|
+
OWEwZDFmNTE5ODJiNjU1MzdiMDIzZWZjYTgxMTRiZTNmMWI5ZmJjNzMxOGU2
|
11
|
+
ZmQ5YTVmYzMzZGI4NzY3M2I5ZGYwNzA3MTY4M2JlM2JlZWMyZmY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWE4ZDc0Yzc3YmIxMTYyN2I3YmNmZTYwZmVkMDFjZDRjYWExMzJmYmUxNjY0
|
14
|
+
ODI2MjJkNTJiODYyZjUwMWZlNWJmYTU5MmUyZTEzNjg0MTgwMDY2ZThlMTJl
|
15
|
+
NTVlZTc0NGY2MGJmZjY0NTE2MmVjNTFlNzZjZWVkYTY0MDE4ZjA=
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cfoundry_helper (0.2.
|
4
|
+
cfoundry_helper (0.2.2)
|
5
5
|
activesupport
|
6
6
|
cfoundry
|
7
7
|
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
builder (3.1.4)
|
22
22
|
cf-uaa-lib (2.0.0)
|
23
23
|
multi_json
|
24
|
-
cfoundry (4.3.
|
24
|
+
cfoundry (4.3.8)
|
25
25
|
activemodel (>= 3.2.13, < 5.0.0)
|
26
26
|
cf-uaa-lib (~> 2.0.0)
|
27
27
|
multi_json (~> 1.7)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/cfoundry_helper.rb
CHANGED
@@ -7,6 +7,9 @@ Bundler.require
|
|
7
7
|
module CFoundryHelper
|
8
8
|
autoload :Helpers, File.expand_path('../cfoundry_helper/helpers', __FILE__)
|
9
9
|
autoload :Models, File.expand_path('../cfoundry_helper/models', __FILE__)
|
10
|
+
|
11
|
+
@@config = nil
|
12
|
+
@@config_file_path = nil
|
10
13
|
|
11
14
|
def self.env
|
12
15
|
unless ENV['RAILS_ENV']
|
@@ -15,4 +18,46 @@ module CFoundryHelper
|
|
15
18
|
ENV['RAILS_ENV'].to_sym
|
16
19
|
end
|
17
20
|
end
|
21
|
+
|
22
|
+
def self.config
|
23
|
+
self.read_config_file
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.set_config_file_path(path)
|
27
|
+
@@config_file_path = path
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.config_file_path
|
31
|
+
return @@config_file_path
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# reads the uaa and cc configuration from a config file
|
38
|
+
def self.read_config_file
|
39
|
+
# try to set the config file path from the env if not set already
|
40
|
+
self.set_config_file_path_from_env if @@config_file_path.nil?
|
41
|
+
|
42
|
+
if @@config.nil?
|
43
|
+
self.check_config_file_path
|
44
|
+
@@config = YAML.load_file(@@config_file_path)[CFoundryHelper.env.to_s]
|
45
|
+
end
|
46
|
+
@@config
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.check_config_file_path
|
50
|
+
raise "No configuration file path has been set! Please call ClientHelper.set_config_file_path first or set a valid CFOUNDRY_HELPER_CONFIG env variable!" if @@config_file_path.nil?
|
51
|
+
raise "There's no configuration file on #{@@config_file_path}!" if !File.exists? @@config_file_path
|
52
|
+
end
|
53
|
+
|
54
|
+
# sets the configuration file path from reading the CFOUNDRY_HELPER_CONFIG env variable
|
55
|
+
def self.set_config_file_path_from_env
|
56
|
+
config_file_path = ENV["CFOUNDRY_HELPER_CONFIG"]
|
57
|
+
unless config_file_path.nil?
|
58
|
+
self.set_config_file_path config_file_path
|
59
|
+
end
|
60
|
+
end
|
18
61
|
end
|
62
|
+
|
63
|
+
CFoundryHelper.config
|
@@ -2,19 +2,10 @@ require 'yaml'
|
|
2
2
|
|
3
3
|
module CFoundryHelper::Helpers
|
4
4
|
module ClientHelper
|
5
|
-
@@config = nil
|
6
5
|
@@scim_client = nil
|
7
6
|
@@cloud_controller_client = nil
|
8
|
-
@@config_file_path = nil
|
9
7
|
@@auth_token = nil
|
10
8
|
|
11
|
-
def self.set_config_file_path(path)
|
12
|
-
@@config_file_path = path
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.config_file_path
|
16
|
-
return @@config_file_path
|
17
|
-
end
|
18
9
|
|
19
10
|
def self.get_cc_target_url
|
20
11
|
return self.cloud_controller_client.target
|
@@ -36,15 +27,14 @@ module CFoundryHelper::Helpers
|
|
36
27
|
# just return the already initialized client if present
|
37
28
|
return @@scim_client unless @@scim_client.nil?
|
38
29
|
|
39
|
-
self.read_config_file
|
40
30
|
token_issuer = CF::UAA::TokenIssuer.new(
|
41
|
-
|
42
|
-
|
43
|
-
|
31
|
+
CFoundryHelper.config['uaa']['site'],
|
32
|
+
CFoundryHelper.config['uaa']['client_id'],
|
33
|
+
CFoundryHelper.config['uaa']['client_secret'])
|
44
34
|
|
45
35
|
token_info = token_issuer.client_credentials_grant
|
46
36
|
access_token = token_info.info["access_token"]
|
47
|
-
@@scim_client = CF::UAA::Scim.new(
|
37
|
+
@@scim_client = CF::UAA::Scim.new(CFoundryHelper.config['uaa']['site'], "bEareR #{access_token}")
|
48
38
|
end
|
49
39
|
|
50
40
|
##
|
@@ -57,13 +47,12 @@ module CFoundryHelper::Helpers
|
|
57
47
|
# TODO: Refresh the token with the uaa refresh method.
|
58
48
|
return @@cloud_controller_client if @@cloud_controller_client
|
59
49
|
|
60
|
-
|
61
|
-
|
62
|
-
token_info = token_issuer.implicit_grant_with_creds(@@config['cloud_controller'])
|
50
|
+
token_issuer = CF::UAA::TokenIssuer.new(CFoundryHelper.config['uaa']['site'], "cf")
|
51
|
+
token_info = token_issuer.implicit_grant_with_creds(CFoundryHelper.config['cloud_controller'])
|
63
52
|
access_token = token_info.info["access_token"]
|
64
53
|
token = CFoundry::AuthToken.from_hash({:token => "bearer #{access_token}"})
|
65
54
|
@@auth_token = token
|
66
|
-
CFoundry::V2::Client.new(
|
55
|
+
CFoundry::V2::Client.new(CFoundryHelper.config['cloud_controller']['site'], token)
|
67
56
|
end
|
68
57
|
|
69
58
|
|
@@ -75,32 +64,7 @@ module CFoundryHelper::Helpers
|
|
75
64
|
@@cloud_controller_client = client
|
76
65
|
end
|
77
66
|
|
78
|
-
protected
|
79
67
|
|
80
|
-
# reads the uaa and cc configuration from a config file
|
81
|
-
def self.read_config_file
|
82
|
-
# try to set the config file path from the env if not set already
|
83
|
-
self.set_config_file_path_from_env if @@config_file_path.nil?
|
84
|
-
|
85
|
-
if @@config.nil?
|
86
|
-
self.check_config_file_path
|
87
|
-
@@config = YAML.load_file(@@config_file_path)[CFoundryHelper.env.to_s]
|
88
|
-
end
|
89
|
-
@@config
|
90
|
-
end
|
91
|
-
|
92
|
-
def self.check_config_file_path
|
93
|
-
raise "No configuration file path has been set! Please call ClientHelper.set_config_file_path first or set a valid CFOUNDRY_HELPER_CONFIG env variable!" if @@config_file_path.nil?
|
94
|
-
raise "There's no configuration file on #{@@config_file_path}!" if !File.exists? @@config_file_path
|
95
|
-
end
|
96
|
-
|
97
|
-
# sets the configuration file path from reading the CFOUNDRY_HELPER_CONFIG env variable
|
98
|
-
def self.set_config_file_path_from_env
|
99
|
-
config_file_path = ENV["CFOUNDRY_HELPER_CONFIG"]
|
100
|
-
unless config_file_path.nil?
|
101
|
-
self.set_config_file_path config_file_path
|
102
|
-
end
|
103
|
-
end
|
104
68
|
|
105
69
|
end
|
106
70
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module CFoundryHelper
|
2
|
-
VERSION = "0.2.
|
3
|
-
end
|
2
|
+
VERSION = "0.2.2"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Julian Weber
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-09
|
11
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: nats
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: cf-uaa-lib
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: activesupport
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ! '>='
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ! '>='
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: httpclient
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ! '>='
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ! '>='
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: yajl-ruby
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ! '>='
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,7 +118,6 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ! '>='
|
140
123
|
- !ruby/object:Gem::Version
|
@@ -142,7 +125,6 @@ dependencies:
|
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: pry
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
129
|
- - ! '>='
|
148
130
|
- !ruby/object:Gem::Version
|
@@ -150,7 +132,6 @@ dependencies:
|
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
136
|
- - ! '>='
|
156
137
|
- !ruby/object:Gem::Version
|
@@ -158,7 +139,6 @@ dependencies:
|
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: pry-debugger
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
143
|
- - ! '>='
|
164
144
|
- !ruby/object:Gem::Version
|
@@ -166,7 +146,6 @@ dependencies:
|
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
150
|
- - ! '>='
|
172
151
|
- !ruby/object:Gem::Version
|
@@ -174,7 +153,6 @@ dependencies:
|
|
174
153
|
- !ruby/object:Gem::Dependency
|
175
154
|
name: cfoundry
|
176
155
|
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
156
|
requirements:
|
179
157
|
- - ! '>='
|
180
158
|
- !ruby/object:Gem::Version
|
@@ -182,7 +160,6 @@ dependencies:
|
|
182
160
|
type: :runtime
|
183
161
|
prerelease: false
|
184
162
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
163
|
requirements:
|
187
164
|
- - ! '>='
|
188
165
|
- !ruby/object:Gem::Version
|
@@ -190,7 +167,6 @@ dependencies:
|
|
190
167
|
- !ruby/object:Gem::Dependency
|
191
168
|
name: activesupport
|
192
169
|
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
170
|
requirements:
|
195
171
|
- - ! '>='
|
196
172
|
- !ruby/object:Gem::Version
|
@@ -198,7 +174,6 @@ dependencies:
|
|
198
174
|
type: :runtime
|
199
175
|
prerelease: false
|
200
176
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
177
|
requirements:
|
203
178
|
- - ! '>='
|
204
179
|
- !ruby/object:Gem::Version
|
@@ -242,30 +217,26 @@ files:
|
|
242
217
|
homepage: http://www.anynines.com
|
243
218
|
licenses:
|
244
219
|
- MIT
|
220
|
+
metadata: {}
|
245
221
|
post_install_message:
|
246
222
|
rdoc_options: []
|
247
223
|
require_paths:
|
248
224
|
- lib
|
249
225
|
required_ruby_version: !ruby/object:Gem::Requirement
|
250
|
-
none: false
|
251
226
|
requirements:
|
252
227
|
- - ! '>='
|
253
228
|
- !ruby/object:Gem::Version
|
254
229
|
version: 1.9.3
|
255
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
256
|
-
none: false
|
257
231
|
requirements:
|
258
232
|
- - ! '>='
|
259
233
|
- !ruby/object:Gem::Version
|
260
234
|
version: '0'
|
261
|
-
segments:
|
262
|
-
- 0
|
263
|
-
hash: 3457547663060522280
|
264
235
|
requirements: []
|
265
236
|
rubyforge_project:
|
266
|
-
rubygems_version:
|
237
|
+
rubygems_version: 2.0.7
|
267
238
|
signing_key:
|
268
|
-
specification_version:
|
239
|
+
specification_version: 4
|
269
240
|
summary: This gem provides additional helper classes and scripts for the cfoundry
|
270
241
|
gem.
|
271
242
|
test_files:
|