middleman-core 3.0.12 → 3.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/features/unicode_filecontents.feature +13 -0
- data/lib/middleman-core/cli/build.rb +8 -1
- data/lib/middleman-core/core_extensions/rendering.rb +2 -0
- data/lib/middleman-core/core_extensions/request.rb +3 -2
- data/lib/middleman-core/logger.rb +0 -1
- data/lib/middleman-core/preview_server.rb +9 -2
- data/lib/middleman-core/sitemap/resource.rb +0 -6
- data/lib/middleman-core/step_definitions/builder_steps.rb +14 -0
- data/lib/middleman-core/version.rb +1 -1
- data/middleman-core-x86-mingw32.gemspec +1 -1
- data/middleman-core.gemspec +1 -1
- metadata +8 -6
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Unicode filecontents
|
2
|
+
In order to support non-ASCII characters in file contents
|
3
|
+
|
4
|
+
Scenario: Rebuild with files containing unicode characters in their name
|
5
|
+
Given a fixture app "clean-app"
|
6
|
+
And a file named "source/index.html.erb" with:
|
7
|
+
"""
|
8
|
+
你好
|
9
|
+
"""
|
10
|
+
And a successfully built app at "clean-app"
|
11
|
+
And a modification time for a file named "build/index.html"
|
12
|
+
And a successfully built app at "clean-app"
|
13
|
+
Then the file "build/index.html" should not have been updated
|
@@ -137,7 +137,7 @@ module Middleman::Cli
|
|
137
137
|
response = self.class.shared_rack.get(URI.escape(resource.destination_path))
|
138
138
|
|
139
139
|
if response.status == 200
|
140
|
-
create_file(output_file, response.body)
|
140
|
+
create_file(output_file, binary_encode(response.body))
|
141
141
|
else
|
142
142
|
handle_error(output_file, response.body)
|
143
143
|
end
|
@@ -160,6 +160,13 @@ module Middleman::Cli
|
|
160
160
|
self.shell.error(response)
|
161
161
|
end
|
162
162
|
end
|
163
|
+
|
164
|
+
def binary_encode(string)
|
165
|
+
if string.respond_to?(:force_encoding)
|
166
|
+
string.force_encoding("ascii-8bit")
|
167
|
+
end
|
168
|
+
string
|
169
|
+
end
|
163
170
|
}
|
164
171
|
end
|
165
172
|
|
@@ -248,7 +248,7 @@ module Middleman
|
|
248
248
|
current_path = resource.destination_path
|
249
249
|
|
250
250
|
# Set a HTTP content type based on the request's extensions
|
251
|
-
content_type(res, resource.
|
251
|
+
content_type(res, mime_type(resource.ext))
|
252
252
|
|
253
253
|
begin
|
254
254
|
# Write out the contents of the page
|
@@ -277,6 +277,7 @@ module Middleman
|
|
277
277
|
# @return [void]
|
278
278
|
def mime_type(type, value=nil)
|
279
279
|
return type if type.nil? || type.to_s.include?('/')
|
280
|
+
return ::Rack::Mime.mime_type('.txt') if type.empty?
|
280
281
|
type = ".#{type}" unless type.to_s[0] == ?.
|
281
282
|
return ::Rack::Mime.mime_type(type, nil) unless value
|
282
283
|
::Rack::Mime::MIME_TYPES[type] = value
|
@@ -311,7 +312,7 @@ module Middleman
|
|
311
312
|
# @param [Hash] params
|
312
313
|
# @return [void]
|
313
314
|
def content_type(res, type, params={})
|
314
|
-
return
|
315
|
+
return unless type
|
315
316
|
default = params.delete :default
|
316
317
|
mime_type = mime_type(type) || default
|
317
318
|
throw "Unknown media type: %p" % type if mime_type.nil?
|
@@ -30,6 +30,12 @@ module Middleman
|
|
30
30
|
::Middleman::Profiling.report("server_start")
|
31
31
|
|
32
32
|
@webrick.start
|
33
|
+
|
34
|
+
# $mm_shutdown is set by the signal handler
|
35
|
+
if $mm_shutdown
|
36
|
+
shutdown
|
37
|
+
exit
|
38
|
+
end
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
@@ -117,8 +123,9 @@ module Middleman
|
|
117
123
|
%w(INT HUP TERM QUIT).each do |sig|
|
118
124
|
if Signal.list[sig]
|
119
125
|
Signal.trap(sig) do
|
120
|
-
|
121
|
-
|
126
|
+
# Do as little work as possible in the signal context
|
127
|
+
$mm_shutdown = true
|
128
|
+
@webrick.stop
|
122
129
|
end
|
123
130
|
end
|
124
131
|
end
|
@@ -102,12 +102,6 @@ module Middleman
|
|
102
102
|
File.extname(path)
|
103
103
|
end
|
104
104
|
|
105
|
-
# Mime type of the path
|
106
|
-
# @return [String]
|
107
|
-
def mime_type
|
108
|
-
app.mime_type ext
|
109
|
-
end
|
110
|
-
|
111
105
|
# Render this resource
|
112
106
|
# @return [String]
|
113
107
|
def render(opts={}, locs={}, &block)
|
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
+
Before do
|
4
|
+
@modification_times = Hash.new
|
5
|
+
end
|
6
|
+
|
3
7
|
Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name|
|
4
8
|
target = File.join(PROJECT_ROOT_PATH, "fixtures", path)
|
5
9
|
config_path = File.join(current_dir, "config-#{config_name}.rb")
|
@@ -50,6 +54,16 @@ Given /^a successfully built app at "([^\"]*)" with flags "([^\"]*)"$/ do |path,
|
|
50
54
|
step %Q{was successfully built}
|
51
55
|
end
|
52
56
|
|
57
|
+
Given /^a modification time for a file named "([^\"]*)"$/ do |file|
|
58
|
+
target = File.join(current_dir, file)
|
59
|
+
@modification_times[target] = File.mtime(target)
|
60
|
+
end
|
61
|
+
|
62
|
+
Then /^the file "([^\"]*)" should not have been updated$/ do |file|
|
63
|
+
target = File.join(current_dir, file)
|
64
|
+
File.mtime(target).should == @modification_times[target]
|
65
|
+
end
|
66
|
+
|
53
67
|
# Provide this Aruba overload in case we're matching something with quotes in it
|
54
68
|
Then /^the file "([^"]*)" should contain '([^']*)'$/ do |file, partial_content|
|
55
69
|
check_file_content(file, partial_content, true)
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
# Core
|
22
22
|
s.add_dependency("bundler", ["~> 1.1"])
|
23
23
|
s.add_dependency("rack", ["~> 1.4.1"])
|
24
|
-
s.add_dependency("tilt", ["~> 1.3.
|
24
|
+
s.add_dependency("tilt", ["~> 1.3.6"])
|
25
25
|
|
26
26
|
# Builder
|
27
27
|
s.add_dependency("rack-test", ["~> 0.6.1"])
|
data/middleman-core.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Core
|
21
21
|
s.add_dependency("bundler", ["~> 1.1"])
|
22
22
|
s.add_dependency("rack", ["~> 1.4.1"])
|
23
|
-
s.add_dependency("tilt", ["~> 1.3.
|
23
|
+
s.add_dependency("tilt", ["~> 1.3.6"])
|
24
24
|
|
25
25
|
# Builder
|
26
26
|
s.add_dependency("rack-test", ["~> 0.6.1"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.3.
|
54
|
+
version: 1.3.6
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.3.
|
62
|
+
version: 1.3.6
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: rack-test
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- features/strip_url.feature
|
189
189
|
- features/support/env.rb
|
190
190
|
- features/tilde_directories.feature
|
191
|
+
- features/unicode_filecontents.feature
|
191
192
|
- features/unicode_filenames.feature
|
192
193
|
- features/wildcard_page_helper.feature
|
193
194
|
- fixtures/automatic-directory-matcher-app/config.rb
|
@@ -599,7 +600,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
599
600
|
version: '0'
|
600
601
|
segments:
|
601
602
|
- 0
|
602
|
-
hash:
|
603
|
+
hash: 1023379904574155336
|
603
604
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
604
605
|
none: false
|
605
606
|
requirements:
|
@@ -608,7 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
608
609
|
version: '0'
|
609
610
|
segments:
|
610
611
|
- 0
|
611
|
-
hash:
|
612
|
+
hash: 1023379904574155336
|
612
613
|
requirements: []
|
613
614
|
rubyforge_project:
|
614
615
|
rubygems_version: 1.8.23
|
@@ -648,6 +649,7 @@ test_files:
|
|
648
649
|
- features/strip_url.feature
|
649
650
|
- features/support/env.rb
|
650
651
|
- features/tilde_directories.feature
|
652
|
+
- features/unicode_filecontents.feature
|
651
653
|
- features/unicode_filenames.feature
|
652
654
|
- features/wildcard_page_helper.feature
|
653
655
|
- fixtures/automatic-directory-matcher-app/config.rb
|