renee-render 0.3.11 → 0.4.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,16 @@
1
1
  require 'tilt'
2
2
  require 'callsite'
3
3
 
4
+ require 'renee/version'
5
+
4
6
  # Top-level Renee constant
5
7
  module Renee
6
8
  # This module is responsible for handling the rendering of templates
7
9
  # using Tilt supporting all included template engines.
8
10
  module Render
11
+ # Current version of Renee::Render
12
+ VERSION = Renee::VERSION
13
+
9
14
  def self.included(o)
10
15
  o.extend(ClassMethods)
11
16
  end
@@ -0,0 +1,9 @@
1
+ $: << File.expand_path('../../../renee/core/lib', __FILE__)
2
+ $: << File.expand_path('../../lib', __FILE__)
3
+ require 'renee/core'
4
+ require 'renee/render'
5
+
6
+ Renee::Core.send(:include, Renee::Render)
7
+
8
+ # Load shared test helpers
9
+ require File.expand_path('../../test_helper', __FILE__)
data/test/test_helper.rb CHANGED
@@ -1,10 +1,70 @@
1
- $: << File.expand_path('../../../renee_core/lib', __FILE__)
2
- $: << File.expand_path('../../lib', __FILE__)
3
- require 'renee_core'
4
- require 'renee_render'
1
+ require 'rubygems'
2
+ gem 'minitest'
3
+ require 'minitest/autorun'
4
+ gem 'rack-test'
5
+ require 'rack/test'
5
6
 
6
- # TODO better registration method (?)
7
- Renee::Core.send(:include, Renee::Render)
7
+ class ColoredIO
8
+ ESC = "\e["
9
+ NND = "#{ESC}0m"
8
10
 
9
- # Load shared test helpers
10
- require File.expand_path('../../../lib/test_helper', __FILE__)
11
+ def initialize(io)
12
+ @io = io
13
+ end
14
+
15
+ def print(o)
16
+ case o
17
+ when "."
18
+ @io.send(:print, "#{ESC}32m#{o}#{NND}")
19
+ when "E"
20
+ @io.send(:print, "#{ESC}33m#{o}#{NND}")
21
+ when "F"
22
+ @io.send(:print, "#{ESC}31m#{o}#{NND}")
23
+ else
24
+ @io.send(:print, o)
25
+ end
26
+ end
27
+
28
+ def puts(*o)
29
+ super
30
+ end
31
+ end
32
+
33
+ MiniTest::Unit.output = ColoredIO.new(MiniTest::Unit.output)
34
+
35
+ ## TEST HELPERS
36
+ class MiniTest::Spec
37
+ include Rack::Test::Methods
38
+
39
+ # Sets up a Sinatra::Base subclass defined with the block
40
+ # given. Used in setup or individual spec methods to establish
41
+ # the application.
42
+ def mock_app(&block)
43
+ path = default_views_path
44
+ @app = Renee.core(&block).setup {
45
+ views_path(path) if respond_to?(:views_path)
46
+ }
47
+ end
48
+
49
+ def default_views_path
50
+ File.dirname(__FILE__) + "/views"
51
+ end
52
+
53
+ def app
54
+ Rack::Lint.new(@app)
55
+ end
56
+
57
+ alias :response :last_response
58
+
59
+ # create_view :index, "test", :haml
60
+ def create_view(name, content, engine=:erb)
61
+ FileUtils.mkdir_p(default_views_path)
62
+ file = File.join(default_views_path, name.to_s + ".#{engine}")
63
+ File.open(file, 'w') { |io| io.write content }
64
+ end
65
+
66
+ # Removes the view folder after the test
67
+ def remove_views
68
+ FileUtils.rm_rf(File.dirname(__FILE__) + "/views")
69
+ end
70
+ end
metadata CHANGED
@@ -1,218 +1,159 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: renee-render
3
- version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 11
10
- version: 0.3.11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0.pre1
5
+ prerelease: 6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Josh Hull
14
9
  - Nathan Esquenazi
15
10
  - Arthur Chiu
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2011-12-22 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
14
+ date: 2012-01-23 00:00:00.000000000Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rack
18
+ requirement: &70275813623940 !ruby/object:Gem::Requirement
24
19
  none: false
25
- requirements:
20
+ requirements:
26
21
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 27
29
- segments:
30
- - 1
31
- - 3
32
- - 0
22
+ - !ruby/object:Gem::Version
33
23
  version: 1.3.0
34
- requirement: *id001
35
24
  type: :runtime
36
25
  prerelease: false
37
- name: rack
38
- - !ruby/object:Gem::Dependency
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: *70275813623940
27
+ - !ruby/object:Gem::Dependency
28
+ name: tilt
29
+ requirement: &70275813623260 !ruby/object:Gem::Requirement
40
30
  none: false
41
- requirements:
31
+ requirements:
42
32
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 29
45
- segments:
46
- - 1
47
- - 3
48
- - 3
33
+ - !ruby/object:Gem::Version
49
34
  version: 1.3.3
50
- requirement: *id002
51
35
  type: :runtime
52
36
  prerelease: false
