renee-render 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/{renee-render.rb → renee_render.rb} +32 -5
- data/lib/renee_render/version.rb +8 -0
- data/renee-render.gemspec +4 -3
- data/test/test_helper.rb +4 -4
- metadata +31 -15
- data/lib/renee-render/version.rb +0 -6
data/README.md
CHANGED
@@ -2,10 +2,37 @@ require 'tilt'
|
|
2
2
|
require 'callsite'
|
3
3
|
|
4
4
|
# Top-level Renee constant
|
5
|
-
|
5
|
+
module Renee
|
6
6
|
# This module is responsible for handling the rendering of templates
|
7
7
|
# using Tilt supporting all included template engines.
|
8
8
|
module Render
|
9
|
+
def self.included(o)
|
10
|
+
o.extend(ClassMethods)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Class-methods included by this module.
|
14
|
+
module ClassMethods
|
15
|
+
# Gets or sets the views_path for an application.
|
16
|
+
#
|
17
|
+
# @param [String] path The path to the view files.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# views_path("./views") => nil
|
21
|
+
# views_path => "./views"
|
22
|
+
#
|
23
|
+
# @api public
|
24
|
+
def views_path(path = nil)
|
25
|
+
path ? @views_path = path : @views_path
|
26
|
+
end
|
27
|
+
|
28
|
+
# Gets or sets the default encoding used.
|
29
|
+
#
|
30
|
+
# @param [String] encoding The encoding to use. e.g. "utf-8"
|
31
|
+
def default_encoding(encoding = nil)
|
32
|
+
encoding ? @encoding = encoding : @encoding
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
9
36
|
##
|
10
37
|
# Exception responsible for when an expected template does not exist.
|
11
38
|
#
|
@@ -75,7 +102,7 @@ class Renee
|
|
75
102
|
#
|
76
103
|
def inline(data, engine, options = nil, &block)
|
77
104
|
options, engine = engine, nil if engine.is_a?(Hash)
|
78
|
-
call_data = options.delete(:_caller) || Callsite.parse(caller.first)
|
105
|
+
call_data = options && options.delete(:_caller) || Callsite.parse(caller.first)
|
79
106
|
render_setup(engine, options, block) do |view_options, views|
|
80
107
|
body = data.is_a?(Proc) ? data : Proc.new { data }
|
81
108
|
template = Tilt[engine]
|
@@ -88,10 +115,10 @@ class Renee
|
|
88
115
|
def render_setup(engine, options, block)
|
89
116
|
options ||= {}
|
90
117
|
options[:outvar] ||= '@_out_buf'
|
91
|
-
options[:default_encoding] ||=
|
118
|
+
options[:default_encoding] ||= self.class.default_encoding || options[:encoding] || "utf-8"
|
92
119
|
|
93
120
|
locals = options.delete(:locals) || {}
|
94
|
-
views = options.delete(:views) ||
|
121
|
+
views = options.delete(:views) || self.class.views_path || "./views"
|
95
122
|
layout = options.delete(:layout)
|
96
123
|
layout_engine = options.delete(:layout_engine)
|
97
124
|
# TODO suppress template errors for layouts?
|
@@ -140,4 +167,4 @@ class Renee
|
|
140
167
|
@template_cache ||= Tilt::Cache.new
|
141
168
|
end
|
142
169
|
end
|
143
|
-
end
|
170
|
+
end
|
data/renee-render.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("
|
3
|
-
require "
|
2
|
+
$:.push File.expand_path("../../renee-core/lib", __FILE__)
|
3
|
+
require "renee_core/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "renee-render"
|
7
|
-
s.version = Renee::
|
7
|
+
s.version = Renee::Core::VERSION
|
8
8
|
s.authors = ["Josh Hull", "Nathan Esquenazi", "Arthur Chiu"]
|
9
9
|
s.email = ["joshbuddy@gmail.com", "nesquena@gmail.com", "mr.arthur.chiu@gmail.com"]
|
10
10
|
s.homepage = "http://reneerb.com"
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_runtime_dependency 'rack', "~> 1.3.0"
|
22
22
|
s.add_runtime_dependency 'tilt', "~> 1.3.3"
|
23
23
|
s.add_runtime_dependency 'callsite', '~> 0.0.6'
|
24
|
+
s.add_runtime_dependency 'renee-core', "= #{Renee::Core::VERSION}"
|
24
25
|
s.add_development_dependency 'minitest', "~> 2.6.1"
|
25
26
|
s.add_development_dependency 'rake'
|
26
27
|
s.add_development_dependency 'bundler', "~> 1.0.10"
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
$: << File.expand_path('../../../
|
1
|
+
$: << File.expand_path('../../../renee_core/lib', __FILE__)
|
2
2
|
$: << File.expand_path('../../lib', __FILE__)
|
3
|
-
require '
|
4
|
-
require '
|
3
|
+
require 'renee_core'
|
4
|
+
require 'renee_render'
|
5
5
|
|
6
6
|
# TODO better registration method (?)
|
7
|
-
Renee::Core
|
7
|
+
Renee::Core.send(:include, Renee::Render)
|
8
8
|
|
9
9
|
# Load shared test helpers
|
10
10
|
require File.expand_path('../../../lib/test_helper', __FILE__)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renee-render
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Hull
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-10-
|
20
|
+
date: 2011-10-25 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -69,6 +69,22 @@ dependencies:
|
|
69
69
|
name: callsite
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - "="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 19
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 3
|
80
|
+
- 0
|
81
|
+
version: 0.3.0
|
82
|
+
requirement: *id004
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
name: renee-core
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
72
88
|
none: false
|
73
89
|
requirements:
|
74
90
|
- - ~>
|
@@ -79,12 +95,12 @@ dependencies:
|
|
79
95
|
- 6
|
80
96
|
- 1
|
81
97
|
version: 2.6.1
|
82
|
-
requirement: *
|
98
|
+
requirement: *id005
|
83
99
|
type: :development
|
84
100
|
prerelease: false
|
85
101
|
name: minitest
|
86
102
|
- !ruby/object:Gem::Dependency
|
87
|
-
version_requirements: &
|
103
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
88
104
|
none: false
|
89
105
|
requirements:
|
90
106
|
- - ">="
|
@@ -93,12 +109,12 @@ dependencies:
|
|
93
109
|
segments:
|
94
110
|
- 0
|
95
111
|
version: "0"
|
96
|
-
requirement: *
|
112
|
+
requirement: *id006
|
97
113
|
type: :development
|
98
114
|
prerelease: false
|
99
115
|
name: rake
|
100
116
|
- !ruby/object:Gem::Dependency
|
101
|
-
version_requirements: &
|
117
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
102
118
|
none: false
|
103
119
|
requirements:
|
104
120
|
- - ~>
|
@@ -109,12 +125,12 @@ dependencies:
|
|
109
125
|
- 0
|
110
126
|
- 10
|
111
127
|
version: 1.0.10
|
112
|
-
requirement: *
|
128
|
+
requirement: *id007
|
113
129
|
type: :development
|
114
130
|
prerelease: false
|
115
131
|
name: bundler
|
116
132
|
- !ruby/object:Gem::Dependency
|
117
|
-
version_requirements: &
|
133
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
118
134
|
none: false
|
119
135
|
requirements:
|
120
136
|
- - ">="
|
@@ -125,12 +141,12 @@ dependencies:
|
|
125
141
|
- 5
|
126
142
|
- 0
|
127
143
|
version: 0.5.0
|
128
|
-
requirement: *
|
144
|
+
requirement: *id008
|
129
145
|
type: :development
|
130
146
|
prerelease: false
|
131
147
|
name: rack-test
|
132
148
|
- !ruby/object:Gem::Dependency
|
133
|
-
version_requirements: &
|
149
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
134
150
|
none: false
|
135
151
|
requirements:
|
136
152
|
- - ">="
|
@@ -141,7 +157,7 @@ dependencies:
|
|
141
157
|
- 2
|
142
158
|
- 0
|
143
159
|
version: 2.2.0
|
144
|
-
requirement: *
|
160
|
+
requirement: *id009
|
145
161
|
type: :development
|
146
162
|
prerelease: false
|
147
163
|
name: haml
|
@@ -160,8 +176,8 @@ files:
|
|
160
176
|
- .yardopts
|
161
177
|
- README.md
|
162
178
|
- Rakefile
|
163
|
-
- lib/
|
164
|
-
- lib/
|
179
|
+
- lib/renee_render.rb
|
180
|
+
- lib/renee_render/version.rb
|
165
181
|
- renee-render.gemspec
|
166
182
|
- test/render_test.rb
|
167
183
|
- test/test_helper.rb
|