tiltout 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +3 -0
- data/Gemfile.lock +24 -0
- data/Rakefile +34 -0
- data/Readme.md +194 -0
- data/lib/tiltout.rb +77 -0
- data/test/tiltout_test.rb +140 -0
- data/tiltout.gemspec +51 -0
- metadata +136 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tiltout (1.0.0)
|
5
|
+
tilt (~> 1.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
metaclass (0.0.1)
|
11
|
+
minitest (2.12.1)
|
12
|
+
mocha (0.12.6)
|
13
|
+
metaclass (~> 0.0.1)
|
14
|
+
rake (0.9.2.2)
|
15
|
+
tilt (1.3.3)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
minitest (~> 2.0)
|
22
|
+
mocha
|
23
|
+
rake (~> 0.9)
|
24
|
+
tiltout!
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# --
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012 Gitorious AS
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
#++
|
25
|
+
require "rake/testtask"
|
26
|
+
require "bundler/gem_tasks"
|
27
|
+
|
28
|
+
Rake::TestTask.new("test") do |test|
|
29
|
+
test.libs << "test"
|
30
|
+
test.pattern = "test/**/*_test.rb"
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :test
|
data/Readme.md
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
# Tiltout
|
2
|
+
|
3
|
+
## Tilt templates with layouts and helpers
|
4
|
+
|
5
|
+
Tiltout is a small abstraction over Tilt that allows you to render templates
|
6
|
+
with some additional conveniences:
|
7
|
+
|
8
|
+
* Layouts
|
9
|
+
* Helper modules
|
10
|
+
* Caching
|
11
|
+
|
12
|
+
## Overview
|
13
|
+
|
14
|
+
Let's say we have a template, `~/projects/tiltout/templates/greet.erb`:
|
15
|
+
|
16
|
+
```rhtml
|
17
|
+
<h1><%= @title = greet("Hey", name) %></h1>
|
18
|
+
```
|
19
|
+
|
20
|
+
And another template, `~/projects/tiltout/templates/layout.erb`:
|
21
|
+
|
22
|
+
```rhtml
|
23
|
+
<!DOCTYPE html>
|
24
|
+
<html>
|
25
|
+
<head>
|
26
|
+
<title><%= @title %></title>
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<%= yield %>
|
30
|
+
</body>
|
31
|
+
</html>
|
32
|
+
```
|
33
|
+
|
34
|
+
Then the following code:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
require "tiltout"
|
38
|
+
|
39
|
+
module Greeter
|
40
|
+
def greet(greeting, name)
|
41
|
+
"#{greeting} #{name}!"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
out = Tiltout.new("~/projects/tiltout/templates", :layout => "layout")
|
46
|
+
out.helper(Greeter, { :name => "Chris" })
|
47
|
+
html = out.render(:greet)
|
48
|
+
```
|
49
|
+
|
50
|
+
Will produce the following HTML:
|
51
|
+
|
52
|
+
```html
|
53
|
+
<!DOCTYPE html>
|
54
|
+
<html>
|
55
|
+
<head>
|
56
|
+
<title>Hey Chris!</title>
|
57
|
+
</head>
|
58
|
+
<body>
|
59
|
+
<h1>Hey Chris!</h1>
|
60
|
+
</body>
|
61
|
+
</html>
|
62
|
+
```
|
63
|
+
|
64
|
+
## Layouts
|
65
|
+
|
66
|
+
`Tiltout` can be instantiated with a default layout that will be used for every
|
67
|
+
template. You can also optionally override the layout for each individual
|
68
|
+
template to render.
|
69
|
+
|
70
|
+
Layouts are rendered with the same context as templates, and are rendered after
|
71
|
+
the template itself. This means that you can set instance variables in the
|
72
|
+
template that can be used in the layout (useful for e.g. extra head data, title
|
73
|
+
etc).
|
74
|
+
|
75
|
+
Templates are included in the layout where the layout `yield`s, e.g.:
|
76
|
+
|
77
|
+
```rhtml
|
78
|
+
<!DOCTYPE html>
|
79
|
+
<html>
|
80
|
+
<head>
|
81
|
+
<title><%= @title %></title>
|
82
|
+
</head>
|
83
|
+
<body>
|
84
|
+
<%= yield %>
|
85
|
+
</body>
|
86
|
+
</html>
|
87
|
+
```
|
88
|
+
|
89
|
+
Given the following template:
|
90
|
+
|
91
|
+
```rhtml
|
92
|
+
<h1><%= @title = "Hey!" %></h1>
|
93
|
+
```
|
94
|
+
|
95
|
+
The following output would be produced:
|
96
|
+
|
97
|
+
```html
|
98
|
+
<!DOCTYPE html>
|
99
|
+
<html>
|
100
|
+
<head>
|
101
|
+
<title>Hey!</title>
|
102
|
+
</head>
|
103
|
+
<body>
|
104
|
+
<h1>Hey!</h1>
|
105
|
+
</body>
|
106
|
+
</html>
|
107
|
+
```
|
108
|
+
|
109
|
+
## Helper modules
|
110
|
+
|
111
|
+
`Tiltout` provides a convenient API for registering modules that are included in
|
112
|
+
the rendering context so you can call the module's methods as "helpers" from
|
113
|
+
your templates:
|
114
|
+
|
115
|
+
```rhtml
|
116
|
+
<!-- greet.erb -->
|
117
|
+
<h1>Hey <%= snake_case(name) %></h1>
|
118
|
+
```
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
require "tiltout"
|
122
|
+
|
123
|
+
module SnakeCaser
|
124
|
+
def snake_case(text)
|
125
|
+
text.gsub(/(.)([A-Z])/,'\1_\2').downcase
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
out = Tiltout.new("path/to/templates")
|
130
|
+
out.helper(SnakeCaser)
|
131
|
+
|
132
|
+
out.render(:greet, { :name => "ChrisJohansen" })
|
133
|
+
#=> "<h1>Hey chris_johansen</h1>"
|
134
|
+
```
|
135
|
+
|
136
|
+
## Caching
|
137
|
+
|
138
|
+
By default, `Tiltout` will cache your templates after reading them from file the
|
139
|
+
first time. If you don't want caching - say because you're actively developing
|
140
|
+
the template - you simply disable it when instantiating your `Tiltout` instance:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
out = Tiltout.new("path/to/templates", :cache => false)
|
144
|
+
```
|
145
|
+
|
146
|
+
## Installing
|
147
|
+
|
148
|
+
`tiltout` ships as a gem:
|
149
|
+
|
150
|
+
$ gem install tiltout
|
151
|
+
|
152
|
+
Or in your Gemfile:
|
153
|
+
|
154
|
+
gem "tiltout", "~> 1.0.0"
|
155
|
+
|
156
|
+
## Contributing
|
157
|
+
|
158
|
+
Contributions are welcome. To get started:
|
159
|
+
|
160
|
+
$ git clone git://gitorious.org/gitorious/tiltout.git
|
161
|
+
$ cd tiltout
|
162
|
+
$ bundle install
|
163
|
+
$ rake
|
164
|
+
|
165
|
+
When you have fixed a bug/added a feature/done your thing, create a
|
166
|
+
[clone on Gitorious](http://gitorious.org/gitorious/tiltout) or a
|
167
|
+
[fork on GitHub](http://github.com/cjohansen/tiltout) and send a
|
168
|
+
merge request/pull request, whichever you prefer.
|
169
|
+
|
170
|
+
Please add tests when adding/altering code, and always make sure all the tests
|
171
|
+
pass before submitting your contribution.
|
172
|
+
|
173
|
+
## License
|
174
|
+
|
175
|
+
### The MIT License (MIT)
|
176
|
+
|
177
|
+
**Copyright (C) 2012 Gitorious AS**
|
178
|
+
|
179
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
180
|
+
this software and associated documentation files (the "Software"), to deal in
|
181
|
+
the Software without restriction, including without limitation the rights to
|
182
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
183
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
184
|
+
subject to the following conditions:
|
185
|
+
|
186
|
+
The above copyright notice and this permission notice shall be included in all
|
187
|
+
copies or substantial portions of the Software.
|
188
|
+
|
189
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
190
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
191
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
192
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
193
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
194
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/tiltout.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# --
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012 Gitorious AS
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
#++
|
25
|
+
require "tilt"
|
26
|
+
|
27
|
+
class Tiltout
|
28
|
+
VERSION = "1.0.0"
|
29
|
+
|
30
|
+
def initialize(template_root, opt = {})
|
31
|
+
@template_root = template_root
|
32
|
+
@cache = {} if !opt.key?(:cache) || opt[:cache]
|
33
|
+
@layout = opt[:layout]
|
34
|
+
@default_type = opt[:default_type] || "erb"
|
35
|
+
@context_class = Class.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def helper(helper)
|
39
|
+
helper = [helper] unless Array === helper
|
40
|
+
helper.each { |h| @context_class.send(:include, h) }
|
41
|
+
end
|
42
|
+
|
43
|
+
def render(template, locals = {}, options = {})
|
44
|
+
context = @context_class.new
|
45
|
+
content = load(template).render(context, locals)
|
46
|
+
layout_tpl = options.key?(:layout) ? options[:layout] : @layout
|
47
|
+
|
48
|
+
if !layout_tpl.nil?
|
49
|
+
content = load(layout_tpl).render(context, locals) { content }
|
50
|
+
end
|
51
|
+
|
52
|
+
content
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def load(name)
|
57
|
+
file_name = find_file(name)
|
58
|
+
return @cache[file_name] if cached?(file_name)
|
59
|
+
template = Tilt.new(file_name)
|
60
|
+
cache(file_name, template)
|
61
|
+
template
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_file(name)
|
65
|
+
full_name = File.join(@template_root, name.to_s)
|
66
|
+
return full_name if cached?(full_name) || File.exists?(full_name)
|
67
|
+
File.join(@template_root, "#{name}.#{@default_type}")
|
68
|
+
end
|
69
|
+
|
70
|
+
def cache(name, template)
|
71
|
+
@cache[name] = template if @cache
|
72
|
+
end
|
73
|
+
|
74
|
+
def cached?(name)
|
75
|
+
@cache && !!@cache[name]
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# --
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012 Gitorious AS
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
#++
|
25
|
+
require "bundler/setup"
|
26
|
+
require "minitest/autorun"
|
27
|
+
require "mocha"
|
28
|
+
require "tiltout"
|
29
|
+
|
30
|
+
module ViewHelper
|
31
|
+
def say_it; "YES"; end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe Tiltout do
|
35
|
+
before { @root = "/dolt/views" }
|
36
|
+
|
37
|
+
it "reads template from file" do
|
38
|
+
File.expects(:read).with("/dolt/views/file.erb").returns("")
|
39
|
+
renderer = Tiltout.new("/dolt/views")
|
40
|
+
renderer.render(:file)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "renders template with locals" do
|
44
|
+
File.stubs(:read).returns("<%= name %>!")
|
45
|
+
renderer = Tiltout.new(@root)
|
46
|
+
|
47
|
+
assert_equal "Chris!", renderer.render(:file, { :name => "Chris"})
|
48
|
+
end
|
49
|
+
|
50
|
+
it "caches template in memory" do
|
51
|
+
renderer = Tiltout.new(@root)
|
52
|
+
File.stubs(:read).returns("Original")
|
53
|
+
renderer.render(:file)
|
54
|
+
File.stubs(:read).returns("Updated")
|
55
|
+
|
56
|
+
assert_equal "Original", renderer.render(:file)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "does not cache template in memory when configured not to" do
|
60
|
+
renderer = Tiltout.new(@root, :cache => false)
|
61
|
+
File.stubs(:read).returns("Original")
|
62
|
+
renderer.render(:file)
|
63
|
+
File.stubs(:read).returns("Updated")
|
64
|
+
|
65
|
+
assert_equal "Updated", renderer.render(:file)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "renders template with layout" do
|
69
|
+
renderer = Tiltout.new("/", :layout => "layout")
|
70
|
+
File.stubs(:read).with("/file.erb").returns("Template")
|
71
|
+
File.stubs(:read).with("/layout.erb").returns("I give you: <%= yield %>")
|
72
|
+
|
73
|
+
assert_equal "I give you: Template", renderer.render(:file)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "renders template once without layout" do
|
77
|
+
renderer = Tiltout.new("/", :layout => "layout")
|
78
|
+
File.stubs(:read).with("/file.erb").returns("Template")
|
79
|
+
File.stubs(:read).with("/layout.erb").returns("I give you: <%= yield %>")
|
80
|
+
|
81
|
+
assert_equal "Template", renderer.render(:file, {}, :layout => nil)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "renders template once with different layout" do
|
85
|
+
renderer = Tiltout.new("/", :layout => "layout")
|
86
|
+
File.stubs(:read).with("/file.erb").returns("Template")
|
87
|
+
File.stubs(:read).with("/layout.erb").returns("I give you: <%= yield %>")
|
88
|
+
File.stubs(:read).with("/layout2.erb").returns("I present you: <%= yield %>")
|
89
|
+
|
90
|
+
html = renderer.render(:file, {}, :layout => "layout2")
|
91
|
+
|
92
|
+
assert_equal "I present you: Template", html
|
93
|
+
end
|
94
|
+
|
95
|
+
it "renders templates of default type" do
|
96
|
+
renderer = Tiltout.new("/", :default_type => :str)
|
97
|
+
File.stubs(:read).with("/file.str").returns("Hey!")
|
98
|
+
|
99
|
+
assert_equal "Hey!", renderer.render(:file)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "renders templates of specific type" do
|
103
|
+
renderer = Tiltout.new("/", :default_type => :lol)
|
104
|
+
File.stubs(:read).with("/file.lol").returns("No!")
|
105
|
+
File.stubs(:read).with("/file.erb").returns("Yes!")
|
106
|
+
File.stubs(:exists?).with("/file.lol").returns(false)
|
107
|
+
File.stubs(:exists?).with("/file.erb").returns(true)
|
108
|
+
|
109
|
+
assert_equal "Yes!", renderer.render("file.erb")
|
110
|
+
end
|
111
|
+
|
112
|
+
it "renders with helper object" do
|
113
|
+
renderer = Tiltout.new("/")
|
114
|
+
renderer.helper(ViewHelper)
|
115
|
+
File.stubs(:read).with("/file.erb").returns("Say it: <%= say_it %>")
|
116
|
+
|
117
|
+
assert_equal "Say it: YES", renderer.render(:file)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "does not leak state across render calls" do
|
121
|
+
renderer = Tiltout.new("/")
|
122
|
+
File.stubs(:read).with("/file.erb").returns(<<-TEMPLATE)
|
123
|
+
<%= @response %><% @response = "NO" %><%= @response %>
|
124
|
+
TEMPLATE
|
125
|
+
|
126
|
+
assert_equal "NO", renderer.render(:file)
|
127
|
+
assert_equal "NO", renderer.render(:file)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "shares state between template and layout" do
|
131
|
+
renderer = Tiltout.new("/", :layout => "layout")
|
132
|
+
File.stubs(:read).with("/file.erb").returns(<<-TEMPLATE)
|
133
|
+
<% @response = "NO" %><h1><%= @response %></h1>
|
134
|
+
TEMPLATE
|
135
|
+
tpl = "<title><%= @response %></title><%= yield %>"
|
136
|
+
File.stubs(:read).with("/layout.erb").returns(tpl)
|
137
|
+
|
138
|
+
assert_equal "<title>NO</title><h1>NO</h1>\n", renderer.render(:file)
|
139
|
+
end
|
140
|
+
end
|
data/tiltout.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# --
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012 Gitorious AS
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
#++
|
25
|
+
dir = File.expand_path(File.dirname(__FILE__))
|
26
|
+
require File.join(dir, "lib/tiltout")
|
27
|
+
|
28
|
+
Gem::Specification.new do |s|
|
29
|
+
s.name = "tiltout"
|
30
|
+
s.version = Tiltout::VERSION
|
31
|
+
s.authors = ["Christian Johansen"]
|
32
|
+
s.email = ["christian@gitorious.org"]
|
33
|
+
s.homepage = "http://gitorious.org/gitorious/tiltout"
|
34
|
+
s.summary = %q{Tilt templates with layouts and helpers}
|
35
|
+
s.description = <<-DESC
|
36
|
+
Tiltout is a small abstraction on top of Tilt that allows you to render
|
37
|
+
templates with optional layouts, share state between layout and template,
|
38
|
+
register helper modules and optionally cache templates.
|
39
|
+
DESC
|
40
|
+
|
41
|
+
s.add_dependency "tilt", "~>1.3"
|
42
|
+
|
43
|
+
s.add_development_dependency "minitest", "~> 2.0"
|
44
|
+
s.add_development_dependency "rake", "~> 0.9"
|
45
|
+
s.add_development_dependency "mocha"
|
46
|
+
|
47
|
+
s.files = `git ls-files`.split("\n")
|
48
|
+
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
49
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
50
|
+
s.require_paths = ["lib"]
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tiltout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Christian Johansen
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-10-05 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: tilt
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 9
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
version: "1.3"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 0
|
48
|
+
version: "2.0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rake
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 25
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 9
|
63
|
+
version: "0.9"
|
64
|
+
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: mocha
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
description: |
|
81
|
+
Tiltout is a small abstraction on top of Tilt that allows you to render
|
82
|
+
templates with optional layouts, share state between layout and template,
|
83
|
+
register helper modules and optionally cache templates.
|
84
|
+
|
85
|
+
email:
|
86
|
+
- christian@gitorious.org
|
87
|
+
executables: []
|
88
|
+
|
89
|
+
extensions: []
|
90
|
+
|
91
|
+
extra_rdoc_files: []
|
92
|
+
|
93
|
+
files:
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- Rakefile
|
97
|
+
- Readme.md
|
98
|
+
- lib/tiltout.rb
|
99
|
+
- test/tiltout_test.rb
|
100
|
+
- tiltout.gemspec
|
101
|
+
has_rdoc: true
|
102
|
+
homepage: http://gitorious.org/gitorious/tiltout
|
103
|
+
licenses: []
|
104
|
+
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 3
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
version: "0"
|
128
|
+
requirements: []
|
129
|
+
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 1.4.2
|
132
|
+
signing_key:
|
133
|
+
specification_version: 3
|
134
|
+
summary: Tilt templates with layouts and helpers
|
135
|
+
test_files: []
|
136
|
+
|