vanilla 1.17.9 → 1.17.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c3c486da19dbbc056c78f83ba44affb6c6fd5e7e
4
+ data.tar.gz: cad5d237eed4df207bfcd6b9bc7d8feda1a89714
5
+ SHA512:
6
+ metadata.gz: 49be8c6d093636fd561742a6da257fb2706d7f8bf8aa383f074cda252a8b9b4be5ea2215084186995ea42f8679579d6f45e6e9b8bd7973df61d122726299bd0c
7
+ data.tar.gz: 57aa8e6f6ae4979befe5d3282aad9d7db7642dc1c539ff9b9d1b27e7f25f1018ee14dd33c80877bf3db04d175a590e8f0cc42fde31285d2142d04932ee03e479
data/lib/vanilla.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Vanilla
2
- VERSION = "1.17.9"
2
+ VERSION = "1.17.10"
3
3
 
4
4
  autoload :Renderers, "vanilla/renderers"
5
5
  autoload :App, "vanilla/app"
data/lib/vanilla/app.rb CHANGED
@@ -27,7 +27,7 @@ module Vanilla
27
27
 
28
28
  def initialize
29
29
  @renderers = Hash.new { config.default_renderer }
30
- @soup = prepare_soup
30
+ @soup = config.soup || prepare_soup
31
31
  prepare_renderers
32
32
  end
33
33
 
@@ -3,7 +3,7 @@ require "vanilla"
3
3
  module Vanilla
4
4
 
5
5
  # Create a new Vanilla application
6
- # Configuration options:
6
+ # Configuration options include:
7
7
  #
8
8
  # :soup - provide the path to the soup data
9
9
  # :soups - provide an array of paths to soup data
@@ -17,32 +17,36 @@ module Vanilla
17
17
  # :root_snip - the snip to load for the root ('/') url;
18
18
  # defaults to 'start'
19
19
  class Config
20
- attr_accessor :root,
21
- :root_snip,
22
- :soups,
23
- :renderers,
24
- :default_layout_snip,
25
- :default_renderer,
26
- :raise_errors
27
-
28
20
  def initialize
