gumdrop 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +3 -0
- data/lib/gumdrop/content.rb +20 -1
- data/lib/gumdrop/version.rb +1 -1
- data/specs/content_spec.rb +20 -0
- data/specs/fixtures/Gumdrop +0 -0
- data/specs/fixtures/expected-test.js +14 -0
- data/specs/fixtures/test.js.coffee +4 -0
- data/specs/fixtures/test.js.erb.coffee +3 -0
- metadata +6 -2
data/ChangeLog.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v0.7.3
|
2
|
+
- Bugfix: Correctly runs content through multiple processors (when multiple are specified in the filename. ie: test.js.erb.coffee gets sent through CoffeeScript then erb)
|
3
|
+
|
1
4
|
# v0.7.2
|
2
5
|
- Now supports :packr as a type of compression for stitch/sprockets (be sure it's in your Gemfile)
|
3
6
|
- Cleaned up generator internals
|
data/lib/gumdrop/content.rb
CHANGED
@@ -46,7 +46,7 @@ module Gumdrop
|
|
46
46
|
context.reset_data 'current_depth'=>@level, 'current_slug'=>@slug, 'page'=>self, 'layout'=>default_layout, 'params'=>self.params
|
47
47
|
end
|
48
48
|
context.set_content self, locals
|
49
|
-
content=
|
49
|
+
content= render_all(context)
|
50
50
|
return content if ignore_layout
|
51
51
|
layout= context.get_template()
|
52
52
|
while !layout.nil?
|
@@ -122,6 +122,25 @@ module Gumdrop
|
|
122
122
|
filename_parts.join('.')
|
123
123
|
end
|
124
124
|
|
125
|
+
def render_all(ctx)
|
126
|
+
if @generated or !File.exists?(@full_path)
|
127
|
+
content= @template.render(ctx)
|
128
|
+
else
|
129
|
+
content= File.read @full_path
|
130
|
+
exts= @source_filename.gsub @filename, ''
|
131
|
+
exts.split('.').reverse.each do |ext|
|
132
|
+
unless ext.blank?
|
133
|
+
templateClass= Tilt[".#{ext}"]
|
134
|
+
template= templateClass.new(@full_path) do
|
135
|
+
content
|
136
|
+
end
|
137
|
+
content= template.render(ctx)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
content
|
142
|
+
end
|
143
|
+
|
125
144
|
def get_uri
|
126
145
|
uri= File.join File.dirname(@path), @filename
|
127
146
|
if uri.starts_with? './'
|
data/lib/gumdrop/version.rb
CHANGED
data/specs/content_spec.rb
CHANGED
@@ -7,6 +7,26 @@ describe Gumdrop::Content do
|
|
7
7
|
# @ho= Gumdrop::HashObject.new one:"ONE", two:"TWO", three:'THREE'
|
8
8
|
# end
|
9
9
|
|
10
|
+
it "should process the content through all the engines specified in the file ext" do
|
11
|
+
|
12
|
+
path= File.join ".", "specs", "fixtures", 'Gumdrop'
|
13
|
+
site= Gumdrop::Site.new path
|
14
|
+
|
15
|
+
path= File.join ".", "specs", "fixtures", 'test.js.erb.coffee'
|
16
|
+
content= Gumdrop::Content.new( path, site )
|
17
|
+
|
18
|
+
path= File.join ".", "specs", "fixtures", 'expected-test.js'
|
19
|
+
expected= File.read path
|
20
|
+
|
21
|
+
content= content.render()
|
22
|
+
|
23
|
+
# puts content
|
24
|
+
# puts expected
|
25
|
+
|
26
|
+
content.must_equal expected
|
27
|
+
|
28
|
+
end
|
29
|
+
|
10
30
|
# it "can be created with no arguments" do
|
11
31
|
# Gumdrop::HashObject.new.must_be_instance_of Gumdrop::HashObject
|
12
32
|
# end
|
File without changes
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 3
|
9
|
+
version: 0.7.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt McCray
|
@@ -129,6 +129,10 @@ files:
|
|
129
129
|
- lib/gumdrop/view_helpers.rb
|
130
130
|
- specs/content_spec.rb
|
131
131
|
- specs/deferred_loader_spec.rb
|
132
|
+
- specs/fixtures/Gumdrop
|
133
|
+
- specs/fixtures/expected-test.js
|
134
|
+
- specs/fixtures/test.js.coffee
|
135
|
+
- specs/fixtures/test.js.erb.coffee
|
132
136
|
- specs/hash_object_spec.rb
|
133
137
|
- templates/backbone/Gemfile
|
134
138
|
- templates/backbone/Gumdrop
|