sinatra-content-for2 0.2.4 → 0.3.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -3
- data/.rspec +1 -0
- data/Gemfile +6 -0
- data/Rakefile +35 -0
- data/lib/sinatra/content_for2.rb +111 -68
- data/lib/sinatra/content_for2/base_handler.rb +33 -0
- data/lib/sinatra/content_for2/erb_handler.rb +37 -0
- data/lib/sinatra/content_for2/haml_handler.rb +21 -0
- data/lib/sinatra/content_for2/slim_handler.rb +48 -0
- data/lib/sinatra/content_for2/version.rb +6 -0
- data/sinatra-content-for2.gemspec +24 -17
- data/spec/lib/sinatra/content_for2_spec.rb +43 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/templates/main.erb +3 -0
- data/spec/templates/main.haml +3 -0
- data/spec/templates/sub.erb +3 -0
- data/spec/templates/sub.haml +3 -0
- metadata +133 -17
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-c -f progress -r ./spec/spec_helper.rb
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
rescue LoadError
|
6
|
+
$stderr.puts "Please install bundler with: gem install bundler"
|
7
|
+
end
|
8
|
+
|
9
|
+
$LOAD_PATH << File.expand_path('../lib', __FILE__)
|
10
|
+
require "sinatra/content_for2/version"
|
11
|
+
|
12
|
+
desc "Default: run all specs"
|
13
|
+
task :default => :spec
|
14
|
+
|
15
|
+
begin
|
16
|
+
require 'rspec/core/rake_task'
|
17
|
+
|
18
|
+
RSpec::Core::RakeTask.new
|
19
|
+
rescue LoadError
|
20
|
+
$stderr.puts "Please install RSpec 2"
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
require 'yard'
|
25
|
+
YARD::Rake::YardocTask.new do |t|
|
26
|
+
t.options = ['--title', "Sinatra::ContentFor2 #{Sinatra::ContentFor2::VERSION}"]
|
27
|
+
if defined?(Encoding)
|
28
|
+
t.options << '--charset'
|
29
|
+
t.options << 'utf-8'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
$stderr.puts "Yard is not installed. Please run gem install yard"
|
34
|
+
end
|
35
|
+
|
data/lib/sinatra/content_for2.rb
CHANGED
@@ -1,79 +1,122 @@
|
|
1
1
|
module Sinatra
|
2
2
|
module ContentFor2
|
3
|
-
|
4
|
-
|
5
|
-
# <% content_for :head do %>
|
6
|
-
# <script type="text/javascript" src="/foo.js"></script>
|
7
|
-
# <% end %>
|
8
|
-
#
|
9
|
-
# You can call +content_for+ multiple times with the same key
|
10
|
-
# (in the example +:head+), and when you render the blocks for
|
11
|
-
# that key all of them will be rendered, in the same order you
|
12
|
-
# captured them.
|
13
|
-
#
|
14
|
-
# Your blocks can also receive values, which are passed to them
|
15
|
-
# by <tt>yield_content</tt>
|
16
|
-
def content_for(key, &block)
|
17
|
-
content_blocks[key.to_sym] << block if block_given?
|
3
|
+
def self.included(base) #:nodoc:
|
4
|
+
base.send(:include, CurrentTemplateEngine) unless base.method_defined?(:current_template_engine)
|
18
5
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# <% end %>
|
30
|
-
def content_for?(key)
|
31
|
-
content_blocks[key.to_sym].any?
|
6
|
+
|
7
|
+
module CurrentTemplateEngine
|
8
|
+
attr_reader :current_template_engine
|
9
|
+
|
10
|
+
def render(engine, *) #:nodoc:
|
11
|
+
@current_template_engine, engine_was = engine, @current_template_engine
|
12
|
+
output = super
|
13
|
+
@current_template_engine = engine_was
|
14
|
+
output
|
15
|
+
end
|
32
16
|
end
|
17
|
+
end
|
18
|
+
end
|
33
19
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
#
|
49
|
-
# Would pass <tt>1</tt> and <tt>2</tt> to all the blocks registered
|
50
|
-
# for <tt>:head</tt>.
|
51
|
-
#
|
52
|
-
# *NOTICE* that you call this without an <tt>=</tt> sign. IE,
|
53
|
-
# in a <tt><% %></tt> block, and not in a <tt><%= %></tt> block.
|
54
|
-
#
|
55
|
-
# *NOTICE*
|
56
|
-
# if you call from erubis, you call this with <tt>=</tt> sign.IE,
|
57
|
-
#in a <tt><%= %></tt> block, and not in a <tt><% %></tt> block.
|
58
|
-
def yield_content(key, *args)
|
59
|
-
content_blocks[key.to_sym].map do |content|
|
60
|
-
if respond_to?(:block_is_haml?) && block_is_haml?(content)
|
61
|
-
capture_haml(*args, &content)
|
62
|
-
elsif defined?(Erubis)
|
63
|
-
content.binding.eval ' _buf = "" '
|
64
|
-
content.call(*args)
|
65
|
-
else
|
66
|
-
content.call
|
67
|
-
end
|
68
|
-
end.join
|
20
|
+
require 'sinatra/content_for2/base_handler'
|
21
|
+
require 'sinatra/content_for2/erb_handler'
|
22
|
+
require 'sinatra/content_for2/haml_handler'
|
23
|
+
require 'sinatra/content_for2/slim_handler'
|
24
|
+
|
25
|
+
module Sinatra::ContentFor2
|
26
|
+
def capture_html(*args, &block)
|
27
|
+
handler = find_proper_handler
|
28
|
+
captured_html = nil
|
29
|
+
if handler && handler.is_type? && handler.block_is_type?(block)
|
30
|
+
captured_html = handler.capture_from_template(*args, &block)
|
31
|
+
end
|
32
|
+
if captured_html.nil? && block_given?
|
33
|
+
captured_html = block.call(*args)
|
69
34
|
end
|
35
|
+
captured_html || ''
|
36
|
+
end
|
70
37
|
|
71
|
-
|
38
|
+
# Capture a block of content to be rendered later. For example:
|
39
|
+
#
|
40
|
+
# <% content_for :head do %>
|
41
|
+
# <script type="text/javascript" src="/foo.js"></script>
|
42
|
+
# <% end %>
|
43
|
+
#
|
44
|
+
# You can call +content_for+ multiple times with the same key
|
45
|
+
# (in the example +:head+), and when you render the blocks for
|
46
|
+
# that key all of them will be rendered, in the same order you
|
47
|
+
# captured them.
|
48
|
+
#
|
49
|
+
# Your blocks can also receive values, which are passed to them
|
50
|
+
# by <tt>yield_content</tt>
|
51
|
+
def content_for(key, content = nil, &block)
|
52
|
+
key = key.to_sym
|
53
|
+
unless content.nil?
|
54
|
+
content_blocks[key] << content
|
55
|
+
end
|
56
|
+
if block_given?
|
57
|
+
content_blocks[key] << block
|
58
|
+
end
|
59
|
+
''
|
60
|
+
end
|
61
|
+
|
62
|
+
# Check if a block of content with the given key was defined. For
|
63
|
+
# example:
|
64
|
+
#
|
65
|
+
# <% content_for :head do %>
|
66
|
+
# <script type="text/javascript" src="/foo.js"></script>
|
67
|
+
# <% end %>
|
68
|
+
#
|
69
|
+
# <% if content_for? :head %>
|
70
|
+
# <span>content "head" was defined.</span>
|
71
|
+
# <% end %>
|
72
|
+
def content_for?(key)
|
73
|
+
content_blocks[key.to_sym].any?
|
74
|
+
end
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
+
# Render the captured blocks for a given key. For example:
|
77
|
+
#
|
78
|
+
# <head>
|
79
|
+
# <title>Example</title>
|
80
|
+
# <% yield_content :head %>
|
81
|
+
# </head>
|
82
|
+
#
|
83
|
+
# Would render everything you declared with <tt>content_for
|
84
|
+
# :head</tt> before closing the <tt><head></tt> tag.
|
85
|
+
#
|
86
|
+
# You can also pass values to the content blocks by passing them
|
87
|
+
# as arguments after the key:
|
88
|
+
#
|
89
|
+
# <% yield_content :head, 1, 2 %>
|
90
|
+
#
|
91
|
+
# Would pass <tt>1</tt> and <tt>2</tt> to all the blocks registered
|
92
|
+
# for <tt>:head</tt>.
|
93
|
+
#
|
94
|
+
# *NOTICE* that you call this without an <tt>=</tt> sign. IE,
|
95
|
+
# in a <tt><% %></tt> block, and not in a <tt><%= %></tt> block.
|
96
|
+
#
|
97
|
+
# *NOTICE*
|
98
|
+
# if you call from erubis, you call this with <tt>=</tt> sign.IE,
|
99
|
+
#in a <tt><%= %></tt> block, and not in a <tt><% %></tt> block.
|
100
|
+
def yield_content(key, *args)
|
101
|
+
blocks = content_blocks[key.to_sym]
|
102
|
+
return nil if blocks.empty?
|
103
|
+
blocks.map do |block|
|
104
|
+
block.kind_of?(Proc) ? capture_html(*args, &block) : block.to_s
|
105
|
+
end.join('')
|
106
|
+
end
|
107
|
+
|
108
|
+
protected
|
109
|
+
def content_blocks
|
110
|
+
@content_blocks ||= Hash.new { |h, k| h[k] = [] }
|
111
|
+
end
|
112
|
+
|
113
|
+
def find_proper_handler
|
114
|
+
Sinatra::ContentFor2::BaseHandler.classes.map do |handlerClass|
|
115
|
+
handlerClass.new(self)
|
116
|
+
end.find do |handler|
|
117
|
+
handler.engines.include?(current_template_engine) && handler.is_type?
|
118
|
+
end
|
76
119
|
end
|
77
120
|
|
78
|
-
helpers ContentFor2
|
79
121
|
end
|
122
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Sinatra::ContentFor2::BaseHandler
|
2
|
+
class << self
|
3
|
+
def classes
|
4
|
+
@classes ||= []
|
5
|
+
end
|
6
|
+
|
7
|
+
def register(handlerClass)
|
8
|
+
classes << handlerClass
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :template
|
13
|
+
|
14
|
+
def initialize(template)
|
15
|
+
@template = template
|
16
|
+
end
|
17
|
+
|
18
|
+
def engines
|
19
|
+
raise NotImplementedError.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def is_type?
|
23
|
+
raise NotImplementedError.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def block_is_type?(block)
|
27
|
+
raise NotImplementedError.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def capture_from_template(*args, &block)
|
31
|
+
raise NotImplementedError.new
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Sinatra::ContentFor2::ErbHandler < Sinatra::ContentFor2::BaseHandler
|
2
|
+
attr_reader :output_buffer
|
3
|
+
|
4
|
+
def initialize(template)
|
5
|
+
super
|
6
|
+
@output_buffer = template.instance_variable_get(:@_out_buf)
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_type?
|
10
|
+
! self.output_buffer.nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
def block_is_type?(block)
|
14
|
+
is_type? || (block && eval('defined?(__in_erb_template)', block.binding))
|
15
|
+
end
|
16
|
+
|
17
|
+
def engines
|
18
|
+
@engines ||= [ :erb, :erubis ]
|
19
|
+
end
|
20
|
+
|
21
|
+
def capture_from_template(*args, &block)
|
22
|
+
self.output_buffer, _buf_was = '', self.output_buffer
|
23
|
+
block.call(*args)
|
24
|
+
ret = eval('@_out_buf', block.binding)
|
25
|
+
self.output_buffer = _buf_was
|
26
|
+
ret
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
def output_buffer=(value)
|
31
|
+
template.instance_variable_set(:@_out_buf, value)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Sinatra::ContentFor2::BaseHandler.register(Sinatra::ContentFor2::ErbHandler)
|
37
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Sinatra::ContentFor2::HamlHandler < Sinatra::ContentFor2::BaseHandler
|
2
|
+
def is_type?
|
3
|
+
template.respond_to?(:is_haml?) && template.is_haml?
|
4
|
+
end
|
5
|
+
|
6
|
+
def block_is_type?(block)
|
7
|
+
template.block_is_haml?(block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def capture_from_template(*args, &block)
|
11
|
+
eval("_hamlout ||= @haml_buffer", block.binding) # this is for rbx
|
12
|
+
template.capture_haml(*args, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def engines
|
16
|
+
@engines ||= [ :haml ]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Sinatra::ContentFor2::BaseHandler.register(Sinatra::ContentFor2::HamlHandler)
|
21
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class Sinatra::ContentFor2::SlimHandler < Sinatra::ContentFor2::BaseHandler
|
2
|
+
class << self
|
3
|
+
def setup_slim
|
4
|
+
return if @slim_set
|
5
|
+
if defined?(Slim)
|
6
|
+
Slim::Engine.set_default_options(:buffer => '@_out_buf', :generator => Temple::Generators::StringBuffer)
|
7
|
+
@slim_set = true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :output_buffer
|
13
|
+
|
14
|
+
def initialize(template)
|
15
|
+
super
|
16
|
+
self.class.setup_slim
|
17
|
+
@output_buffer = template.instance_variable_get(:@_out_buf)
|
18
|
+
end
|
19
|
+
|
20
|
+
def is_type?
|
21
|
+
! self.output_buffer.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
def capture_from_template(*args, &block)
|
25
|
+
self.output_buffer, _buf_was = "", self.output_buffer
|
26
|
+
block.call(*args)
|
27
|
+
ret = eval("@_out_buf", block.binding)
|
28
|
+
self.output_buffer = _buf_was
|
29
|
+
ret
|
30
|
+
end
|
31
|
+
|
32
|
+
def block_is_type?(block)
|
33
|
+
is_type? || (block && eval('defined? __in_erb_template', block.binding))
|
34
|
+
end
|
35
|
+
|
36
|
+
def engines
|
37
|
+
@engines ||= [ :slim ]
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
def output_buffer=(val)
|
42
|
+
template.instance_variable_set(:@_out_buf, val)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Sinatra::ContentFor2::BaseHandler.register(Sinatra::ContentFor2::SlimHandler)
|
47
|
+
|
48
|
+
|
@@ -1,9 +1,14 @@
|
|
1
1
|
#encoding: utf-8
|
2
2
|
|
3
|
+
$LOAD_PATH << File.expand_path('../lib', __FILE__)
|
4
|
+
|
5
|
+
require 'sinatra/content_for2/version'
|
6
|
+
|
3
7
|
Gem::Specification.new do |s|
|
4
8
|
s.name = "sinatra-content-for2"
|
5
|
-
s.version =
|
6
|
-
|
9
|
+
s.version = Gem::Version.new(Sinatra::ContentFor2::VERSION)
|
10
|
+
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
7
12
|
|
8
13
|
s.description = "Small Sinatra extension to add a content_for helper similar to Rails'"
|
9
14
|
s.summary = "Small Sinatra extension to add a content_for helper similar to Rails'"
|
@@ -18,20 +23,22 @@ Gem::Specification.new do |s|
|
|
18
23
|
s.rubygems_version = "1.3.7"
|
19
24
|
|
20
25
|
s.add_dependency "sinatra"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
s.
|
29
|
-
.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
s.add_development_dependency "rake"
|
27
|
+
s.add_development_dependency "yard"
|
28
|
+
s.add_development_dependency "rspec-core"
|
29
|
+
s.add_development_dependency "rspec-expectations"
|
30
|
+
s.add_development_dependency "rr"
|
31
|
+
s.add_development_dependency "slim"
|
32
|
+
s.add_development_dependency "erubis"
|
33
|
+
s.add_development_dependency "haml"
|
34
|
+
s.add_development_dependency "bundler", ">= 1.0.10"
|
35
|
+
|
36
|
+
|
37
|
+
s.extra_rdoc_files = [
|
38
|
+
"README.rdoc"
|
39
|
+
]
|
40
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
41
|
+
s.files = `git ls-files`.split("\n")
|
42
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
36
43
|
end
|
37
44
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'erubis'
|
3
|
+
require 'haml'
|
4
|
+
require 'slim'
|
5
|
+
|
6
|
+
class SpecTemplates < Sinatra::Base
|
7
|
+
set :environment, :test
|
8
|
+
set :views, File.join(File.dirname(__FILE__), '..', '..', 'templates')
|
9
|
+
|
10
|
+
helpers Sinatra::ContentFor2
|
11
|
+
end
|
12
|
+
|
13
|
+
describe Sinatra::ContentFor2 do
|
14
|
+
|
15
|
+
def templates
|
16
|
+
@templates ||= begin
|
17
|
+
r = SpecTemplates.new
|
18
|
+
# remove Rack magic
|
19
|
+
while !r.kind_of?(SpecTemplates) do
|
20
|
+
r = r.instance_variable_get(:@app)
|
21
|
+
end
|
22
|
+
r
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
[ :erb, :haml, :erubis ].each do |engine|
|
27
|
+
it "should render #{engine} template" do
|
28
|
+
erubis_was = Erubis
|
29
|
+
if engine == :erb
|
30
|
+
Object.send(:remove_const, :Erubis)
|
31
|
+
end
|
32
|
+
sr = templates.send(engine, :sub, :layout => false, :eat_errors => false)
|
33
|
+
sr.should_not =~ /sub/
|
34
|
+
r = templates.send(engine, :main, :layout => false, :eat_errors => false)
|
35
|
+
r.should =~ /main/
|
36
|
+
r.should =~ /sub/
|
37
|
+
if engine == :erb
|
38
|
+
Object.const_set(:Erubis, erubis_was)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-content-for2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: -3702664266
|
5
|
+
prerelease: 4
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
|
8
|
+
- 3
|
9
|
+
- alpha
|
10
|
+
- 1
|
11
|
+
version: 0.3.alpha1
|
10
12
|
platform: ruby
|
11
13
|
authors:
|
12
14
|
- "Nicol\xC3\xA1s Sanguinetti"
|
@@ -14,7 +16,7 @@ autorequire:
|
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date: 2011-
|
19
|
+
date: 2011-06-23 00:00:00 +04:00
|
18
20
|
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
@@ -25,64 +27,168 @@ dependencies:
|
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
version: "0"
|
31
34
|
type: :runtime
|
32
35
|
version_requirements: *id001
|
33
36
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
37
|
+
name: rake
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
40
|
none: false
|
38
41
|
requirements:
|
39
42
|
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
41
45
|
segments:
|
42
46
|
- 0
|
43
47
|
version: "0"
|
44
48
|
type: :development
|
45
49
|
version_requirements: *id002
|
46
50
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
51
|
+
name: yard
|
48
52
|
prerelease: false
|
49
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
50
54
|
none: false
|
51
55
|
requirements:
|
52
56
|
- - ">="
|
53
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
54
59
|
segments:
|
55
60
|
- 0
|
56
61
|
version: "0"
|
57
62
|
type: :development
|
58
63
|
version_requirements: *id003
|
59
64
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
65
|
+
name: rspec-core
|
61
66
|
prerelease: false
|
62
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
63
68
|
none: false
|
64
69
|
requirements:
|
65
70
|
- - ">="
|
66
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
67
73
|
segments:
|
68
74
|
- 0
|
69
75
|
version: "0"
|
70
76
|
type: :development
|
71
77
|
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec-expectations
|
80
|
+
prerelease: false
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
type: :development
|
91
|
+
version_requirements: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: rr
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
type: :development
|
105
|
+
version_requirements: *id006
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: slim
|
108
|
+
prerelease: false
|
109
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
version: "0"
|
118
|
+
type: :development
|
119
|
+
version_requirements: *id007
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
name: erubis
|
122
|
+
prerelease: false
|
123
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
version: "0"
|
132
|
+
type: :development
|
133
|
+
version_requirements: *id008
|
134
|
+
- !ruby/object:Gem::Dependency
|
135
|
+
name: haml
|
136
|
+
prerelease: false
|
137
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
hash: 3
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
version: "0"
|
146
|
+
type: :development
|
147
|
+
version_requirements: *id009
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: bundler
|
150
|
+
prerelease: false
|
151
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 3
|
157
|
+
segments:
|
158
|
+
- 1
|
159
|
+
- 0
|
160
|
+
- 10
|
161
|
+
version: 1.0.10
|
162
|
+
type: :development
|
163
|
+
version_requirements: *id010
|
72
164
|
description: Small Sinatra extension to add a content_for helper similar to Rails'
|
73
165
|
email: contacto@nicolassanguinetti.info
|
74
166
|
executables: []
|
75
167
|
|
76
168
|
extensions: []
|
77
169
|
|
78
|
-
extra_rdoc_files:
|
79
|
-
|
170
|
+
extra_rdoc_files:
|
171
|
+
- README.rdoc
|
80
172
|
files:
|
81
173
|
- .gitignore
|
174
|
+
- .rspec
|
175
|
+
- Gemfile
|
82
176
|
- LICENSE
|
83
177
|
- README.rdoc
|
84
|
-
-
|
178
|
+
- Rakefile
|
85
179
|
- lib/sinatra/content_for2.rb
|
180
|
+
- lib/sinatra/content_for2/base_handler.rb
|
181
|
+
- lib/sinatra/content_for2/erb_handler.rb
|
182
|
+
- lib/sinatra/content_for2/haml_handler.rb
|
183
|
+
- lib/sinatra/content_for2/slim_handler.rb
|
184
|
+
- lib/sinatra/content_for2/version.rb
|
185
|
+
- sinatra-content-for2.gemspec
|
186
|
+
- spec/lib/sinatra/content_for2_spec.rb
|
187
|
+
- spec/spec_helper.rb
|
188
|
+
- spec/templates/main.erb
|
189
|
+
- spec/templates/main.haml
|
190
|
+
- spec/templates/sub.erb
|
191
|
+
- spec/templates/sub.haml
|
86
192
|
- test/content_for_test.rb
|
87
193
|
has_rdoc: true
|
88
194
|
homepage: https://github.com/Undev/sinatra-content-for2
|
@@ -98,23 +204,33 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
204
|
requirements:
|
99
205
|
- - ">="
|
100
206
|
- !ruby/object:Gem::Version
|
207
|
+
hash: 3
|
101
208
|
segments:
|
102
209
|
- 0
|
103
210
|
version: "0"
|
104
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
212
|
none: false
|
106
213
|
requirements:
|
107
|
-
- - "
|
214
|
+
- - ">"
|
108
215
|
- !ruby/object:Gem::Version
|
216
|
+
hash: 25
|
109
217
|
segments:
|
110
|
-
-
|
111
|
-
|
218
|
+
- 1
|
219
|
+
- 3
|
220
|
+
- 1
|
221
|
+
version: 1.3.1
|
112
222
|
requirements: []
|
113
223
|
|
114
224
|
rubyforge_project: sinatra-ditties
|
115
|
-
rubygems_version: 1.
|
225
|
+
rubygems_version: 1.5.2
|
116
226
|
signing_key:
|
117
227
|
specification_version: 3
|
118
228
|
summary: Small Sinatra extension to add a content_for helper similar to Rails'
|
119
|
-
test_files:
|
120
|
-
|
229
|
+
test_files:
|
230
|
+
- spec/lib/sinatra/content_for2_spec.rb
|
231
|
+
- spec/spec_helper.rb
|
232
|
+
- spec/templates/main.erb
|
233
|
+
- spec/templates/main.haml
|
234
|
+
- spec/templates/sub.erb
|
235
|
+
- spec/templates/sub.haml
|
236
|
+
- test/content_for_test.rb
|