fairytale 0.8.1 → 0.8.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fairytale/helpers.rb +38 -0
- metadata +2 -1
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'erb'
|
3
|
+
require 'tilt'
|
4
|
+
require 'digest/sha1'
|
5
|
+
|
6
|
+
module Fairytale
|
7
|
+
module Helpers
|
8
|
+
def md file, params = {}, &block
|
9
|
+
file = "content/#{file.to_s}" if file.class == Symbol
|
10
|
+
tilt(file, params, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def erb file, params = {}, &block
|
14
|
+
file = "views/#{file.to_s}.erb" if file.class == Symbol
|
15
|
+
tilt(file, params, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def sass file, params = {}, &block
|
19
|
+
file = "public/assets/css/#{file.to_s}.sass" if file.class == Symbol
|
20
|
+
tilt(file, params, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def scss file, params = {}, &block
|
24
|
+
file = "public/assets/css/#{file.to_s}.scss" if file.class == Symbol
|
25
|
+
tilt(file, params, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def tilt file, engine_options = {}, &block
|
29
|
+
engine_options ||= {}
|
30
|
+
template = Tilt.new file.to_s, nil, engine_options
|
31
|
+
template.render(self) { block.call }
|
32
|
+
end
|
33
|
+
|
34
|
+
def md5 file
|
35
|
+
Digest::SHA1.hexdigest File.read(file)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fairytale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.1
|
4
|
+
version: 0.8.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- lib/fairytale.rb
|
22
|
+
- lib/fairytale/helpers.rb
|
22
23
|
homepage: http://rubygems.org/gems/fairytale
|
23
24
|
licenses: []
|
24
25
|
post_install_message:
|