styledown2-rails 2.0.0.pre7 → 2.0.0.pre9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06ba67444ac0ab006d97483b272b4dce0d293483
|
4
|
+
data.tar.gz: 4377e0ad6da9afb78bee6e0a1bd15260c5c454d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a628cbba5ccc21aeea4e01c53336eafd31575cd9497af9fa3519ad853ae0b9953d3aaa137788937aa2538647ae2378252cc81d684b81a469458827c21cd8391
|
7
|
+
data.tar.gz: 37d67135b5d1541d8e054ce0be2f1e84fb4560cbeee69b15b7ed72bbad6b26764436b79bc4f8d4a5fa43a054efa9a68859b8290449a6ad18f07c5fe73fe63703
|
data/lib/styledown/rails.rb
CHANGED
@@ -56,7 +56,10 @@ class Styledown
|
|
56
56
|
reload
|
57
57
|
file = instance.output[page]
|
58
58
|
|
59
|
-
|
59
|
+
unless file
|
60
|
+
raise ActionController::RoutingError,
|
61
|
+
"No file '#{page}' in styleguides"
|
62
|
+
end
|
60
63
|
controller.render body: file['contents'], content_type: file['type']
|
61
64
|
end
|
62
65
|
|
@@ -114,9 +117,12 @@ class Styledown
|
|
114
117
|
# Don't use request.path, because that will always be missing a trailing slash.
|
115
118
|
path = controller.request.env['REQUEST_PATH']
|
116
119
|
|
120
|
+
# Rack::Test doesn't seem to set REQUEST_PATH
|
121
|
+
path ||= controller.request.env['REQUEST_URI']
|
122
|
+
|
117
123
|
# Check if there's no page and no trailing slash (eg, /styleguides and not
|
118
124
|
# /styleguides/ or /styleguides/foo)
|
119
|
-
if !controller.params[:page] && path[-1] != '/'
|
125
|
+
if !controller.params[:page] && path && path[-1] != '/'
|
120
126
|
controller.redirect_to "#{path}/"
|
121
127
|
true
|
122
128
|
end
|