middleman-core-x86-mingw32 3.0.7 → 3.0.8.pre.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,16 @@ Feature: YAML Front Matter
11
11
  Then I should see "<?php"
12
12
  Then I should not see "---"
13
13
 
14
+ Scenario: Rendering raw (template-less) (yaml)
15
+ Given the Server is running at "frontmatter-app"
16
+ When I go to "/raw-front-matter.html"
17
+ Then I should see "<h1><%= data.page.title %></h1>"
18
+ Then I should not see "---"
19
+ When I go to "/raw-front-matter.php"
20
+ Then I should see '<?php echo "sup"; ?>'
21
+ Then I should see "<?php"
22
+ Then I should not see "---"
23
+
14
24
  Scenario: YAML not on first line, no encoding
15
25
  Given the Server is running at "frontmatter-app"
16
26
  When I go to "/front-matter-line-2.html"
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: false
3
+ title: This is the title
4
+ ---
5
+
6
+ <h1><%= data.page.title %></h1>
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: false
3
+ title: This is the title
4
+ ---
5
+
6
+ <?php echo "sup"; ?>
@@ -117,16 +117,20 @@ module Middleman::Cli
117
117
  build_dir = self.class.shared_instance.build_dir
118
118
  output_file = File.join(build_dir, resource.destination_path)
119
119
 
120
- begin
121
- response = self.class.shared_rack.get(URI.escape(resource.destination_path))
122
-
123
- if response.status == 200
124
- create_file(output_file, response.body)
125
- else
126
- handle_error(output_file, response.body)
120
+ if resource.binary?
121
+ copy_file(resource.source_file, output_file)
122
+ else
123
+ begin
124
+ response = self.class.shared_rack.get(URI.escape(resource.destination_path))
125
+
126
+ if response.status == 200
127
+ create_file(output_file, response.body)
128
+ else
129
+ handle_error(output_file, response.body)
130
+ end
131
+ rescue => e
132
+ handle_error(output_file, "#{e}\n#{e.backtrace.join("\n")}", e)
127
133
  end
128
- rescue => e
129
- handle_error(output_file, "#{e}\n#{e.backtrace.join("\n")}", e)
130
134
  end
131
135
 
132
136
  output_file
@@ -88,6 +88,7 @@ module Middleman
88
88
  # @param [Pathname] path The file that changed
89
89
  # @return [void]
90
90
  def did_change(path)
91
+ path = Pathname(path)
91
92
  return if ignored?(path)
92
93
  logger.debug "== File Change: #{path}"
93
94
  @known_paths << path
@@ -99,6 +100,7 @@ module Middleman
99
100
  # @param [Pathname] path The file that was deleted
100
101
  # @return [void]
101
102
  def did_delete(path)
103
+ path = Pathname(path)
102
104
  return if ignored?(path)
103
105
  logger.debug "== File Deletion: #{path}"
104
106
  @known_paths.delete(path)
@@ -242,10 +242,10 @@ module Middleman
242
242
  # Return 404 if not in sitemap
243
243
  return not_found(res, request_path) unless resource && !resource.ignored?
244
244
 
245
- current_path = resource.destination_path
245
+ # If this path is a binary file, send it immediately
246
+ return send_file(resource.source_file, env, res) if resource.binary?
246
247
 
247
- # If this path is a static file, send it immediately
248
- return send_file(resource.source_file, env, res) unless resource.template?
248
+ current_path = resource.destination_path
249
249
 
250
250
  # Set a HTTP content type based on the request's extensions
251
251
  content_type(res, resource.mime_type)
@@ -111,7 +111,9 @@ module Middleman
111
111
  # Render this resource
112
112
  # @return [String]
113
113
  def render(opts={}, locs={}, &block)
114
- return File.open(source_file).read unless template?
114
+ if !template?
115
+ return app.template_data_for_file(source_file)
116
+ end
115
117
 
116
118
  relative_source = Pathname(source_file).relative_path_from(Pathname(app.root))
117
119
 
@@ -144,6 +146,14 @@ module Middleman
144
146
  end
145
147
  File.join(app.respond_to?(:http_prefix) ? app.http_prefix : '/', url_path)
146
148
  end
149
+
150
+ # Whether the source file is binary.
151
+ #
152
+ # @retrun [Boolean]
153
+ def binary?
154
+ s = (File.read(source_file, File.stat(source_file).blksize) || "").split(//)
155
+ ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
156
+ end
147
157
  end
148
158
  end
149
159
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.0.7' unless const_defined?(:VERSION)
4
+ VERSION = '3.0.8.pre.1' unless const_defined?(:VERSION)
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-core-x86-mingw32
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
5
- prerelease:
4
+ version: 3.0.8.pre.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas Reynolds
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-17 00:00:00.000000000 Z
13
+ date: 2013-01-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -279,6 +279,8 @@ files:
279
279
  - fixtures/frontmatter-app/source/json-front-matter-encoding.html.erb
280
280
  - fixtures/frontmatter-app/source/json-front-matter-line-2.html.erb
281
281
  - fixtures/frontmatter-app/source/json-front-matter.html.erb
282
+ - fixtures/frontmatter-app/source/raw-front-matter.html
283
+ - fixtures/frontmatter-app/source/raw-front-matter.php
282
284
  - fixtures/frontmatter-settings-app/config.rb
283
285
  - fixtures/frontmatter-settings-app/source/alternate_layout.html.erb
284
286
  - fixtures/frontmatter-settings-app/source/ignored.html.erb
@@ -581,16 +583,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
581
583
  version: '0'
582
584
  segments:
583
585
  - 0
584
- hash: 843733507619819876
586
+ hash: 2509201533055117271
585
587
  required_rubygems_version: !ruby/object:Gem::Requirement
586
588
  none: false
587
589
  requirements:
588
- - - ! '>='
590
+ - - ! '>'
589
591
  - !ruby/object:Gem::Version
590
- version: '0'
591
- segments:
592
- - 0
593
- hash: 843733507619819876
592
+ version: 1.3.1
594
593
  requirements: []
595
594
  rubyforge_project:
596
595
  rubygems_version: 1.8.24
@@ -721,6 +720,8 @@ test_files:
721
720
  - fixtures/frontmatter-app/source/json-front-matter-encoding.html.erb
722
721
  - fixtures/frontmatter-app/source/json-front-matter-line-2.html.erb
723
722
  - fixtures/frontmatter-app/source/json-front-matter.html.erb
723
+ - fixtures/frontmatter-app/source/raw-front-matter.html
724
+ - fixtures/frontmatter-app/source/raw-front-matter.php
724
725
  - fixtures/frontmatter-settings-app/config.rb
725
726
  - fixtures/frontmatter-settings-app/source/alternate_layout.html.erb
726
727
  - fixtures/frontmatter-settings-app/source/ignored.html.erb