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 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
@@ -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= @template.render(context)
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? './'
@@ -1,5 +1,5 @@
1
1
  module Gumdrop
2
2
 
3
- VERSION = "0.7.2" unless defined?(::Gumdrop::VERSION)
3
+ VERSION = "0.7.3" unless defined?(::Gumdrop::VERSION)
4
4
 
5
5
  end
@@ -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
@@ -0,0 +1,14 @@
1
+ (function() {
2
+ var Test;
3
+
4
+ Test = (function() {
5
+
6
+ function Test() {}
7
+
8
+ Test.VERSION = "1.0";
9
+
10
+ return Test;
11
+
12
+ })();
13
+
14
+ }).call(this);
@@ -0,0 +1,4 @@
1
+
2
+ class Test
3
+ @VERSION= "1.0"
4
+
@@ -0,0 +1,3 @@
1
+
2
+ class Test
3
+ @VERSION= "<%= '1.0' %>"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 2
9
- version: 0.7.2
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