vanilla 1.17 → 1.17.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +21 -7
- data/bin/vanilla +2 -2
- data/lib/vanilla.rb +10 -7
- data/lib/vanilla/app.rb +57 -97
- data/lib/vanilla/config.rb +46 -0
- data/lib/vanilla/console.rb +1 -1
- data/lib/vanilla/renderers/base.rb +12 -2
- data/lib/vanilla/request.rb +9 -34
- data/lib/vanilla/routing.rb +34 -0
- data/lib/vanilla/test_helper.rb +10 -7
- data/pristine_app/Gemfile.lock +35 -0
- data/pristine_app/application.rb +2 -4
- data/pristine_app/public/vanilla.css +299 -9
- data/pristine_app/soups/base/layout.snip +11 -7
- data/pristine_app/soups/base/start.snip +15 -14
- data/pristine_app/soups/system/current_snip.rb +2 -2
- data/pristine_app/soups/system/feed.rb +30 -0
- data/pristine_app/soups/system/index.rb +3 -3
- data/pristine_app/soups/system/link_to.rb +5 -1
- data/pristine_app/soups/system/link_to_current_snip.rb +2 -3
- data/pristine_app/soups/tutorial/tutorial-layout.snip +9 -2
- data/pristine_app/soups/tutorial/tutorial-links.snip +2 -1
- data/pristine_app/soups/tutorial/tutorial-removing.snip.markdown +8 -0
- data/pristine_app/soups/tutorial/tutorial-renderers.snip.markdown +10 -4
- data/pristine_app/soups/tutorial/tutorial.snip.markdown +0 -1
- data/pristine_app/soups/tutorial/vanilla-rb.snip +4 -6
- data/pristine_app/tmp/restart.txt +0 -0
- data/test/core/configuration_test.rb +89 -0
- data/test/{dynasnip_test.rb → core/dynasnip_test.rb} +0 -0
- data/test/{renderers → core/renderers}/base_renderer_test.rb +37 -0
- data/test/{renderers → core/renderers}/erb_renderer_test.rb +0 -0
- data/test/{renderers → core/renderers}/haml_renderer_test.rb +0 -0
- data/test/{renderers → core/renderers}/markdown_renderer_test.rb +0 -0
- data/test/{renderers → core/renderers}/raw_renderer_test.rb +0 -0
- data/test/{renderers → core/renderers}/ruby_renderer_test.rb +0 -0
- data/test/core/routing_test.rb +30 -0
- data/test/{snip_inclusion_test.rb → core/snip_inclusion_test.rb} +0 -0
- data/test/{snip_reference_parser_test.rb → core/snip_reference_parser_test.rb} +0 -0
- data/test/{test_helper.rb → core/test_helper.rb} +5 -4
- data/test/core/vanilla_app_test.rb +51 -0
- data/test/{vanilla_presenting_test.rb → core/vanilla_presenting_test.rb} +15 -1
- data/test/{vanilla_request_test.rb → core/vanilla_request_test.rb} +0 -0
- data/test/pristine_app/current_snip_test.rb +46 -0
- data/test/pristine_app/feed_test.rb +47 -0
- data/test/pristine_app/index_test.rb +34 -0
- data/test/pristine_app/link_to_current_snip_test.rb +11 -0
- data/test/pristine_app/link_to_test.rb +27 -0
- data/test/pristine_app/page_title_test.rb +15 -0
- data/test/pristine_app/raw_test.rb +24 -0
- data/test/pristine_app/test_helper.rb +25 -0
- metadata +83 -42
- data/lib/vanilla/routes.rb +0 -18
- data/test/dynasnips/link_to_current_snip_test.rb +0 -19
- data/test/dynasnips/link_to_test.rb +0 -27
- data/test/dynasnips/page_title_test.rb +0 -19
- data/test/vanilla_app_test.rb +0 -111
@@ -0,0 +1,34 @@
|
|
1
|
+
module Vanilla
|
2
|
+
module Routing
|
3
|
+
|
4
|
+
def url_to(snip_name, part=nil)
|
5
|
+
url = "/#{snip_name.gsub(" ", "+")}"
|
6
|
+
url += "/#{part}" if part
|
7
|
+
url
|
8
|
+
end
|
9
|
+
|
10
|
+
# i.e. / or nothing
|
11
|
+
ROOT = /\A\/?\Z/
|
12
|
+
# i.e. /start, /start.html
|
13
|
+
SNIP = /\A\/([\w\-\s]+)(\/|\.(\w+))?\Z/
|
14
|
+
# i.e. /blah/part, /blah/part.raw
|
15
|
+
SNIP_AND_PART = /\A\/([\w\-\s]+)\/([\w\-\s]+)(\/|\.(\w+))?\Z/
|
16
|
+
|
17
|
+
# Returns an array of three components;
|
18
|
+
# * the snip
|
19
|
+
# * the part
|
20
|
+
# * the format
|
21
|
+
def self.parse(path)
|
22
|
+
case CGI.unescape(path)
|
23
|
+
when ROOT
|
24
|
+
[nil, nil, nil]
|
25
|
+
when SNIP
|
26
|
+
[$1, nil, $3]
|
27
|
+
when SNIP_AND_PART
|
28
|
+
[$1, $2, $4]
|
29
|
+
else
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/vanilla/test_helper.rb
CHANGED
@@ -7,17 +7,16 @@ module Vanilla
|
|
7
7
|
module TestHelper
|
8
8
|
include Rack::Test::Methods
|
9
9
|
|
10
|
-
def app
|
10
|
+
def app(klass=Vanilla.apps.first)
|
11
11
|
unless @__app
|
12
|
-
|
13
|
-
# inject a sandbox soup path first.
|
12
|
+
klass.configure do |config|
|
13
|
+
# inject a sandbox soup path first. This ensures we can write
|
14
|
+
# to the application's soup without actually affecting the
|
15
|
+
# app's content.
|
14
16
|
config.soups ||= []
|
15
17
|
config.soups.unshift test_soup_path
|
16
|
-
# Ensure that the root path is set; this helps with
|
17
|
-
# running tests from different directories
|
18
|
-
config.root_path = File.expand_path("../.", __FILE__)
|
19
18
|
end
|
20
|
-
@__app =
|
19
|
+
@__app = klass.new
|
21
20
|
end
|
22
21
|
@__app
|
23
22
|
end
|
@@ -26,6 +25,10 @@ module Vanilla
|
|
26
25
|
FileUtils.mkdir_p(test_soup_path)
|
27
26
|
end
|
28
27
|
|
28
|
+
def vanilla_reset
|
29
|
+
Vanilla.apps.each { |a| a.reset! }
|
30
|
+
end
|
31
|
+
|
29
32
|
def assert_response_status(expected, uri)
|
30
33
|
get uri
|
31
34
|
assert_equal expected, last_response.status
|
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/james/Code/lazyatom/vanilla-rb
|
3
|
+
specs:
|
4
|
+
vanilla (1.17)
|
5
|
+
BlueCloth (>= 1.0.0)
|
6
|
+
RedCloth (>= 4.1.1)
|
7
|
+
haml (>= 3.1)
|
8
|
+
parslet (>= 1.2.0)
|
9
|
+
rack (>= 0.9.1)
|
10
|
+
rack-test (>= 0.5.7)
|
11
|
+
ratom (>= 0.3.5)
|
12
|
+
soup (>= 1.0.8)
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: http://rubygems.org/
|
16
|
+
specs:
|
17
|
+
BlueCloth (1.0.1)
|
18
|
+
RedCloth (4.2.7)
|
19
|
+
blankslate (2.1.2.4)
|
20
|
+
haml (3.1.1)
|
21
|
+
libxml-ruby (2.0.5)
|
22
|
+
parslet (1.2.0)
|
23
|
+
blankslate (~> 2.0)
|
24
|
+
rack (1.2.2)
|
25
|
+
rack-test (0.5.7)
|
26
|
+
rack (>= 1.0)
|
27
|
+
ratom (0.6.8)
|
28
|
+
libxml-ruby (>= 1.1.2)
|
29
|
+
soup (1.0.8)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
vanilla!
|
data/pristine_app/application.rb
CHANGED
@@ -10,7 +10,7 @@ end
|
|
10
10
|
Application.configure do |config|
|
11
11
|
# The root directory of the application; normally the directory this
|
12
12
|
# file is in.
|
13
|
-
config.
|
13
|
+
config.root = File.dirname(File.expand_path(__FILE__))
|
14
14
|
|
15
15
|
# You can partition your snips into subdirectories to keep things tidy.
|
16
16
|
# This doesn't affect their URL structure on the site (everything is
|
@@ -37,7 +37,5 @@ Application.configure do |config|
|
|
37
37
|
# You can register additional renderer classes, to be used with snips
|
38
38
|
# with the given extensions or 'render_as' attributes
|
39
39
|
#
|
40
|
-
# config.renderers =
|
41
|
-
# :awesome => "My::Custom::RendererClass"
|
42
|
-
# }
|
40
|
+
# config.renderers[:awesome] = My::Custom::RendererClass
|
43
41
|
end
|
@@ -1,19 +1,309 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/* VANILLA CSS
|
2
|
+
|
3
|
+
1. Reset styles
|
4
|
+
2. Misc helpers (clearfix, nice defaults)
|
5
|
+
3. Grid
|
6
|
+
4. Main Layout Elements
|
7
|
+
4.1 Spacing
|
8
|
+
4.2 Colour
|
9
|
+
5. Typography
|
10
|
+
6. Chrome
|
11
|
+
|
12
|
+
--------------------------------------------- */
|
13
|
+
|
14
|
+
|
15
|
+
/* 1. Reset styles
|
16
|
+
--------------------------------------------- */
|
17
|
+
|
18
|
+
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
|
19
|
+
margin: 0;
|
20
|
+
padding: 0;
|
21
|
+
font-size: 100%;
|
22
|
+
vertical-align: baseline;
|
23
|
+
border: 0;
|
24
|
+
outline: 0;
|
25
|
+
background: transparent;
|
3
26
|
}
|
4
27
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
28
|
+
ol, ul {
|
29
|
+
list-style: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
blockquote, q {
|
33
|
+
quotes: none;
|
34
|
+
}
|
35
|
+
|
36
|
+
:focus {
|
37
|
+
outline: 0;
|
38
|
+
}
|
39
|
+
|
40
|
+
table {
|
41
|
+
border-collapse: collapse;
|
42
|
+
border-spacing: 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
/* 2. Misc helpers (clearfix, nice defaults)
|
46
|
+
--------------------------------------------- */
|
47
|
+
|
48
|
+
hr, .hide {
|
49
|
+
display: none;
|
50
|
+
}
|
51
|
+
|
52
|
+
a img {
|
53
|
+
border: none;
|
54
|
+
}
|
55
|
+
|
56
|
+
.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}
|
57
|
+
.clearfix:after{clear:both;content:' ';display:block;font-size:0;line-height:0;visibility:hidden;width:0;height:0}
|
58
|
+
* html .clearfix, *:first-child+html .clearfix { zoom:1 }
|
59
|
+
|
60
|
+
/* 3. Grid
|
61
|
+
--------------------------------------------- */
|
62
|
+
|
63
|
+
/*
|
64
|
+
& Columns : 16
|
65
|
+
& Gutter %: 20%
|
66
|
+
& MinWidth: 960px
|
67
|
+
& MaxWidth: 1080px
|
68
|
+
*/
|
69
|
+
.grid_1 { width: 5%; }
|
70
|
+
.grid_2 { width: 11.25%; }
|
71
|
+
.grid_3 { width: 17.5%; }
|
72
|
+
.grid_4 { width: 23.75%; }
|
73
|
+
.grid_5 { width: 30%; }
|
74
|
+
.grid_6 { width: 36.25%; }
|
75
|
+
.grid_7 { width: 42.5%; }
|
76
|
+
.grid_8 { width: 48.75%; }
|
77
|
+
.grid_9 { width: 55%; }
|
78
|
+
.grid_10 { width: 61.25%; }
|
79
|
+
.grid_11 { width: 67.5%; }
|
80
|
+
.grid_12 { width: 73.75%; }
|
81
|
+
.grid_13 { width: 80%; }
|
82
|
+
.grid_14 { width: 86.25%; }
|
83
|
+
.grid_15 { width: 92.5%; }
|
84
|
+
.grid_16 { width: 98.75%; }
|
85
|
+
|
86
|
+
.grid_1,
|
87
|
+
.grid_2,
|
88
|
+
.grid_3,
|
89
|
+
.grid_4,
|
90
|
+
.grid_5,
|
91
|
+
.grid_6,
|
92
|
+
.grid_7,
|
93
|
+
.grid_8,
|
94
|
+
.grid_9,
|
95
|
+
.grid_10,
|
96
|
+
.grid_11,
|
97
|
+
.grid_12,
|
98
|
+
.grid_13,
|
99
|
+
.grid_14,
|
100
|
+
.grid_15,
|
101
|
+
.grid_16 {
|
102
|
+
margin-left: 0.625%;
|
103
|
+
margin-right: 0.625%;
|
104
|
+
float: left;
|
105
|
+
display: block;
|
106
|
+
}
|
107
|
+
|
108
|
+
.alpha{margin-left:0px;}
|
109
|
+
.omega{margin-right:0px;}
|
110
|
+
|
111
|
+
.container {
|
112
|
+
min-width: 960px;
|
113
|
+
max-width: 1080px;
|
114
|
+
margin: auto;
|
115
|
+
}
|
116
|
+
|
117
|
+
/* 4. Main Layout Elements
|
118
|
+
--------------------------------------------- */
|
119
|
+
|
120
|
+
/* 4.1 Spacing
|
121
|
+
--------------------------------------------- */
|
122
|
+
|
123
|
+
#content {
|
124
|
+
padding-left: 20px;
|
125
|
+
padding-top: 20px;
|
126
|
+
}
|
127
|
+
|
128
|
+
#content p, #content li {
|
129
|
+
padding-right: 20px;
|
130
|
+
}
|
131
|
+
|
132
|
+
/* 4.2 Colour
|
133
|
+
--------------------------------------------- */
|
134
|
+
|
135
|
+
body {
|
136
|
+
color: #333;
|
137
|
+
background: #fff;
|
138
|
+
border-top: 1px solid #333;
|
139
|
+
}
|
140
|
+
|
141
|
+
.container {
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
#content {
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
a {
|
150
|
+
color: #3cb55c;
|
151
|
+
}
|
152
|
+
|
153
|
+
a:hover {
|
154
|
+
color: #205f30;
|
155
|
+
}
|
156
|
+
|
157
|
+
pre {
|
158
|
+
background-color: #332a32;
|
159
|
+
color: #eee;
|
160
|
+
}
|
161
|
+
|
162
|
+
/* 5. Typography
|
163
|
+
--------------------------------------------- */
|
164
|
+
|
165
|
+
body {
|
166
|
+
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif;
|
167
|
+
}
|
168
|
+
|
169
|
+
h1 {
|
170
|
+
font-size: 24px;
|
171
|
+
line-height: 40px;
|
172
|
+
margin-bottom: 20px;
|
173
|
+
}
|
174
|
+
|
175
|
+
h2 {
|
176
|
+
font-size: 20px;
|
177
|
+
line-height: 20px;
|
178
|
+
margin-bottom: 20px;
|
179
|
+
}
|
180
|
+
|
181
|
+
h3 {
|
182
|
+
font-size: 16px;
|
183
|
+
line-height: 40px;
|
184
|
+
}
|
185
|
+
|
186
|
+
p, li, blockquote {
|
187
|
+
font-family: Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
|
188
|
+
font-size: 16px;
|
189
|
+
line-height: 20px;
|
190
|
+
margin-bottom: 20px;
|
191
|
+
}
|
192
|
+
|
193
|
+
ul,
|
194
|
+
ol {
|
195
|
+
margin-bottom: 20px;
|
196
|
+
}
|
197
|
+
|
198
|
+
#content ul, #content ol {
|
199
|
+
margin-bottom: 40px;
|
200
|
+
padding-left: 40px;
|
201
|
+
padding-right: 40px;
|
202
|
+
padding-top: 20px;
|
203
|
+
}
|
204
|
+
|
205
|
+
#content ul {
|
206
|
+
list-style: disc;
|
207
|
+
}
|
208
|
+
|
209
|
+
#content ol {
|
210
|
+
list-style: decimal;
|
211
|
+
}
|
212
|
+
|
213
|
+
strong {
|
214
|
+
font-weight: bold;
|
9
215
|
}
|
10
216
|
|
11
217
|
pre {
|
12
|
-
|
13
|
-
|
14
|
-
|
218
|
+
font-size: 16px;
|
219
|
+
line-height: 20px;
|
220
|
+
margin-bottom: 20px;
|
221
|
+
padding: 20px;
|
222
|
+
}
|
223
|
+
|
224
|
+
tt, code, kbd, samp {
|
225
|
+
font-family: monospace;
|
226
|
+
font-size: 12px;
|
227
|
+
}
|
228
|
+
|
229
|
+
p code {
|
230
|
+
font-size: 14px;
|
231
|
+
}
|
232
|
+
|
233
|
+
a {
|
234
|
+
font-weight: bold;
|
235
|
+
text-decoration: none;
|
236
|
+
}
|
237
|
+
|
238
|
+
/* 6. Chrome
|
239
|
+
--------------------------------------------- */
|
240
|
+
|
241
|
+
#controls {
|
242
|
+
background: #fff;
|
243
|
+
border-bottom: 1px solid #ddd;
|
244
|
+
border-top: 5px solid #f3ea7c;
|
245
|
+
color: #bbb;
|
246
|
+
}
|
247
|
+
|
248
|
+
#controls ul {
|
249
|
+
margin-bottom: 0;
|
250
|
+
}
|
251
|
+
|
252
|
+
#controls li {
|
253
|
+
float: left;
|
254
|
+
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif;
|
255
|
+
font-size: 12px;
|
256
|
+
margin: 0;
|
257
|
+
padding: 10px 20px;
|
15
258
|
}
|
16
259
|
|
17
260
|
.malformed_snip_inclusion {
|
18
261
|
background-color: rgba(180,0,0,0.2);
|
262
|
+
}
|
263
|
+
|
264
|
+
/* 7. Welcome page
|
265
|
+
--------------------------------------------- */
|
266
|
+
|
267
|
+
.container {
|
268
|
+
}
|
269
|
+
|
270
|
+
#welcome {
|
271
|
+
margin-bottom: 40px;
|
272
|
+
border-bottom: 1px solid #ddd;
|
273
|
+
}
|
274
|
+
|
275
|
+
#welcome h1 {
|
276
|
+
font-style: italic;
|
277
|
+
padding-top: 40px;
|
278
|
+
font-size: 40px;
|
279
|
+
font-family: Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
|
280
|
+
line-height: 40px;
|
281
|
+
margin-bottom: 0;
|
282
|
+
}
|
283
|
+
|
284
|
+
#welcome h1 a {
|
285
|
+
font-size: 80px;
|
286
|
+
line-height: 80px;
|
287
|
+
display: block;
|
288
|
+
font-style: normal;
|
289
|
+
border-bottom: 4px solid #f3ea7c;
|
290
|
+
}
|
291
|
+
|
292
|
+
#welcome p {
|
293
|
+
margin-top: 100px;
|
294
|
+
line-height: 40px;
|
295
|
+
font-style: italic;
|
296
|
+
margin-bottom: 0;
|
297
|
+
font-size: 20px;
|
298
|
+
}
|
299
|
+
|
300
|
+
#welcome p strong {
|
301
|
+
font-size: 22px;
|
302
|
+
}
|
303
|
+
|
304
|
+
#description p {
|
305
|
+
}
|
306
|
+
|
307
|
+
#description p:first-child {
|
308
|
+
|
19
309
|
}
|
@@ -6,13 +6,17 @@
|
|
6
6
|
<link rel="stylesheet" href="/vanilla.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
|
-
<
|
10
|
-
<
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
<div id="controls">
|
10
|
+
<ul class="container clearfix">
|
11
|
+
<li><a href="/" class="home">Vanilla.rb</a></li>
|
12
|
+
<li>{link_to index}</li>
|
13
|
+
<li>you are viewing: {link_to_current_snip}</li>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
<div class="container clearfix">
|
17
|
+
<div id="content" class="grid_12 alpha">
|
18
|
+
{current_snip}
|
19
|
+
</div>
|
16
20
|
</div>
|
17
21
|
</body>
|
18
22
|
</html>
|