exvo_helpers 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/README.md +10 -0
- data/lib/exvo_helpers/helpers.rb +49 -4
- data/lib/exvo_helpers/version.rb +1 -1
- data/spec/exvo_helpers/helpers_spec.rb +12 -4
- metadata +41 -42
- /data/{MIT-LICENSE → LICENSE} +0 -0
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,10 @@ Exvo::Helpers.auth_client_secret => nil
|
|
19
19
|
Exvo::Helpers.sso_cookie_domain => 'exvo.local'
|
20
20
|
Exvo::Helpers.sso_cookie_secret => 'some secret cookie signing key'
|
21
21
|
|
22
|
+
Exvo::Helpers.budget_require_ssl => false
|
23
|
+
|
22
24
|
Exvo::Helpers.auth_host => 'auth.exvo.local'
|
25
|
+
Exvo::Helpers.budget_host => 'budget.exvo.local'
|
23
26
|
Exvo::Helpers.cdn_host => 'home.exvo.local'
|
24
27
|
Exvo::Helpers.cfs_host => 'cfs.exvo.local'
|
25
28
|
Exvo::Helpers.desktop_host => 'home.exvo.local'
|
@@ -33,6 +36,7 @@ Exvo::Helpers.preview_host => 'preview.exvo.local'
|
|
33
36
|
Exvo::Helpers.store_host => 'store.exvo.local'
|
34
37
|
|
35
38
|
Exvo::Helpers.auth_uri => 'http://auth.exvo.local'
|
39
|
+
Exvo::Helpers.budget_uri => 'http://budget.exvo.local'
|
36
40
|
Exvo::Helpers.cdn_uri => 'http://home.exvo.local'
|
37
41
|
Exvo::Helpers.cfs_uri => 'http://cfs.exvo.local'
|
38
42
|
Exvo::Helpers.desktop_uri => 'http://home.exvo.local'
|
@@ -61,7 +65,10 @@ ENV['AUTH_CLIENT_SECRET'] = 'abc'
|
|
61
65
|
ENV['SSO_COOKIE_DOMAIN'] = 'exvo.dev'
|
62
66
|
ENV['SSO_COOKIE_SECRET'] = 'exvo.dev'
|
63
67
|
|
68
|
+
ENV['BUDGET_REQUIRE_SSL'] = 'true'
|
69
|
+
|
64
70
|
ENV['AUTH_HOST'] = 'test.auth.exvo.com'
|
71
|
+
ENV['BUDGET_HOST'] = 'test.budget.exvo.com'
|
65
72
|
ENV['CDN_HOST'] = 'test.cdn.exvo.com'
|
66
73
|
ENV['CFS_HOST'] = 'test.cfs.exvo.com'
|
67
74
|
ENV['DESKTOP_HOST'] = 'test.exvo.com'
|
@@ -87,7 +94,10 @@ Exvo::Helpers.auth_client_secret = 'abc'
|
|
87
94
|
Exvo::Helpers.sso_cookie_domain = 'exvo.dev'
|
88
95
|
Exvo::Helpers.sso_cookie_key = 'some secret key'
|
89
96
|
|
97
|
+
Exvo::Helpers.budget_require_ssl = true
|
98
|
+
|
90
99
|
Exvo::Helpers.auth_host = 'test.auth.exvo.com'
|
100
|
+
Exvo::Helpers.budget_host = 'test.budget.exvo.com'
|
91
101
|
Exvo::Helpers.cdn_host = 'test.cdn.exvo.com'
|
92
102
|
Exvo::Helpers.cfs_host = 'test.cfs.exvo.com'
|
93
103
|
Exvo::Helpers.desktop_host = 'test.exvo.com'
|
data/lib/exvo_helpers/helpers.rb
CHANGED
@@ -5,11 +5,11 @@ module Exvo
|
|
5
5
|
# Dynamically define class methods
|
6
6
|
class << self
|
7
7
|
|
8
|
-
%w(auth cdn cfs desktop themes blog contacts inbox music pics preview store).each do |service|
|
8
|
+
%w(auth budget cdn cfs desktop themes blog contacts inbox music pics preview store).each do |service|
|
9
9
|
|
10
10
|
# def self.cdn_uri
|
11
11
|
# protocol = 'http://'
|
12
|
-
# protocol = 'https://' if service == "auth" && auth_require_ssl
|
12
|
+
# protocol = 'https://' if (service == "auth" && auth_require_ssl) || (service == "budget" && budget_require_ssl)
|
13
13
|
# protocol = '//' if ["cdn", "cfs", "themes"].include?(service) && env.to_sym == :production
|
14
14
|
# suffix = '/blog' if service == "blog"
|
15
15
|
# protocol + cdn_host + suffix.to_s
|
@@ -17,8 +17,8 @@ module Exvo
|
|
17
17
|
define_method "#{service}_uri" do
|
18
18
|
protocol = 'http://'
|
19
19
|
|
20
|
-
# explicit https for auth
|
21
|
-
protocol = 'https://' if service == "auth" && send(:auth_require_ssl)
|
20
|
+
# explicit https for auth & budget
|
21
|
+
protocol = 'https://' if (service == "auth" && send(:auth_require_ssl)) || (service == "budget" && send(:budget_require_ssl))
|
22
22
|
|
23
23
|
# special link starting with '//' in production so that the webserver can choose between HTTP and HTTPS
|
24
24
|
# but only for those apps/services that have proper SSL support (i.e. valid certificates)
|
@@ -169,6 +169,43 @@ module Exvo
|
|
169
169
|
end
|
170
170
|
|
171
171
|
|
172
|
+
# BUDGET
|
173
|
+
|
174
|
+
# Dynamically define class methods
|
175
|
+
class << self
|
176
|
+
|
177
|
+
%w(require_ssl).each do |option|
|
178
|
+
|
179
|
+
# def self.budget_require_ssl
|
180
|
+
# return @@budget_require_ssl if defined?(@@budget_require_ssl) && !@@budget_require_ssl.nil?
|
181
|
+
# value = true if ENV["BUDGET_REQUIRE_SSL"] =~ /true/i
|
182
|
+
# value = false if ENV["BUDGET_REQUIRE_SSL"] =~ /false/i
|
183
|
+
# value = default_opts[env.to_sym]["budget_require_ssl".to_sym] if value.nil?
|
184
|
+
# @@budget_require_ssl = value
|
185
|
+
# end
|
186
|
+
define_method "budget_#{option}" do
|
187
|
+
if class_variable_defined?("@@budget_#{option}") and !class_variable_get("@@budget_#{option}").nil?
|
188
|
+
class_variable_get("@@budget_#{option}")
|
189
|
+
else
|
190
|
+
value = true if ENV["BUDGET_#{option.upcase}"] =~ /true/i
|
191
|
+
value = false if ENV["BUDGET_#{option.upcase}"] =~ /false/i
|
192
|
+
value = default_opts[env.to_sym]["budget_#{option}".to_sym] if value.nil?
|
193
|
+
class_variable_set("@@budget_#{option}", value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# def self.budget_require_ssl=(debug)
|
198
|
+
# @@budget_require_ssl = debug
|
199
|
+
# end
|
200
|
+
define_method "budget_#{option}=" do |value|
|
201
|
+
class_variable_set("@@budget_#{option}", value)
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
|
172
209
|
# ENV
|
173
210
|
|
174
211
|
# by default fall back to production; this way the omniauth-exvo's gem specs can pass
|
@@ -194,6 +231,8 @@ module Exvo
|
|
194
231
|
:auth_host => 'auth.exvo.com',
|
195
232
|
:auth_require_ssl => true,
|
196
233
|
:sso_cookie_domain => 'exvo.com',
|
234
|
+
:budget_host => 'budget.exvo.com',
|
235
|
+
:budget_require_ssl => true,
|
197
236
|
:cdn_host => 'd33gjlr95u9pgf.cloudfront.net', # cloudfront.net so we can use https (cdn.exvo.com via https does not work properly)
|
198
237
|
:cfs_host => 'cfs.exvo.com',
|
199
238
|
:desktop_host => 'home.exvo.com',
|
@@ -211,6 +250,8 @@ module Exvo
|
|
211
250
|
:auth_host => 'auth.exvo.co',
|
212
251
|
:auth_require_ssl => false,
|
213
252
|
:sso_cookie_domain => 'exvo.co',
|
253
|
+
:budget_host => 'budget.exvo.co',
|
254
|
+
:budget_require_ssl => false,
|
214
255
|
:cdn_host => 'd1by559a994699.cloudfront.net',
|
215
256
|
:cfs_host => 'cfs.exvo.co',
|
216
257
|
:desktop_host => 'home.exvo.co',
|
@@ -228,6 +269,8 @@ module Exvo
|
|
228
269
|
:auth_host => 'auth.exvo.local',
|
229
270
|
:auth_require_ssl => false,
|
230
271
|
:sso_cookie_domain => 'exvo.local',
|
272
|
+
:budget_host => 'budget.exvo.local',
|
273
|
+
:budget_require_ssl => false,
|
231
274
|
:cdn_host => 'home.exvo.local',
|
232
275
|
:cfs_host => 'cfs.exvo.local',
|
233
276
|
:desktop_host => 'home.exvo.local',
|
@@ -245,6 +288,8 @@ module Exvo
|
|
245
288
|
:auth_host => 'auth.exvo.local',
|
246
289
|
:auth_require_ssl => false,
|
247
290
|
:sso_cookie_domain => 'exvo.local',
|
291
|
+
:budget_host => 'budget.exvo.local',
|
292
|
+
:budget_require_ssl => false,
|
248
293
|
:cdn_host => 'home.exvo.local',
|
249
294
|
:cfs_host => 'cfs.exvo.local',
|
250
295
|
:desktop_host => 'home.exvo.local',
|
data/lib/exvo_helpers/version.rb
CHANGED
@@ -31,11 +31,12 @@ describe Exvo::Helpers do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "uri methods in production environment" do
|
34
|
-
specify { Exvo::Helpers.auth_uri.should match(
|
35
|
-
specify { Exvo::Helpers.
|
36
|
-
specify { Exvo::Helpers.
|
34
|
+
specify { Exvo::Helpers.auth_uri.should match(/\Ahttps:\/\/auth.exvo.com\Z/) }
|
35
|
+
specify { Exvo::Helpers.budget_uri.should match(/\Ahttps:\/\/budget.exvo.com\Z/) }
|
36
|
+
specify { Exvo::Helpers.cdn_uri.should match(/\A\/\/d33gjlr95u9pgf.cloudfront.net\Z/) }
|
37
|
+
specify { Exvo::Helpers.cfs_uri.should match(/\A\/\/cfs.exvo.com\Z/) }
|
37
38
|
specify { Exvo::Helpers.desktop_uri.should match('home.exvo.com') }
|
38
|
-
specify { Exvo::Helpers.themes_uri.should match(
|
39
|
+
specify { Exvo::Helpers.themes_uri.should match(/\A\/\/themes.exvo.com\Z/) }
|
39
40
|
specify { Exvo::Helpers.blog_uri.should match('www.exvo.com/blog') }
|
40
41
|
specify { Exvo::Helpers.contacts_uri.should match('contacts.exvo.com') }
|
41
42
|
specify { Exvo::Helpers.inbox_uri.should match('inbox.exvo.com') }
|
@@ -47,6 +48,7 @@ describe Exvo::Helpers do
|
|
47
48
|
|
48
49
|
describe "host methods in production environment" do
|
49
50
|
specify { Exvo::Helpers.auth_host.should match('auth.exvo.com') }
|
51
|
+
specify { Exvo::Helpers.budget_host.should match('budget.exvo.com') }
|
50
52
|
specify { Exvo::Helpers.cdn_host.should eql('d33gjlr95u9pgf.cloudfront.net') }
|
51
53
|
specify { Exvo::Helpers.cfs_host.should eql('cfs.exvo.com') }
|
52
54
|
specify { Exvo::Helpers.desktop_host.should eql('home.exvo.com') }
|
@@ -66,6 +68,7 @@ describe Exvo::Helpers do
|
|
66
68
|
end
|
67
69
|
|
68
70
|
specify { Exvo::Helpers.auth_host.should match('auth.exvo.co') }
|
71
|
+
specify { Exvo::Helpers.budget_host.should match('budget.exvo.co') }
|
69
72
|
specify { Exvo::Helpers.cdn_host.should eql('d1by559a994699.cloudfront.net') }
|
70
73
|
specify { Exvo::Helpers.cfs_host.should eql('cfs.exvo.co') }
|
71
74
|
specify { Exvo::Helpers.desktop_host.should eql('home.exvo.co') }
|
@@ -91,6 +94,10 @@ describe Exvo::Helpers do
|
|
91
94
|
specify { Exvo::Helpers.sso_cookie_domain.should eq("exvo.com") }
|
92
95
|
end
|
93
96
|
|
97
|
+
describe "#budget_require_ssl by default for production env" do
|
98
|
+
specify { Exvo::Helpers.budget_require_ssl.should be_true }
|
99
|
+
end
|
100
|
+
|
94
101
|
describe "ENV settings override the defaults" do
|
95
102
|
# all *host* methods are defined the same using metaprogramming, only testing for 1 is enough
|
96
103
|
let(:cdn_host) { "test.cdn.exvo.com" }
|
@@ -156,6 +163,7 @@ describe Exvo::Helpers do
|
|
156
163
|
Exvo::Helpers.sso_cookie_secret = nil
|
157
164
|
|
158
165
|
Exvo::Helpers.auth_host = nil
|
166
|
+
Exvo::Helpers.budget_host = nil
|
159
167
|
Exvo::Helpers.cdn_host = nil
|
160
168
|
Exvo::Helpers.cfs_host = nil
|
161
169
|
Exvo::Helpers.desktop_host = nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exvo_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,152 +9,152 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
15
|
+
type: :development
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
18
|
- - ! '>='
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: '0'
|
22
|
-
|
21
|
+
none: false
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - ! '>='
|
28
26
|
- !ruby/object:Gem::Version
|
29
27
|
version: '0'
|
28
|
+
none: false
|
29
|
+
name: rake
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
31
|
+
type: :development
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
33
|
requirements:
|
35
34
|
- - ! '>='
|
36
35
|
- !ruby/object:Gem::Version
|
37
36
|
version: '2.8'
|
38
|
-
|
37
|
+
none: false
|
39
38
|
prerelease: false
|
40
39
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
40
|
requirements:
|
43
41
|
- - ! '>='
|
44
42
|
- !ruby/object:Gem::Version
|
45
43
|
version: '2.8'
|
44
|
+
none: false
|
45
|
+
name: rspec
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
47
|
+
type: :development
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
49
|
requirements:
|
51
50
|
- - ! '>='
|
52
51
|
- !ruby/object:Gem::Version
|
53
52
|
version: 0.10.0
|
54
|
-
|
53
|
+
none: false
|
55
54
|
prerelease: false
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
56
|
requirements:
|
59
57
|
- - ! '>='
|
60
58
|
- !ruby/object:Gem::Version
|
61
59
|
version: 0.10.0
|
60
|
+
none: false
|
61
|
+
name: guard
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
63
|
+
type: :development
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
65
|
requirements:
|
67
66
|
- - ! '>='
|
68
67
|
- !ruby/object:Gem::Version
|
69
68
|
version: '0'
|
70
|
-
|
69
|
+
none: false
|
71
70
|
prerelease: false
|
72
71
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
72
|
requirements:
|
75
73
|
- - ! '>='
|
76
74
|
- !ruby/object:Gem::Version
|
77
75
|
version: '0'
|
76
|
+
none: false
|
77
|
+
name: guard-bundler
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
79
|
+
type: :development
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
81
|
requirements:
|
83
82
|
- - ! '>='
|
84
83
|
- !ruby/object:Gem::Version
|
85
84
|
version: 0.6.0
|
86
|
-
|
85
|
+
none: false
|
87
86
|
prerelease: false
|
88
87
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
88
|
requirements:
|
91
89
|
- - ! '>='
|
92
90
|
- !ruby/object:Gem::Version
|
93
91
|
version: 0.6.0
|
92
|
+
none: false
|
93
|
+
name: guard-rspec
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
|
95
|
+
type: :development
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
97
|
requirements:
|
99
98
|
- - ! '>='
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '0'
|
102
|
-
|
101
|
+
none: false
|
103
102
|
prerelease: false
|
104
103
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
104
|
requirements:
|
107
105
|
- - ! '>='
|
108
106
|
- !ruby/object:Gem::Version
|
109
107
|
version: '0'
|
108
|
+
none: false
|
109
|
+
name: rb-fsevent
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
|
111
|
+
type: :development
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
113
|
requirements:
|
115
114
|
- - ! '>='
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: '0'
|
118
|
-
|
117
|
+
none: false
|
119
118
|
prerelease: false
|
120
119
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
120
|
requirements:
|
123
121
|
- - ! '>='
|
124
122
|
- !ruby/object:Gem::Version
|
125
123
|
version: '0'
|
124
|
+
none: false
|
125
|
+
name: rb-inotify
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
|
-
|
127
|
+
type: :development
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
129
|
requirements:
|
131
130
|
- - ! '>='
|
132
131
|
- !ruby/object:Gem::Version
|
133
132
|
version: '0'
|
134
|
-
|
133
|
+
none: false
|
135
134
|
prerelease: false
|
136
135
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
136
|
requirements:
|
139
137
|
- - ! '>='
|
140
138
|
- !ruby/object:Gem::Version
|
141
139
|
version: '0'
|
140
|
+
none: false
|
141
|
+
name: simplecov
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
|
-
|
143
|
+
type: :development
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
145
|
requirements:
|
147
146
|
- - ! '>='
|
148
147
|
- !ruby/object:Gem::Version
|
149
148
|
version: '0'
|
150
|
-
|
149
|
+
none: false
|
151
150
|
prerelease: false
|
152
151
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
152
|
requirements:
|
155
153
|
- - ! '>='
|
156
154
|
- !ruby/object:Gem::Version
|
157
155
|
version: '0'
|
156
|
+
none: false
|
157
|
+
name: simplecov-rcov
|
158
158
|
description: Ruby gem providing various helper methods, like auth_host, auth_uri,
|
159
159
|
auth_require_ssl, cdn_host, etc.
|
160
160
|
email:
|
@@ -166,7 +166,7 @@ files:
|
|
166
166
|
- .gitignore
|
167
167
|
- CHANGELOG.md
|
168
168
|
- Gemfile
|
169
|
-
-
|
169
|
+
- LICENSE
|
170
170
|
- README.md
|
171
171
|
- Rakefile
|
172
172
|
- exvo_helpers.gemspec
|
@@ -185,17 +185,17 @@ rdoc_options: []
|
|
185
185
|
require_paths:
|
186
186
|
- lib
|
187
187
|
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
-
none: false
|
189
188
|
requirements:
|
190
189
|
- - ! '>='
|
191
190
|
- !ruby/object:Gem::Version
|
192
191
|
version: '0'
|
193
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
192
|
none: false
|
193
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
194
|
requirements:
|
196
195
|
- - ! '>='
|
197
196
|
- !ruby/object:Gem::Version
|
198
197
|
version: '0'
|
198
|
+
none: false
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
201
|
rubygems_version: 1.8.24
|
@@ -203,4 +203,3 @@ signing_key:
|
|
203
203
|
specification_version: 3
|
204
204
|
summary: Collection of helper methods for various Exvo related apps/services
|
205
205
|
test_files: []
|
206
|
-
has_rdoc:
|
/data/{MIT-LICENSE → LICENSE}
RENAMED
File without changes
|