53
- name: tilt
54
- - !ruby/object:Gem::Dependency
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
37
+ version_requirements: *70275813623260
38
+ - !ruby/object:Gem::Dependency
39
+ name: callsite
40
+ requirement: &70275813622580 !ruby/object:Gem::Requirement
56
41
  none: false
57
- requirements:
42
+ requirements:
58
43
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 19
61
- segments:
62
- - 0
63
- - 0
64
- - 6
44
+ - !ruby/object:Gem::Version
65
45
  version: 0.0.6
66
- requirement: *id003
67
46
  type: :runtime
68
47
  prerelease: false
69
- name: callsite
70
- - !ruby/object:Gem::Dependency
71
- version_requirements: &id004 !ruby/object:Gem::Requirement
48
+ version_requirements: *70275813622580
49
+ - !ruby/object:Gem::Dependency
50
+ name: renee-core
51
+ requirement: &70275813621860 !ruby/object:Gem::Requirement
72
52
  none: false
73
- requirements:
74
- - - "="
75
- - !ruby/object:Gem::Version
76
- hash: 5
77
- segments:
78
- - 0
79
- - 3
80
- - 11
81
- version: 0.3.11
82
- requirement: *id004
53
+ requirements:
54
+ - - =
55
+ - !ruby/object:Gem::Version
56
+ version: 0.4.0.pre1
83
57
  type: :runtime
84
58
  prerelease: false
85
- name: renee-core
86
- - !ruby/object:Gem::Dependency
87
- version_requirements: &id005 !ruby/object:Gem::Requirement
59
+ version_requirements: *70275813621860
60
+ - !ruby/object:Gem::Dependency
61
+ name: minitest
62
+ requirement: &70275813621140 !ruby/object:Gem::Requirement
88
63
  none: false
89
- requirements:
64
+ requirements:
90
65
  - - ~>
91
- - !ruby/object:Gem::Version
92
- hash: 21
93
- segments:
94
- - 2
95
- - 6
96
- - 1
66
+ - !ruby/object:Gem::Version
97
67
  version: 2.6.1
98
- requirement: *id005
99
68
  type: :development
100
69
  prerelease: false
101
- name: minitest
102
- - !ruby/object:Gem::Dependency
103
- version_requirements: &id006 !ruby/object:Gem::Requirement
70
+ version_requirements: *70275813621140
71
+ - !ruby/object:Gem::Dependency
72
+ name: rake
73
+ requirement: &70275813620600 !ruby/object:Gem::Requirement
104
74
  none: false
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- hash: 3
109
- segments:
110
- - 0
111
- version: "0"
112
- requirement: *id006
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
113
79
  type: :development
114
80
  prerelease: false
115
- name: rake
116
- - !ruby/object:Gem::Dependency
117
- version_requirements: &id007 !ruby/object:Gem::Requirement
81
+ version_requirements: *70275813620600
82
+ - !ruby/object:Gem::Dependency
83
+ name: bundler
84
+ requirement: &70275813620120 !ruby/object:Gem::Requirement
118
85
  none: false
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- hash: 3
123
- segments:
124
- - 0
125
- version: "0"
126
- requirement: *id007
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
127
90
  type: :development
128
91
  prerelease: false
129
- name: bundler
130
- - !ruby/object:Gem::Dependency
131
- version_requirements: &id008 !ruby/object:Gem::Requirement
92
+ version_requirements: *70275813620120
93
+ - !ruby/object:Gem::Dependency
94
+ name: rack-test
95
+ requirement: &70275813619600 !ruby/object:Gem::Requirement
132
96
  none: false
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- hash: 11
137
- segments:
138
- - 0
139
- - 5
140
- - 0
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
141
100
  version: 0.5.0
142
- requirement: *id008
143
101
  type: :development
144
102
  prerelease: false
145
- name: rack-test
146
- - !ruby/object:Gem::Dependency
147
- version_requirements: &id009 !ruby/object:Gem::Requirement
103
+ version_requirements: *70275813619600
104
+ - !ruby/object:Gem::Dependency
105
+ name: haml
106
+ requirement: &70275813619100 !ruby/object:Gem::Requirement
148
107
  none: false
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- hash: 7
153
- segments:
154
- - 2
155
- - 2
156
- - 0
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
157
111
  version: 2.2.0
158
- requirement: *id009
159
112
  type: :development
160
113
  prerelease: false
161
- name: haml
114
+ version_requirements: *70275813619100
162
115
  description: The super-friendly web framework rendering component.
163
- email:
116
+ email:
164
117
  - joshbuddy@gmail.com
165
118
  - nesquena@gmail.com
166
119
  - mr.arthur.chiu@gmail.com
167
120
  executables: []
168
-
169
121
  extensions: []
170
-
171
122
  extra_rdoc_files: []
172
-
173
- files:
174
- - .yardopts
175
- - README.md
176
- - Rakefile
177
- - lib/renee_render.rb
178
- - lib/renee_render/version.rb
179
- - renee-render.gemspec
180
- - test/render_test.rb
123
+ files:
124
+ - lib/renee/render.rb
125
+ - test/renee-render/render_test.rb
126
+ - test/renee-render/test_helper.rb
181
127
  - test/test_helper.rb
