locomotivecms_steam 1.0.0.rc10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -17
- data/lib/locomotive/steam/adapters/mongodb.rb +5 -23
- data/lib/locomotive/steam/initializers/sprockets.rb +0 -1
- data/lib/locomotive/steam/middlewares/helpers.rb +1 -1
- data/lib/locomotive/steam/version.rb +1 -1
- data/lib/locomotive/steam.rb +10 -1
- data/locomotivecms_steam.gemspec +3 -5
- data/spec/unit/middlewares/locale_redirection_spec.rb +10 -1
- metadata +8 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3624519a192d3e6bd9d76a79309374786f790e16
|
4
|
+
data.tar.gz: 24ab1580d146b35e87a7d0208a8143b18ddb3f5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da4b24d96279eaa2db5e4812af1aed83ddfa12df58dec74c903deea1f098e39cd09e8d6561ae9078e5b199b704d2ebb714a61ff0546a1eb45835a8e8d35da1d
|
7
|
+
data.tar.gz: cb5c389a0355ba13f70b8f3491f706c5999935f0548ec7c912e2a4fc4f07db28ad4a374ee27d37ffc1cc2aa1e879ec4c3794ff0a39c92694450a18b49c93bd8c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
locomotivecms_steam (1.0.0
|
4
|
+
locomotivecms_steam (1.0.0)
|
5
5
|
RedCloth (~> 4.2.9)
|
6
6
|
autoprefixer-rails (~> 6.2.3)
|
7
7
|
chronic (~> 0.10.2)
|
@@ -11,23 +11,19 @@ PATH
|
|
11
11
|
haml (~> 4.0.6)
|
12
12
|
httparty (~> 0.13.6)
|
13
13
|
kramdown (~> 1.9.0)
|
14
|
-
less (~> 2.6.0)
|
15
14
|
locomotivecms-solid (~> 4.0.1)
|
16
15
|
locomotivecms_common (~> 0.0.5)
|
17
16
|
mime-types (~> 2.6.1)
|
18
17
|
mimetype-fu (~> 0.1.2)
|
19
18
|
moneta (~> 0.8.0)
|
20
|
-
mongo (~> 2.2.1)
|
21
19
|
morphine (~> 0.1.1)
|
22
20
|
nokogiri (~> 1.6.7.1)
|
23
|
-
origin (~> 2.1.1)
|
24
21
|
rack-cache (~> 1.2)
|
25
22
|
rack-rewrite (~> 1.5.1)
|
26
23
|
rack_csrf (~> 2.5.0)
|
27
24
|
sanitize (~> 4.0.1)
|
28
|
-
sass (~> 3.4.
|
25
|
+
sass (~> 3.4.21)
|
29
26
|
sprockets (~> 3.5.2)
|
30
|
-
therubyracer (~> 0.12.2)
|
31
27
|
|
32
28
|
GEM
|
33
29
|
remote: https://rubygems.org/
|
@@ -56,7 +52,6 @@ GEM
|
|
56
52
|
execjs
|
57
53
|
coffee-script-source (1.10.0)
|
58
54
|
colorize (0.7.7)
|
59
|
-
commonjs (0.2.7)
|
60
55
|
compass (1.0.3)
|
61
56
|
chunky_png (~> 1.2)
|
62
57
|
compass-core (~> 1.0.2)
|
@@ -110,9 +105,6 @@ GEM
|
|
110
105
|
multi_json (~> 1.0)
|
111
106
|
rspec (>= 2.0, < 4.0)
|
112
107
|
kramdown (1.9.0)
|
113
|
-
less (2.6.0)
|
114
|
-
commonjs (~> 0.2.7)
|
115
|
-
libv8 (3.16.14.13)
|
116
108
|
locomotivecms-liquid (4.0.0)
|
117
109
|
locomotivecms-solid (4.0.1)
|
118
110
|
locomotivecms-liquid (~> 4.0.0)
|
@@ -163,7 +155,6 @@ GEM
|
|
163
155
|
rb-fsevent (0.9.7)
|
164
156
|
rb-inotify (0.9.5)
|
165
157
|
ffi (>= 0.5.0)
|
166
|
-
ref (2.0.0)
|
167
158
|
rest-client (1.8.0)
|
168
159
|
http-cookie (>= 1.0.2, < 2.0)
|
169
160
|
mime-types (>= 1.16, < 3.0)
|
@@ -185,7 +176,7 @@ GEM
|
|
185
176
|
crass (~> 1.0.2)
|
186
177
|
nokogiri (>= 1.4.4)
|
187
178
|
nokogumbo (~> 1.4.1)
|
188
|
-
sass (3.4.
|
179
|
+
sass (3.4.21)
|
189
180
|
simplecov (0.11.1)
|
190
181
|
docile (~> 1.1.0)
|
191
182
|
json (~> 1.8)
|
@@ -199,12 +190,9 @@ GEM
|
|
199
190
|
stringex (2.5.2)
|
200
191
|
term-ansicolor (1.3.2)
|
201
192
|
tins (~> 1.0)
|
202
|
-
therubyracer (0.12.2)
|
203
|
-
libv8 (~> 3.16.14.0)
|
204
|
-
ref
|
205
193
|
thor (0.19.1)
|
206
194
|
thread_safe (0.3.5)
|
207
|
-
tilt (2.0.
|
195
|
+
tilt (2.0.2)
|
208
196
|
timecop (0.8.0)
|
209
197
|
tins (1.6.0)
|
210
198
|
tzinfo (1.2.2)
|
@@ -226,6 +214,8 @@ DEPENDENCIES
|
|
226
214
|
json_spec (~> 1.1.4)
|
227
215
|
locomotivecms_steam!
|
228
216
|
memory_profiler
|
217
|
+
mongo (~> 2.2.1)
|
218
|
+
origin (~> 2.1.1)
|
229
219
|
pry-byebug (~> 3.3.0)
|
230
220
|
puma
|
231
221
|
rack-mini-profiler
|
@@ -237,4 +227,4 @@ DEPENDENCIES
|
|
237
227
|
yui-compressor (~> 0.12.0)
|
238
228
|
|
239
229
|
BUNDLED WITH
|
240
|
-
1.
|
230
|
+
1.11.2
|
@@ -82,33 +82,15 @@ module Locomotive::Steam
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def session
|
85
|
-
Thread.current[:mongo_session] ||=
|
86
|
-
Mongo::Client.new(uri)
|
87
|
-
else
|
88
|
-
client = Mongo::Client.new([*hosts], database: database)
|
89
|
-
client = client.with(user: username, password: password) if username && password
|
90
|
-
client
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def uri
|
95
|
-
options[:uri]
|
96
|
-
end
|
97
|
-
|
98
|
-
def database
|
99
|
-
options[:database]
|
100
|
-
end
|
101
|
-
|
102
|
-
def hosts
|
103
|
-
options[:hosts]
|
85
|
+
Thread.current[:mongo_session] ||= Mongo::Client.new(uri_or_hosts, client_options)
|
104
86
|
end
|
105
87
|
|
106
|
-
def
|
107
|
-
options[:
|
88
|
+
def uri_or_hosts
|
89
|
+
options[:uri] || [*options[:hosts]]
|
108
90
|
end
|
109
91
|
|
110
|
-
def
|
111
|
-
options
|
92
|
+
def client_options
|
93
|
+
options.slice(*Mongo::Client::VALID_OPTIONS)
|
112
94
|
end
|
113
95
|
|
114
96
|
end
|
data/lib/locomotive/steam.rb
CHANGED
@@ -22,7 +22,8 @@ module Locomotive
|
|
22
22
|
IsHTTP = /\Ahttps?:\/\//o
|
23
23
|
|
24
24
|
class << self
|
25
|
-
attr_writer
|
25
|
+
attr_writer :configuration
|
26
|
+
attr_accessor :extension_configurations
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.configuration
|
@@ -39,8 +40,16 @@ module Locomotive
|
|
39
40
|
require_relative 'steam/initializers'
|
40
41
|
end
|
41
42
|
|
43
|
+
def self.configure_extension(&block)
|
44
|
+
(@extension_configurations ||= []) << block
|
45
|
+
end
|
46
|
+
|
42
47
|
# Shortcut to build the Rack stack
|
43
48
|
def self.to_app
|
49
|
+
(@extension_configurations || []).each do |block|
|
50
|
+
block.call(@configuration)
|
51
|
+
end
|
52
|
+
|
44
53
|
require_relative 'steam/server'
|
45
54
|
Server.to_app
|
46
55
|
end
|
data/locomotivecms_steam.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
19
19
|
spec.add_development_dependency 'rake', '~> 10.4.2'
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
21
|
+
spec.add_development_dependency 'mongo', '~> 2.2.1'
|
22
|
+
spec.add_development_dependency 'origin', '~> 2.1.1'
|
23
23
|
|
24
24
|
spec.add_dependency 'nokogiri', '~> 1.6.7.1'
|
25
25
|
spec.add_dependency 'sanitize', '~> 4.0.1'
|
@@ -34,9 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency 'rack_csrf', '~> 2.5.0'
|
35
35
|
|
36
36
|
spec.add_dependency 'sprockets', '~> 3.5.2'
|
37
|
-
spec.add_dependency 'sass', '~> 3.4.
|
38
|
-
spec.add_dependency 'less', '~> 2.6.0'
|
39
|
-
spec.add_dependency 'therubyracer', '~> 0.12.2'
|
37
|
+
spec.add_dependency 'sass', '~> 3.4.21'
|
40
38
|
spec.add_dependency 'coffee-script', '~> 2.4.1'
|
41
39
|
spec.add_dependency 'compass', '~> 1.0.3'
|
42
40
|
spec.add_dependency 'autoprefixer-rails', '~> 6.2.3'
|
@@ -13,10 +13,13 @@ describe Locomotive::Steam::Middlewares::LocaleRedirection do
|
|
13
13
|
let(:middleware) { Locomotive::Steam::Middlewares::LocaleRedirection.new(app) }
|
14
14
|
let(:locale) { 'de' }
|
15
15
|
let(:locale_in_path) { true }
|
16
|
+
let(:mounted_on) { nil }
|
16
17
|
|
17
18
|
subject do
|
18
19
|
env = env_for(url, 'steam.site' => site, 'steam.locale' => locale, 'steam.locale_in_path' => locale_in_path)
|
19
|
-
env['steam.
|
20
|
+
env['steam.mounted_on'] = mounted_on
|
21
|
+
env['steam.request'] = Rack::Request.new(env)
|
22
|
+
env['steam.path'] = env['steam.request'].path_info.gsub(/\A#{mounted_on}/, '')
|
20
23
|
code, env = middleware.call(env)
|
21
24
|
[code, env['Location']]
|
22
25
|
end
|
@@ -81,6 +84,12 @@ describe Locomotive::Steam::Middlewares::LocaleRedirection do
|
|
81
84
|
it { is_expected.to eq [301, '/de/hello/world?this=is_me'] }
|
82
85
|
end
|
83
86
|
|
87
|
+
describe 'mounted_on is present' do
|
88
|
+
let(:mounted_on) { '/mounted-on/somewhere' }
|
89
|
+
let(:url) { 'http://models.example.com/mounted-on/somewhere/hello/world' }
|
90
|
+
it { is_expected.to eq [301, '/mounted-on/somewhere/de/hello/world'] }
|
91
|
+
end
|
92
|
+
|
84
93
|
end
|
85
94
|
|
86
95
|
describe 'with locale' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotivecms_steam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-01-
|
14
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 2.2.1
|
51
|
-
type: :
|
51
|
+
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 2.1.1
|
65
|
-
type: :
|
65
|
+
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
@@ -229,42 +229,14 @@ dependencies:
|
|
229
229
|
requirements:
|
230
230
|
- - "~>"
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
version: 3.4.
|
232
|
+
version: 3.4.21
|
233
233
|
type: :runtime
|
234
234
|
prerelease: false
|
235
235
|
version_requirements: !ruby/object:Gem::Requirement
|
236
236
|
requirements:
|
237
237
|
- - "~>"
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version: 3.4.
|
240
|
-
- !ruby/object:Gem::Dependency
|
241
|
-
name: less
|
242
|
-
requirement: !ruby/object:Gem::Requirement
|
243
|
-
requirements:
|
244
|
-
- - "~>"
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version: 2.6.0
|
247
|
-
type: :runtime
|
248
|
-
prerelease: false
|
249
|
-
version_requirements: !ruby/object:Gem::Requirement
|
250
|
-
requirements:
|
251
|
-
- - "~>"
|
252
|
-
- !ruby/object:Gem::Version
|
253
|
-
version: 2.6.0
|
254
|
-
- !ruby/object:Gem::Dependency
|
255
|
-
name: therubyracer
|
256
|
-
requirement: !ruby/object:Gem::Requirement
|
257
|
-
requirements:
|
258
|
-
- - "~>"
|
259
|
-
- !ruby/object:Gem::Version
|
260
|
-
version: 0.12.2
|
261
|
-
type: :runtime
|
262
|
-
prerelease: false
|
263
|
-
version_requirements: !ruby/object:Gem::Requirement
|
264
|
-
requirements:
|
265
|
-
- - "~>"
|
266
|
-
- !ruby/object:Gem::Version
|
267
|
-
version: 0.12.2
|
239
|
+
version: 3.4.21
|
268
240
|
- !ruby/object:Gem::Dependency
|
269
241
|
name: coffee-script
|
270
242
|
requirement: !ruby/object:Gem::Requirement
|
@@ -836,9 +808,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
836
808
|
version: '2.0'
|
837
809
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
838
810
|
requirements:
|
839
|
-
- - "
|
811
|
+
- - ">="
|
840
812
|
- !ruby/object:Gem::Version
|
841
|
-
version:
|
813
|
+
version: '0'
|
842
814
|
requirements: []
|
843
815
|
rubyforge_project:
|
844
816
|
rubygems_version: 2.4.5.1
|