utopia 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +4 -2
- data/.travis.yml +8 -6
- data/lib/utopia/content.rb +5 -3
- data/lib/utopia/content/link.rb +0 -1
- data/lib/utopia/content/links.rb +1 -1
- data/lib/utopia/content/node.rb +3 -2
- data/lib/utopia/content/processor.rb +1 -1
- data/lib/utopia/content/tag.rb +11 -3
- data/lib/utopia/controller.rb +6 -4
- data/lib/utopia/controller/action.rb +9 -1
- data/lib/utopia/http.rb +1 -1
- data/lib/utopia/localization.rb +3 -5
- data/lib/utopia/path.rb +1 -1
- data/lib/utopia/static.rb +9 -8
- data/lib/utopia/version.rb +1 -1
- data/materials/utopia.png +0 -0
- data/materials/utopia.svg +1 -25
- data/setup/site/pages/_page.xnode +1 -0
- data/setup/site/pages/_static/site.css +44 -27
- data/setup/site/pages/_static/utopia-background.svg +1 -0
- data/setup/site/pages/_static/utopia.svg +1 -0
- data/spec/utopia/content/processor_spec.rb +1 -1
- data/spec/utopia/controller/middleware_spec.rb +10 -0
- data/spec/utopia/controller/middleware_spec.ru +1 -1
- data/spec/utopia/controller/middleware_spec/redirect/controller.rb +9 -0
- data/spec/utopia/controller/middleware_spec/redirect/test/controller.rb +6 -0
- data/spec/utopia/controller/rewrite_spec.rb +2 -2
- data/spec/utopia/controller/sequence_spec.rb +4 -0
- data/spec/utopia/path_spec.rb +0 -1
- data/spec/utopia/static_spec.rb +3 -2
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 015ec482d8717b045b3d2cc12802afaf93b65560
|
4
|
+
data.tar.gz: 4a96d5699bc6bdb5398417dd518232a6b7798214
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e7f158a4aa3a175b9fc0c0b5686a1b7bb190e2d66018ca7f6f56523ba9d136ef373bd9089ec9ed0999503ba37815dbe3d6c3967a5f5e1bc5da7cca91ab78090
|
7
|
+
data.tar.gz: 4ee41e67fa41687bcd379b534c8c2a04947c9838da952aa3b93d448b674d0d059423f239ee6ce8ace1507ae67947ebab61d21be2c663a8f7c1b87913170759a9
|
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
rvm:
|
4
|
-
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.8
|
6
|
+
- 2.2.4
|
7
|
+
- 2.3.0
|
8
|
+
- ruby-head
|
9
|
+
- rbx-2
|
10
|
+
env: COVERAGE=true
|
8
11
|
matrix:
|
9
12
|
allow_failures:
|
10
|
-
- rvm: "rbx-2"
|
11
|
-
env: COVERAGE=true
|
13
|
+
- rvm: "rbx-2"
|
data/lib/utopia/content.rb
CHANGED
@@ -38,7 +38,9 @@ module Utopia
|
|
38
38
|
@root = File.expand_path(options[:root] || Utopia::default_root)
|
39
39
|
|
40
40
|
if options[:cache_templates]
|
41
|
-
@
|
41
|
+
@template_cache = Concurrent::Map.new
|
42
|
+
else
|
43
|
+
@template_cache = nil
|
42
44
|
end
|
43
45
|
|
44
46
|
@tags = options.fetch(:tags, {})
|
@@ -56,8 +58,8 @@ module Utopia
|
|
56
58
|
attr :root
|
57
59
|
|
58
60
|
def fetch_xml(path)
|
59
|
-
if @
|
60
|
-
@
|
61
|
+
if @template_cache
|
62
|
+
@template_cache.fetch_or_store(path.to_s) do
|
61
63
|
Trenni::Template.load(path)
|
62
64
|
end
|
63
65
|
else
|
data/lib/utopia/content/link.rb
CHANGED
data/lib/utopia/content/links.rb
CHANGED
data/lib/utopia/content/node.rb
CHANGED
@@ -80,7 +80,7 @@ module Utopia
|
|
80
80
|
links = Links.index(@controller.root, path, options)
|
81
81
|
|
82
82
|
if block_given?
|
83
|
-
links.each
|
83
|
+
links.each(&block)
|
84
84
|
else
|
85
85
|
links
|
86
86
|
end
|
@@ -88,7 +88,8 @@ module Utopia
|
|
88
88
|
|
89
89
|
def related_links
|
90
90
|
name = @uri_path.last.split('.', 2).first
|
91
|
-
|
91
|
+
|
92
|
+
return Links.index(@controller.root, uri_path.dirname, :name => name, :indices => true)
|
92
93
|
end
|
93
94
|
|
94
95
|
def siblings_path
|
data/lib/utopia/content/tag.rb
CHANGED
@@ -41,9 +41,17 @@ module Utopia
|
|
41
41
|
@closed = false
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
def freeze
|
45
|
+
@name.freeze
|
46
|
+
@attributes.freeze
|
47
|
+
@closed.freeze
|
48
|
+
|
49
|
+
super
|
50
|
+
end
|
51
|
+
|
52
|
+
attr_accessor :name
|
53
|
+
attr_accessor :attributes
|
54
|
+
attr_accessor :closed
|
47
55
|
|
48
56
|
def [](key)
|
49
57
|
@attributes[key]
|
data/lib/utopia/controller.rb
CHANGED
@@ -51,7 +51,9 @@ module Utopia
|
|
51
51
|
@root = options[:root] || Utopia::default_root
|
52
52
|
|
53
53
|
if options[:cache_controllers]
|
54
|
-
@
|
54
|
+
@controller_cache = Concurrent::Map.new
|
55
|
+
else
|
56
|
+
@controller_cache = nil
|
55
57
|
end
|
56
58
|
|
57
59
|
self.freeze
|
@@ -66,8 +68,8 @@ module Utopia
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def lookup_controller(path)
|
69
|
-
if @
|
70
|
-
@
|
71
|
+
if @controller_cache
|
72
|
+
@controller_cache.fetch_or_store(path.to_s) do
|
71
73
|
load_controller_file(path)
|
72
74
|
end
|
73
75
|
else
|
@@ -136,7 +138,7 @@ module Utopia
|
|
136
138
|
end
|
137
139
|
|
138
140
|
def call(env)
|
139
|
-
|
141
|
+
env[VARIABLES_KEY] ||= Variables.new
|
140
142
|
|
141
143
|
request = Rack::Request.new(env)
|
142
144
|
|
@@ -21,6 +21,14 @@
|
|
21
21
|
module Utopia
|
22
22
|
class Controller
|
23
23
|
class Action < Hash
|
24
|
+
def initialize
|
25
|
+
@path = nil
|
26
|
+
@options = options
|
27
|
+
@callback = nil
|
28
|
+
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
24
32
|
attr_accessor :path, :callback, :options
|
25
33
|
|
26
34
|
def callback?
|
@@ -75,7 +83,7 @@ module Utopia
|
|
75
83
|
# relative_path = 2014/mr-potato
|
76
84
|
# actions => {:** => A}
|
77
85
|
def select(relative_path)
|
78
|
-
|
86
|
+
[].tap do |actions|
|
79
87
|
append(relative_path.reverse, 0, actions)
|
80
88
|
end
|
81
89
|
end
|
data/lib/utopia/http.rb
CHANGED
data/lib/utopia/localization.rb
CHANGED
@@ -91,7 +91,7 @@ module Utopia
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def freeze
|
94
|
-
@
|
94
|
+
@all_locales.freeze
|
95
95
|
@default_locales.freeze
|
96
96
|
@default_locale.freeze
|
97
97
|
@hosts.freeze
|
@@ -132,8 +132,6 @@ module Utopia
|
|
132
132
|
def host_preferred_locales(env)
|
133
133
|
http_host = env[Rack::HTTP_HOST]
|
134
134
|
|
135
|
-
locales = []
|
136
|
-
|
137
135
|
# Get a list of all hosts which match the incoming htt_host:
|
138
136
|
matching_hosts = @hosts.select{|host_pattern, locale| http_host =~ host_pattern}
|
139
137
|
|
@@ -203,10 +201,10 @@ module Utopia
|
|
203
201
|
response = nil
|
204
202
|
|
205
203
|
# We have a non-localized request, but there might be a localized resource. We return the best localization possible:
|
206
|
-
preferred_locales(env) do |
|
204
|
+
preferred_locales(env) do |localized_env|
|
207
205
|
# puts "Trying locale: #{env[CURRENT_LOCALE_KEY]}: #{env[Rack::PATH_INFO]}..."
|
208
206
|
|
209
|
-
response = @app.call(
|
207
|
+
response = @app.call(localized_env)
|
210
208
|
|
211
209
|
break unless response[0] >= 400
|
212
210
|
end
|
data/lib/utopia/path.rb
CHANGED
data/lib/utopia/static.rb
CHANGED
@@ -134,14 +134,15 @@ module Utopia
|
|
134
134
|
# TODO: Support multiple byte-ranges, for now just send entire file:
|
135
135
|
response[0] = 200
|
136
136
|
response[1]["Content-Length"] = size.to_s
|
137
|
-
@range = 0
|
137
|
+
@range = 0...size
|
138
138
|
else
|
139
139
|
# Partial content:
|
140
140
|
@range = ranges[0]
|
141
|
+
partial_size = @range.count
|
142
|
+
|
141
143
|
response[0] = 206
|
142
|
-
response[1]["Content-
|
143
|
-
response[1]["Content-
|
144
|
-
size = @range.end - @range.begin + 1
|
144
|
+
response[1]["Content-Length"] = partial_size.to_s
|
145
|
+
response[1]["Content-Range"] = "bytes #{@range.min}-#{@range.max}/#{size}"
|
145
146
|
end
|
146
147
|
|
147
148
|
# LOG.debug {"Serving file #{full_path.inspect}, range #{@range.inspect}"}
|
@@ -169,12 +170,12 @@ module Utopia
|
|
169
170
|
when Array
|
170
171
|
result["." + type[0]] = type[1]
|
171
172
|
when String
|
172
|
-
|
173
|
-
extract_extensions.call(
|
173
|
+
MIME::Types.of(type).select{|mime_type| !mime_type.obsolete?}.each do |mime_type|
|
174
|
+
extract_extensions.call(mime_type)
|
174
175
|
end
|
175
176
|
when Regexp
|
176
|
-
MIME::Types[type].select{|
|
177
|
-
extract_extensions.call(
|
177
|
+
MIME::Types[type].select{|mime_type| !mime_type.obsolete?}.each do |mime_type|
|
178
|
+
extract_extensions.call(mime_type)
|
178
179
|
end
|
179
180
|
when MIME::Type
|
180
181
|
extract_extensions.call(type)
|
data/lib/utopia/version.rb
CHANGED
data/materials/utopia.png
CHANGED
Binary file
|
data/materials/utopia.svg
CHANGED
@@ -1,25 +1 @@
|
|
1
|
-
<?xml version="1.0"
|
2
|
-
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
-
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5
|
-
width="420px" height="76.993px" viewBox="0 0 420 76.993" enable-background="new 0 0 420 76.993" xml:space="preserve">
|
6
|
-
<g>
|
7
|
-
<rect y="-0.246" fill="#F79433" width="420" height="74.246"/>
|
8
|
-
<rect y="54" fill="#4E8DD8" width="420" height="23"/>
|
9
|
-
<g>
|
10
|
-
<path fill="#FFFFFF" d="M74.365,68.163c2.379-2.981,4.189-6.661,5.131-10.939C80.41,53.068,81,48.311,81,43.083V0H18v43.083
|
11
|
-
c0,2.53,0.245,5.133,0.409,7.734c0.168,2.678,0.676,5.308,1.35,7.814c0.683,2.545,1.746,4.979,3.079,7.235
|
12
|
-
c1.368,2.315,3.276,4.356,5.631,6.066c2.328,1.69,5.265,3.045,8.711,4.016C38.803,76.408,40.609,77,42.555,77h13.91
|
13
|
-
c3.083,0,5.82-1.018,8.163-1.926C68.686,73.504,71.962,71.177,74.365,68.163z"/>
|
14
|
-
<polygon fill="#FFFFFF" points="151,18 151,0 88,-0.021 88,18 110.334,18 110.354,77 128.354,77 128.334,18 "/>
|
15
|
-
<path fill="#FFFFFF" d="M229.753,38.499c0-21.224-17.046-38.492-38-38.492s-38,17.269-38,38.492c0,21.227,17.046,38.494,38,38.494
|
16
|
-
S229.753,59.726,229.753,38.499z"/>
|
17
|
-
<path fill="#FFFFFF" d="M269.219,49c9.755,0,17.248-1.989,22.27-6.155c5.107-4.234,7.697-10.532,7.697-18.841
|
18
|
-
c0-3.135-0.394-5.739-1.171-8.158c-0.782-2.434-1.891-4.749-3.294-6.559c-1.407-1.811-3.11-3.328-5.065-4.526
|
19
|
-
c-1.903-1.165-4.019-2.116-6.289-2.833c-2.247-0.709-4.658-1.216-7.167-1.502C273.727,0.145,271.165,0,268.584,0H239v77h18V49
|
20
|
-
H269.219z"/>
|
21
|
-
<rect x="305" fill="#FFFFFF" width="18" height="77"/>
|
22
|
-
<polygon fill="#FFFFFF" points="362.936,0 333.343,77 409.529,77 378.159,0 "/>
|
23
|
-
</g>
|
24
|
-
</g>
|
25
|
-
</svg>
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 420 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g><rect x="0" y="0" width="420" height="56" style="fill:#f79433;"/><rect x="0" y="56" width="420" height="24" style="fill:#4e8dd8;"/><g><path d="M75.145,70.819c2.37,-3.097 4.173,-6.921 5.111,-11.365c0.91,-4.318 1.498,-9.261 1.498,-14.692l0,-44.762l-62.754,0l0,44.762c0,2.628 0.244,5.333 0.407,8.035c0.168,2.782 0.674,5.515 1.345,8.118c0.68,2.644 1.739,5.173 3.067,7.517c1.363,2.405 3.263,4.526 5.609,6.303c2.319,1.755 5.245,3.163 8.677,4.172c1.617,0.478 3.416,1.093 5.354,1.093l13.856,0c3.071,0 5.797,-1.058 8.131,-2.001c4.042,-1.631 7.305,-4.049 9.699,-7.18Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M151.481,18.701l0,-18.701l-62.754,-0.022l0,18.723l22.246,0l0.02,61.299l17.93,0l-0.02,-61.299l22.578,0Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M229.926,39.999c0,-22.051 -16.979,-39.992 -37.852,-39.992c-20.872,0 -37.851,17.942 -37.851,39.992c0,22.054 16.979,39.994 37.851,39.994c20.873,0 37.852,-17.94 37.852,-39.994Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M269.238,50.909c9.717,0 17.181,-2.066 22.183,-6.395c5.087,-4.399 7.667,-10.942 7.667,-19.575c0,-3.257 -0.393,-5.962 -1.167,-8.476c-0.778,-2.528 -1.883,-4.934 -3.281,-6.814c-1.401,-1.882 -3.098,-3.458 -5.045,-4.703c-1.895,-1.21 -4.003,-2.198 -6.264,-2.943c-2.239,-0.737 -4.64,-1.263 -7.139,-1.56c-2.464,-0.292 -5.016,-0.443 -7.587,-0.443l-29.468,0l0,80l17.93,0l0,-29.091l12.171,0Z" style="fill:#fff;fill-rule:nonzero;"/><rect x="304.879" y="0" width="17.93" height="80" style="fill:#fff;"/><path d="M362.589,0l-29.477,80l75.888,0l-31.247,-80l-15.164,0Z" style="fill:#fff;fill-rule:nonzero;"/></g></g></svg>
|
@@ -1,23 +1,53 @@
|
|
1
1
|
|
2
|
+
html {
|
3
|
+
font-family: "PT Sans", Verdana, Helvetica, Arial, sans-serif;
|
4
|
+
}
|
5
|
+
@media (min-width: 48em) {
|
6
|
+
html {
|
7
|
+
font-size: 16px;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
@media (min-width: 58em) {
|
11
|
+
html {
|
12
|
+
font-size: 20px;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
2
16
|
body {
|
3
|
-
|
4
|
-
|
5
|
-
|
17
|
+
padding: 0;
|
18
|
+
margin: 0;
|
19
|
+
|
20
|
+
background-color: #fafafa;
|
21
|
+
}
|
22
|
+
|
23
|
+
#header {
|
24
|
+
margin: 1em 0 1em 0;
|
25
|
+
|
26
|
+
background-color: white;
|
27
|
+
|
28
|
+
background-image: url(/_static/utopia-background.svg);
|
29
|
+
|
30
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
|
31
|
+
}
|
32
|
+
|
33
|
+
#header img {
|
34
|
+
display: block;
|
35
|
+
margin: auto;
|
36
|
+
height: 4em;
|
6
37
|
}
|
7
38
|
|
8
39
|
p {
|
9
|
-
color: #
|
40
|
+
color: #555;
|
10
41
|
}
|
11
42
|
|
12
43
|
p strong {
|
13
|
-
color:
|
44
|
+
color: #222;
|
14
45
|
}
|
15
46
|
|
16
47
|
h1, h2, h3, h4, h5, h6 {
|
17
|
-
color: #
|
18
|
-
margin
|
19
|
-
|
20
|
-
text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.7);
|
48
|
+
color: #333;
|
49
|
+
margin: 2em 1em 1em 1em;
|
50
|
+
color: #4E8DD9;
|
21
51
|
}
|
22
52
|
|
23
53
|
img {
|
@@ -33,7 +63,7 @@ a:hover {
|
|
33
63
|
}
|
34
64
|
|
35
65
|
p, dl, h3 {
|
36
|
-
margin:
|
66
|
+
margin: 2em;
|
37
67
|
}
|
38
68
|
|
39
69
|
h3 {
|
@@ -44,27 +74,14 @@ ul {
|
|
44
74
|
margin-bottom: 1em;
|
45
75
|
}
|
46
76
|
|
47
|
-
h3, h4, h5, h6 {
|
77
|
+
h2, h3, h4, h5, h6 {
|
48
78
|
font-weight: normal;
|
49
79
|
}
|
50
80
|
|
51
81
|
body.front h1 {
|
52
82
|
font-weight: normal;
|
53
|
-
font-size:
|
54
|
-
color:
|
55
|
-
|
56
|
-
0 1px 0 #ccc,
|
57
|
-
0 2px 0 #c9c9c9,
|
58
|
-
0 3px 0 #bbb,
|
59
|
-
0 4px 0 #b9b9b9,
|
60
|
-
0 5px 0 #aaa,
|
61
|
-
0 6px 1px rgba(0,0,0,.1),
|
62
|
-
0 0 5px rgba(0,0,0,.1),
|
63
|
-
0 1px 3px rgba(0,0,0,.3),
|
64
|
-
0 3px 5px rgba(0,0,0,.2),
|
65
|
-
0 5px 10px rgba(0,0,0,.25),
|
66
|
-
0 10px 10px rgba(0,0,0,.2),
|
67
|
-
0 20px 20px rgba(0,0,0,.15);
|
68
|
-
|
83
|
+
font-size: 300%;
|
84
|
+
color: #F89432;
|
85
|
+
|
69
86
|
text-align: center;
|
70
87
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 10 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><rect x="0" y="0" width="10" height="56" style="fill:#f79433;"/><rect x="0" y="56" width="10" height="24" style="fill:#4e8dd8;"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 420 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g><rect x="0" y="0" width="420" height="56" style="fill:#f79433;"/><rect x="0" y="56" width="420" height="24" style="fill:#4e8dd8;"/><g><path d="M75.145,70.819c2.37,-3.097 4.173,-6.921 5.111,-11.365c0.91,-4.318 1.498,-9.261 1.498,-14.692l0,-44.762l-62.754,0l0,44.762c0,2.628 0.244,5.333 0.407,8.035c0.168,2.782 0.674,5.515 1.345,8.118c0.68,2.644 1.739,5.173 3.067,7.517c1.363,2.405 3.263,4.526 5.609,6.303c2.319,1.755 5.245,3.163 8.677,4.172c1.617,0.478 3.416,1.093 5.354,1.093l13.856,0c3.071,0 5.797,-1.058 8.131,-2.001c4.042,-1.631 7.305,-4.049 9.699,-7.18Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M151.481,18.701l0,-18.701l-62.754,-0.022l0,18.723l22.246,0l0.02,61.299l17.93,0l-0.02,-61.299l22.578,0Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M229.926,39.999c0,-22.051 -16.979,-39.992 -37.852,-39.992c-20.872,0 -37.851,17.942 -37.851,39.992c0,22.054 16.979,39.994 37.851,39.994c20.873,0 37.852,-17.94 37.852,-39.994Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M269.238,50.909c9.717,0 17.181,-2.066 22.183,-6.395c5.087,-4.399 7.667,-10.942 7.667,-19.575c0,-3.257 -0.393,-5.962 -1.167,-8.476c-0.778,-2.528 -1.883,-4.934 -3.281,-6.814c-1.401,-1.882 -3.098,-3.458 -5.045,-4.703c-1.895,-1.21 -4.003,-2.198 -6.264,-2.943c-2.239,-0.737 -4.64,-1.263 -7.139,-1.56c-2.464,-0.292 -5.016,-0.443 -7.587,-0.443l-29.468,0l0,80l17.93,0l0,-29.091l12.171,0Z" style="fill:#fff;fill-rule:nonzero;"/><rect x="304.879" y="0" width="17.93" height="80" style="fill:#fff;"/><path d="M362.589,0l-29.477,80l75.888,0l-31.247,-80l-15.164,0Z" style="fill:#fff;fill-rule:nonzero;"/></g></g></svg>
|
@@ -73,5 +73,15 @@ module Utopia::Controller::MiddlewareSpec
|
|
73
73
|
expect(last_response.status).to be == 302
|
74
74
|
expect(last_response.headers['Location']).to be == 'bar'
|
75
75
|
end
|
76
|
+
|
77
|
+
# This was a bug, where by the controller URI_PATH was being mutated by Controller#invoke_controllers.
|
78
|
+
it "should give the correct URI_PATH" do
|
79
|
+
get '/redirect/test/bar'
|
80
|
+
expect(last_response.status).to be == 200
|
81
|
+
|
82
|
+
get '/redirect/test/foo'
|
83
|
+
expect(last_response.status).to be == 200
|
84
|
+
expect(last_response.body).to be == '/redirect'
|
85
|
+
end
|
76
86
|
end
|
77
87
|
end
|
@@ -57,7 +57,7 @@ module Utopia::Controller::RewriteSpec
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should match path prefix and extract parameters" do
|
60
|
-
request, path
|
60
|
+
request, path = mock_request("/10/summary/20/edit")
|
61
61
|
relative_path = path - controller.class.uri_path
|
62
62
|
|
63
63
|
controller.process!(request, relative_path)
|
@@ -68,7 +68,7 @@ module Utopia::Controller::RewriteSpec
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should allow rewrite to fail request" do
|
71
|
-
request, path
|
71
|
+
request, path = mock_request("/fail")
|
72
72
|
relative_path = path - controller.class.uri_path
|
73
73
|
|
74
74
|
response = controller.process!(request, relative_path)
|
@@ -92,6 +92,7 @@ module Utopia::Controller::SequenceSpec
|
|
92
92
|
expect(result).to be == [400, {}, ["Bad Request"]]
|
93
93
|
|
94
94
|
result = controller.process!(request, Utopia::Path["/variable"])
|
95
|
+
expect(result).to be == nil
|
95
96
|
expect(variables.to_hash).to be == {"variable"=>:value}
|
96
97
|
end
|
97
98
|
|
@@ -110,6 +111,7 @@ module Utopia::Controller::SequenceSpec
|
|
110
111
|
variables << controller
|
111
112
|
|
112
113
|
result = controller.process!(request, Utopia::Path["/foo/comment/post"])
|
114
|
+
expect(result).to be nil
|
113
115
|
expect(variables['sequence']).to be == 'EB'
|
114
116
|
end
|
115
117
|
|
@@ -119,6 +121,7 @@ module Utopia::Controller::SequenceSpec
|
|
119
121
|
variables << controller
|
120
122
|
|
121
123
|
result = controller.process!(request, Utopia::Path["/comment/delete"])
|
124
|
+
expect(result).to be nil
|
122
125
|
expect(variables['sequence']).to be == 'EDC'
|
123
126
|
end
|
124
127
|
|
@@ -128,6 +131,7 @@ module Utopia::Controller::SequenceSpec
|
|
128
131
|
variables << controller
|
129
132
|
|
130
133
|
result = controller.process!(request, Utopia::Path["/foo"])
|
134
|
+
expect(result).to be nil
|
131
135
|
expect(variables['sequence']).to be == 'EF'
|
132
136
|
end
|
133
137
|
end
|
data/spec/utopia/path_spec.rb
CHANGED
data/spec/utopia/static_spec.rb
CHANGED
@@ -37,10 +37,11 @@ module Utopia::StaticSpec
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should return partial content" do
|
40
|
-
get "/test.txt", {}, 'HTTP_RANGE' => 'bytes=
|
40
|
+
get "/test.txt", {}, 'HTTP_RANGE' => 'bytes=1-4'
|
41
41
|
|
42
42
|
expect(last_response.status).to be == 206
|
43
|
-
expect(last_response.
|
43
|
+
expect(last_response.content_length).to be == 4
|
44
|
+
expect(last_response.body).to be == "ello"
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|
@@ -220,6 +220,8 @@ files:
|
|
220
220
|
- setup/site/pages/_page.xnode
|
221
221
|
- setup/site/pages/_static/icon.png
|
222
222
|
- setup/site/pages/_static/site.css
|
223
|
+
- setup/site/pages/_static/utopia-background.svg
|
224
|
+
- setup/site/pages/_static/utopia.svg
|
223
225
|
- setup/site/pages/errors/exception.xnode
|
224
226
|
- setup/site/pages/errors/file-not-found.xnode
|
225
227
|
- setup/site/pages/links.yaml
|
@@ -261,6 +263,8 @@ files:
|
|
261
263
|
- spec/utopia/controller/middleware_spec/controller/index.xnode
|
262
264
|
- spec/utopia/controller/middleware_spec/controller/nested/controller.rb
|
263
265
|
- spec/utopia/controller/middleware_spec/empty/controller.rb
|
266
|
+
- spec/utopia/controller/middleware_spec/redirect/controller.rb
|
267
|
+
- spec/utopia/controller/middleware_spec/redirect/test/controller.rb
|
264
268
|
- spec/utopia/controller/rewrite_spec.rb
|
265
269
|
- spec/utopia/controller/sequence_spec.rb
|
266
270
|
- spec/utopia/exception_handler_spec.rb
|
@@ -350,6 +354,8 @@ test_files:
|
|
350
354
|
- spec/utopia/controller/middleware_spec/controller/index.xnode
|
351
355
|
- spec/utopia/controller/middleware_spec/controller/nested/controller.rb
|
352
356
|
- spec/utopia/controller/middleware_spec/empty/controller.rb
|
357
|
+
- spec/utopia/controller/middleware_spec/redirect/controller.rb
|
358
|
+
- spec/utopia/controller/middleware_spec/redirect/test/controller.rb
|
353
359
|
- spec/utopia/controller/rewrite_spec.rb
|
354
360
|
- spec/utopia/controller/sequence_spec.rb
|
355
361
|
- spec/utopia/exception_handler_spec.rb
|