182
128
  homepage: http://reneerb.com
183
129
  licenses: []
184
-
185
130
  post_install_message:
186
131
  rdoc_options: []
187
-
188
- require_paths:
132
+ require_paths:
189
133
  - lib
190
- required_ruby_version: !ruby/object:Gem::Requirement
134
+ required_ruby_version: !ruby/object:Gem::Requirement
191
135
  none: false
192
- requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- hash: 3
196
- segments:
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ segments:
197
141
  - 0
198
- version: "0"
199
- required_rubygems_version: !ruby/object:Gem::Requirement
142
+ hash: -1448340385423577995
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
144
  none: false
201
- requirements:
202
- - - ">="
203
- - !ruby/object:Gem::Version
204
- hash: 3
205
- segments:
206
- - 0
207
- version: "0"
145
+ requirements:
146
+ - - ! '>'
147
+ - !ruby/object:Gem::Version
148
+ version: 1.3.1
208
149
  requirements: []
209
-
210
150
  rubyforge_project: renee-render
211
- rubygems_version: 1.8.10
151
+ rubygems_version: 1.8.15
212
152
  signing_key:
213
153
  specification_version: 3
214
154
  summary: The super-friendly web framework rendering component
215
- test_files:
216
- - test/render_test.rb
155
+ test_files:
156
+ - test/renee-render/render_test.rb
157
+ - test/renee-render/test_helper.rb
217
158
  - test/test_helper.rb
218
159
  has_rdoc:
data/.yardopts DELETED
@@ -1,6 +0,0 @@
1
- --output-dir ../../renee-site/public/doc/render
2
- --readme README.md
3
- --no-private
4
- --title Renee Render
5
- --markup markdown
6
- 'lib/**/*.rb'
data/README.md DELETED
@@ -1,38 +0,0 @@
1
- # Renee Render
2
-
3
- Rendering templates in Renee should be familiar and intuitive using the `render` command:
4
-
5
- ```ruby
6
- run Renee.core {
7
- path('blog') do
8
- get { render! "blogs/index", :haml }
9
- end
10
- }
11
- ```
12
-
13
- This above is the standard render syntax, specifying the engine followed by the template. You can also render without specifying an engine:
14
-
15
- ```ruby
16
- path('blog') do
17
- get { render! "blogs/index" }
18
- end
19
- ```
20
-
21
- This will do a lookup in the views path to find the appropriately named template. You can also pass locals and layout options as you would expect:
22
-
23
- ```ruby
24
- path('blog') do
25
- get { render! "blogs/index", :locals => { :foo => "bar" }, :layout => :bar }
26
- end
27
- ```
28
-
29
- This will render the "blogs/index.erb" file if it exists, passing the 'foo' local variable
30
- and wrapping the result in the 'bar.erb' layout file. You can also render without returning the response by using:
31
-
32
- ```ruby
33
- path('blog') do
34
- get { render "blogs/index" }
35
- end
36
- ```
37
-
38
- This allows you to render the content as a string without immediately responding.
data/Rakefile DELETED
@@ -1,13 +0,0 @@
1
- require 'rake/testtask'
2
- require 'yard'
3
-
4
- Rake::TestTask.new do |t|
5
- t.libs.push "lib"
6
- t.test_files = FileList[File.expand_path('../test/**/*_test.rb', __FILE__)]
7
- t.verbose = true
8
- end
9
-
10
- desc "Generate documentation for the Padrino framework"
11
- task :doc do
12
- YARD::CLI::Yardoc.new.run
13
- end
@@ -1,8 +0,0 @@
1
- require 'renee_core/version'
2
-
3
- module Renee
4
- module Render
5
- # The current version of Renee::Render
6
- VERSION = Renee::Core::VERSION
7
- end
8
- end
data/renee-render.gemspec DELETED
@@ -1,30 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../../renee-core/lib", __FILE__)
3
- require "renee_core/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "renee-render"
7
- s.version = Renee::Core::VERSION
8
- s.authors = ["Josh Hull", "Nathan Esquenazi", "Arthur Chiu"]
9
- s.email = ["joshbuddy@gmail.com", "nesquena@gmail.com", "mr.arthur.chiu@gmail.com"]
10
- s.homepage = "http://reneerb.com"
11
- s.summary = %q{The super-friendly web framework rendering component}
12
- s.description = %q{The super-friendly web framework rendering component.}
13
-
14
- s.rubyforge_project = "renee-render"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
-
21
- s.add_runtime_dependency 'rack', "~> 1.3.0"
22
- s.add_runtime_dependency 'tilt', "~> 1.3.3"
23
- s.add_runtime_dependency 'callsite', '~> 0.0.6'
24
- s.add_runtime_dependency 'renee-core', "#{Renee::Core::VERSION}"
25
- s.add_development_dependency 'minitest', "~> 2.6.1"
26
- s.add_development_dependency 'rake'
27
- s.add_development_dependency 'bundler'
28
- s.add_development_dependency "rack-test", ">= 0.5.0"
29
- s.add_development_dependency "haml", ">= 2.2.0"
30
- end