smartgen 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/smartgen/renderers/erb.rb +1 -1
- data/lib/smartgen/version.rb +1 -1
- data/lib/smartgen/watcher.rb +1 -0
- data/spec/lib/smartgen/object_hash_spec.rb +1 -1
- data/spec/lib/smartgen/renderers/erb_spec.rb +6 -0
- data/spec/lib/smartgen/watcher_spec.rb +1 -0
- metadata +3 -3
data/ChangeLog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -5,7 +5,7 @@ module Smartgen
|
|
5
5
|
# Renders the markup file using the given layout.
|
6
6
|
#
|
7
7
|
# It exposes +markup_file+ variable and its +metadata+ to the ERB layout.
|
8
|
-
def render(layout, markup_file, metadata=
|
8
|
+
def render(layout, markup_file, metadata=Smartgen::ObjectHash.new)
|
9
9
|
::ERB.new(layout).result(binding)
|
10
10
|
end
|
11
11
|
end
|
data/lib/smartgen/version.rb
CHANGED
data/lib/smartgen/watcher.rb
CHANGED
@@ -15,6 +15,12 @@ describe Smartgen::Renderer::ERB do
|
|
15
15
|
subject.render(layout, markup_file).should == "<html><body>#{contents}</body></html>"
|
16
16
|
end
|
17
17
|
|
18
|
+
it "should render the given layout without setting metadata, but using methods to access metadata in template" do
|
19
|
+
layout = "<html><body><%= markup_file.contents %><div><%= metadata.some_key %></div></body></html>"
|
20
|
+
|
21
|
+
capture(:stderr) { subject.render(layout, markup_file).should == "<html><body>#{contents}<div>{}</div></body></html>" }
|
22
|
+
end
|
23
|
+
|
18
24
|
it "should render the given layout with metadata variable" do
|
19
25
|
layout = "<html><body><%= markup_file.contents %><div><%= metadata[:some_key] %></div></body></html>"
|
20
26
|
subject.render(layout, markup_file, Smartgen::ObjectHash.new(:some_key => 'some_value')).should == "<html><body>#{contents}<div>some_value</div></body></html>"
|
@@ -63,6 +63,7 @@ describe Smartgen::Watcher do
|
|
63
63
|
context "when user hits ctrl+c" do
|
64
64
|
it "should exit gracefully" do
|
65
65
|
directory_watcher.should_receive(:stop)
|
66
|
+
Kernel.should_receive(:exit).with(0)
|
66
67
|
Kernel.should_receive(:trap).with('INT').and_yield
|
67
68
|
capture(:stdout) { subject.start }
|
68
69
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 1
|
9
|
+
version: 0.5.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Vicente Mundim
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02
|
17
|
+
date: 2011-03-02 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|