29
- @root = Dir.pwd
30
- @root_snip = "start"
31
- @soups = ["soups/base", "soups/system"]
32
- @default_layout_snip = "layout"
33
- @default_renderer = Vanilla::Renderers::Base
34
- @raise_errors = false
35
- @renderers = {
36
- "base" => Vanilla::Renderers::Base,
37
- "markdown" => Vanilla::Renderers::Markdown,
38
- "bold" => Vanilla::Renderers::Bold,
39
- "erb" => Vanilla::Renderers::Erb,
40
- "rb" => Vanilla::Renderers::Ruby,
41
- "ruby" => Vanilla::Renderers::Ruby,
42
- "haml" => Vanilla::Renderers::Haml,
43
- "raw" => Vanilla::Renderers::Raw,
44
- "textile" => Vanilla::Renderers::Textile
21
+ @attributes = {
22
+ :root => Dir.pwd,
23
+ :root_snip => "start",
24
+ :soup => nil,
25
+ :soups => ["soups/base", "soups/system"],
26
+ :default_layout_snip => "layout",
27
+ :default_renderer => Vanilla::Renderers::Base,
28
+ :raise_errors => false,
29
+ :renderers => {
30
+ "base" => Vanilla::Renderers::Base,
31
+ "markdown" => Vanilla::Renderers::Markdown,
32
+ "bold" => Vanilla::Renderers::Bold,
33
+ "erb" => Vanilla::Renderers::Erb,
34
+ "rb" => Vanilla::Renderers::Ruby,
35
+ "ruby" => Vanilla::Renderers::Ruby,
36
+ "haml" => Vanilla::Renderers::Haml,
37
+ "raw" => Vanilla::Renderers::Raw,
38
+ "textile" => Vanilla::Renderers::Textile
39
+ }
45
40
  }
46
41
  end
42
+
43
+ def method_missing(method, value=nil)
44
+ attribute_name = method.to_s.gsub(/=$/, '').to_sym
45
+ if method =~ /=$/
46
+ @attributes[attribute_name] = value
47
+ else
48
+ @attributes[attribute_name]
49
+ end
50
+ end
47
51
  end
48
- end
52
+ end
@@ -36,7 +36,7 @@ module Vanilla
36
36
  end
37
37
 
38
38
  def self.snip_regexp
39
- %r{(\{[\w\-_\d\.\"\' ]+( +[^\}.]+)?\})}
39
+ %r|(\{[\w\-_\d\.\"\' ]+( +[^\}]+)?\})|
40
40
  end
41
41
 
42
42
  def default_layout_snip
@@ -116,4 +116,4 @@ module Vanilla
116
116
  end
117
117
  end
118
118
  end
119
- end
119
+ end
@@ -3,6 +3,8 @@ require "parslet"
3
3
 
4
4
  module Vanilla
5
5
  class SnipReferenceParser
6
+ class ParseError < RuntimeError; end
7
+
6
8
  class Reference
7
9
  def initialize(attributes)
8
10
  @attributes = attributes
@@ -20,6 +22,8 @@ module Vanilla
20
22
 
21
23
  def parse(string)
22
24
  Reference.new(SnipTransform.new.apply(SnipParser.new.parse(string)))
25
+ rescue Parslet::ParseFailed
26
+ raise ParseError
23
27
  end
24
28
 
25
29
  class SnipParser < Parslet::Parser
@@ -61,4 +61,4 @@ module Vanilla
61
61
  app.stubs(:soup).returns(stub_soup(*snips))
62
62
  end
63
63
  end
64
- end
64
+ end
@@ -132,7 +132,7 @@ context "An atom feed" do
132
132
  stub_app_soup({:name => "x", :content => "y", :updated_at => Time.parse("2011-01-01 12:23 +0000").to_s})
133
133
 
134
134
  feed_xml = app.atom_feed(:domain => "whatever", :snips => [app.soup["x"]]).to_s
135
- assert_match %r{2011\-01\-01T12\:23\:00\+00\:00}, feed_xml
135
+ assert_match %r{2011\-01\-01T\d{2}\:23\:00[\+\-]\d{2}\:\d{2}}, feed_xml
136
136
  end
137
137
 
138
138
  should "work even without any snips" do
@@ -71,6 +71,19 @@ context "Configuring a Vanilla app" do
71
71
  end
72
72
  end
73
73
 
74
+ context "with a specific soup" do
75
+ setup do
76
+ @custom_soup = stub('custom soup')
77
+ TestConfigurationApp.configure do |c|
78
+ c.soup = @custom_soup
79
+ end
80
+ end
81
+
82
+ should "use only the specified soup" do
83
+ assert_equal @custom_soup, TestConfigurationApp.new.soup
84
+ end
85
+ end
86
+
74
87
  context "with new renderers" do
75
88
  should "load new renderer constants presented as a string" do
76
89
  class ::MyRenderer
@@ -90,4 +103,4 @@ context "Configuring a Vanilla app" do
90
103
  assert_equal Vanilla::Renderers::Bold, TestConfigurationApp.new.renderer_for(snip)
91
104
  end
92
105
  end
93
- end
106
+ end
@@ -32,6 +32,11 @@ context "When including snips in other snips" do
32
32
  assert_equal "rendering snip content", render("rendering {test1}")
33
33
  end
34
34
 
35
+ should "match snips with dots in their arguments" do
36
+ create_snip :name => "test", :content => "dot arguments"
37
+ assert_equal %{allow dot arguments}, render(%|allow {test "allow but ignore this argument..."}|)
38
+ end
39
+
35
40
  should "match snips with ruby 1.9 style hashes" do
36
41
  create_snip :name => "test", :content => %{
37
42
  class Blah
@@ -63,4 +68,4 @@ context "When including snips in other snips" do
63
68
  snip = create_snip :name => "test-content", :content => content
64
69
  Vanilla::Renderers::Base.new(app).render(snip)
65
70
  end
66
- end
71
+ end
@@ -112,6 +112,12 @@ context "The SnipReference parser" do
112
112
  end
113
113
  end
114
114
 
115
+ should "raise a ParseError if the snip reference was malformed" do
116
+ assert_raises Vanilla::SnipReferenceParser::ParseError do
117
+ @parser.parse('{s "}')
118
+ end
119
+ end
120
+
115
121
  private
116
122
 
117
123
  def assert_parsable_by_vanilla(example, expected)
metadata CHANGED
@@ -1,222 +1,195 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.9
5
- prerelease:
4
+ version: 1.17.10
6
5
  platform: ruby
7
6
  authors:
8
7
  - James Adam
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-26 00:00:00.000000000 Z
11
+ date: 2014-06-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.9.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.9.1
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: soup
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 1.0.11
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: 1.0.11
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: ratom
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.3.5
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.3.5
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: RedCloth
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: 4.1.1
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: 4.1.1
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: BlueCloth
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: 1.0.0
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: 1.0.0
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: haml
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '3.1'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '3.1'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: parslet
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: 1.2.0
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: 1.2.0
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rack-test
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - ">="
132
116
  - !ruby/object:Gem::Version
133
117
  version: 0.5.7
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - ">="
140
123
  - !ruby/object:Gem::Version
141
124
  version: 0.5.7
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rake
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - ">="
148
130
  - !ruby/object:Gem::Version
149
131
  version: 0.9.1
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - ">="
156
137
  - !ruby/object:Gem::Version
157
138
  version: 0.9.1
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: kintama
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - ">="
164
144
  - !ruby/object:Gem::Version
165
145
  version: 0.1.11
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - ">="
172
151
  - !ruby/object:Gem::Version
173
152
  version: 0.1.11
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: mocha
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - ">="
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0'
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ! '>='
164
+ - - ">="
188
165
  - !ruby/object:Gem::Version
189
166
  version: '0'
190
167
  - !ruby/object:Gem::Dependency
191
168
  name: capybara
192
169
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
170
  requirements:
195
- - - ! '>='
171
+ - - ">="
196
172
  - !ruby/object:Gem::Version
197
173
  version: '0'
198
174
  type: :development
199
175
  prerelease: false
200
176
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
177
  requirements:
203
- - - ! '>='
178
+ - - ">="
204
179
  - !ruby/object:Gem::Version
205
180
  version: '0'
206
181
  - !ruby/object:Gem::Dependency
207
182
  name: launchy
208
183
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
184
  requirements:
211
- - - ! '>='
185
+ - - ">="
212
186
  - !ruby/object:Gem::Version
213
187
  version: '0'
214
188
  type: :development
215
189
  prerelease: false
216
190
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
191
  requirements:
219
- - - ! '>='
192
+ - - ">="
220
193
  - !ruby/object:Gem::Version
221
194
  version: '0'
222
195
  description:
@@ -227,40 +200,17 @@ extensions: []
227
200
  extra_rdoc_files:
228
201
  - README
229
202
  files:
230
- - Rakefile
203
+ - ".gemtest"
231
204
  - README
232
- - .gemtest
233
- - test/core/atom_feed_test.rb
234
- - test/core/configuration_test.rb
235
- - test/core/dynasnip_test.rb
236
- - test/core/renderers/base_renderer_test.rb
237
- - test/core/renderers/erb_renderer_test.rb
238
- - test/core/renderers/haml_renderer_test.rb
239
- - test/core/renderers/markdown_renderer_test.rb
240
- - test/core/renderers/raw_renderer_test.rb
241
- - test/core/renderers/ruby_renderer_test.rb
242
- - test/core/routing_test.rb
243
- - test/core/snip_inclusion_test.rb
244
- - test/core/snip_reference_parser_test.rb
245
- - test/core/test_helper.rb
246
- - test/core/vanilla_app_test.rb
247
- - test/core/vanilla_presenting_test.rb
248
- - test/core/vanilla_request_test.rb
249
- - test/pristine_app/current_snip_test.rb
250
- - test/pristine_app/feed_test.rb
251
- - test/pristine_app/index_test.rb
252
- - test/pristine_app/link_to_current_snip_test.rb
253
- - test/pristine_app/link_to_test.rb
254
- - test/pristine_app/page_title_test.rb
255
- - test/pristine_app/raise_errors_test.rb
256
- - test/pristine_app/raw_test.rb
257
- - test/pristine_app/site_test.rb
258
- - test/pristine_app/test_helper.rb
205
+ - Rakefile
206
+ - bin/vanilla
207
+ - lib/vanilla.rb
259
208
  - lib/vanilla/app.rb
260
209
  - lib/vanilla/atom_feed.rb
261
210
  - lib/vanilla/config.rb
262
211
  - lib/vanilla/console.rb
263
212
  - lib/vanilla/dynasnip.rb
213
+ - lib/vanilla/renderers.rb
264
214
  - lib/vanilla/renderers/base.rb
265
215
  - lib/vanilla/renderers/bold.rb
266
216
  - lib/vanilla/renderers/erb.rb
@@ -269,19 +219,16 @@ files:
269
219
  - lib/vanilla/renderers/raw.rb
270
220
  - lib/vanilla/renderers/ruby.rb
271
221
  - lib/vanilla/renderers/textile.rb
272
- - lib/vanilla/renderers.rb
273
222
  - lib/vanilla/request.rb
274
223
  - lib/vanilla/routing.rb
275
224
  - lib/vanilla/snip_reference_parser.rb
276
225
  - lib/vanilla/static.rb
277
226
  - lib/vanilla/test_helper.rb
278
- - lib/vanilla.rb
279
- - bin/vanilla
227
+ - pristine_app/Gemfile
228
+ - pristine_app/README
280
229
  - pristine_app/application.rb
281
230
  - pristine_app/config.ru
282
- - pristine_app/Gemfile
283
231
  - pristine_app/public/vanilla.css
284
- - pristine_app/README
285
232
  - pristine_app/soups/base/feed.rb
286
233
  - pristine_app/soups/base/layout.snip
287
234
  - pristine_app/soups/base/start.snip
@@ -314,36 +261,55 @@ files:
314
261
  - pristine_app/soups/tutorial/tutorial.snip.markdown
315
262
  - pristine_app/soups/tutorial/vanilla-rb.snip
316
263
  - pristine_app/soups/tutorial/vanilla.snip
264
+ - test/core/atom_feed_test.rb
265
+ - test/core/configuration_test.rb
266
+ - test/core/dynasnip_test.rb
267
+ - test/core/renderers/base_renderer_test.rb
268
+ - test/core/renderers/erb_renderer_test.rb
269
+ - test/core/renderers/haml_renderer_test.rb
270
+ - test/core/renderers/markdown_renderer_test.rb
271
+ - test/core/renderers/raw_renderer_test.rb
272
+ - test/core/renderers/ruby_renderer_test.rb
273
+ - test/core/routing_test.rb
274
+ - test/core/snip_inclusion_test.rb
275
+ - test/core/snip_reference_parser_test.rb
276
+ - test/core/test_helper.rb
277
+ - test/core/vanilla_app_test.rb
278
+ - test/core/vanilla_presenting_test.rb
279
+ - test/core/vanilla_request_test.rb
280
+ - test/pristine_app/current_snip_test.rb
281
+ - test/pristine_app/feed_test.rb
282
+ - test/pristine_app/index_test.rb
283
+ - test/pristine_app/link_to_current_snip_test.rb
284
+ - test/pristine_app/link_to_test.rb
285
+ - test/pristine_app/page_title_test.rb
286
+ - test/pristine_app/raise_errors_test.rb
287
+ - test/pristine_app/raw_test.rb
288
+ - test/pristine_app/site_test.rb
289
+ - test/pristine_app/test_helper.rb
317
290
  homepage: http://github.com/lazyatom/vanilla-rb
318
291
  licenses: []
292
+ metadata: {}
319
293
  post_install_message:
320
294
  rdoc_options:
321
- - --main
295
+ - "--main"
322
296
  - README
323
297
  require_paths:
324
298
  - lib
325
299
  required_ruby_version: !ruby/object:Gem::Requirement
326
- none: false
327
300
  requirements:
328
- - - ! '>='
301
+ - - ">="
329
302
  - !ruby/object:Gem::Version
330
303
  version: '0'
331
- segments:
332
- - 0
333
- hash: -2767395045756442534
334
304
  required_rubygems_version: !ruby/object:Gem::Requirement
335
- none: false
336
305
  requirements:
337
- - - ! '>='
306
+ - - ">="
338
307
  - !ruby/object:Gem::Version
339
308
  version: '0'
340
- segments:
341
- - 0
342
- hash: -2767395045756442534
343
309
  requirements: []
344
310
  rubyforge_project: vanilla
345
- rubygems_version: 1.8.23
311
+ rubygems_version: 2.2.2
346
312
  signing_key:
347
- specification_version: 3
313
+ specification_version: 4
348
314
  summary: A bliki-type web content thing.
349
315
  test_files: []