-
Notifications
You must be signed in to change notification settings - Fork 7
/
vanilla.rb
51 lines (42 loc) · 979 Bytes
/
vanilla.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'rubygems'
# In case we haven't upgraded Rubygems yet
unless Kernel.respond_to?(:gem)
def gem(*args)
require_gem(*args)
end
end
gem 'soup', '>= 0.1.4'
require 'soup'
module Vanilla
class MissingSnipException < Exception
end
def self.snip(name)
snip = Soup[name]
if snip.is_a?(Array) && snip.empty?
raise MissingSnipException, "can't find '#{name}'"
end
snip
end
def self.snip_exists?(name)
snip = Soup[name]
if snip.is_a?(Array) && snip.empty?
false
else
true
end
end
end
def dynasnip(*args)
# do nothing
end
def snip(*args)
# do nothing
end
# Load all the other renderer subclasses
Dir[File.join(File.dirname(__FILE__), 'vanilla', 'renderers', '*.rb')].each { |f| require f }
# Load the routing information
require 'vanilla/routes'
# Load all the base dynasnip classes
Dir[File.join(File.dirname(__FILE__), 'vanilla', 'dynasnips', '*.rb')].each do |dynasnip|
require dynasnip
end