tilt-mote 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/cuba/mote.rb +1 -25
- data/tilt-mote.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dac3da76b83dc8de879d241d34f71d3c9a6bc1c0
|
4
|
+
data.tar.gz: 859072b03170b83e59e53dfb1ce2f51dce2910a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b5aecbf41f1231372cdae9bb0d27511416bffe870f143b633feea2c9d551e5620ec252f86acf2007b405af7f4f1ebb3f1e7560eca467f33a52ae8d0934b174
|
7
|
+
data.tar.gz: 9209f25ef8ad5c4ab538eb2498034870dcd7593941e10b75f656c5890f877abc9204b183aec301b486f0a0e59ceea2f85b108afcad799db8f1f0e6b60ac472f7
|
data/README.md
CHANGED
@@ -24,6 +24,22 @@ template = Tilt.new('dashboard.mote')
|
|
24
24
|
template.render(nil, dashboard: @dashboard)
|
25
25
|
```
|
26
26
|
|
27
|
+
Cuba plugin
|
28
|
+
-----------
|
29
|
+
|
30
|
+
There is a [Cuba](https://github.com/soveran/cuba) minimal plugin you could use.
|
31
|
+
|
32
|
+
```
|
33
|
+
require 'cuba'
|
34
|
+
require 'cuba/render'
|
35
|
+
require 'tilt/mote'
|
36
|
+
|
37
|
+
Cuba.plugin Cuba::Render
|
38
|
+
Cuba.plugin MoteHelper
|
39
|
+
```
|
40
|
+
|
41
|
+
That's it! Now you can use your Mote templates in your Cuba application.
|
42
|
+
|
27
43
|
Installation
|
28
44
|
------------
|
29
45
|
|
data/lib/cuba/mote.rb
CHANGED
@@ -1,31 +1,7 @@
|
|
1
|
-
# borrowed from:
|
2
|
-
# https://github.com/harmoni-io/mote-render/blob/master/lib/mote/render.rb
|
3
1
|
module Mout
|
4
2
|
module Render
|
5
|
-
include ::Mote::Helpers
|
6
|
-
|
7
3
|
def self.setup(app)
|
8
|
-
app.settings[:template_engine] = "mote"
|
9
|
-
end
|
10
|
-
|
11
|
-
def render(template, locals = {}, layout = settings[:render][:layout])
|
12
|
-
res.write(view(template, locals, layout))
|
13
|
-
end
|
14
|
-
|
15
|
-
def view(template, locals = {}, layout = settings[:render][:layout])
|
16
|
-
partial(layout, locals.merge(content: partial(template, locals)))
|
17
|
-
end
|
18
|
-
|
19
|
-
def partial(template, locals = {})
|
20
|
-
mote(mote_path(template), locals.merge(app: self), TOPLEVEL_BINDING)
|
21
|
-
end
|
22
|
-
|
23
|
-
def mote_path(template)
|
24
|
-
if template.end_with?(".mote")
|
25
|
-
template
|
26
|
-
else
|
27
|
-
File.join(settings[:render][:views], "#{template}.mote")
|
28
|
-
end
|
4
|
+
app.settings[:render][:template_engine] = "mote"
|
29
5
|
end
|
30
6
|
end
|
31
7
|
end
|
data/tilt-mote.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "tilt-mote"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.3"
|
8
8
|
spec.authors = ["Horacio Bertorello"]
|
9
9
|
spec.email = ["syrii@msn.com"]
|
10
10
|
spec.summary = "Use Mote templates with Tilt."
|