middleman-core-x86-mingw32 3.0.11 → 3.0.12.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/middleman-core/cli/build.rb +4 -2
- data/lib/middleman-core/core_extensions/data.rb +2 -2
- data/lib/middleman-core/core_extensions/file_watcher.rb +2 -1
- data/lib/middleman-core/core_extensions/front_matter.rb +11 -3
- data/lib/middleman-core/core_extensions/rendering.rb +19 -2
- data/lib/middleman-core/preview_server.rb +1 -1
- data/lib/middleman-core/renderers/coffee_script.rb +9 -5
- data/lib/middleman-core/sitemap/store.rb +3 -3
- data/lib/middleman-core/sitemap.rb +5 -4
- data/lib/middleman-core/util.rb +19 -2
- data/lib/middleman-core/version.rb +1 -1
- data/middleman-core-x86-mingw32.gemspec +2 -2
- data/middleman-core.gemspec +4 -5
- data/spec/middleman-core/binary_spec/middleman +0 -0
- data/spec/middleman-core/binary_spec/middleman.png +0 -0
- data/spec/middleman-core/binary_spec/plain.txt +1 -0
- data/spec/middleman-core/binary_spec/stars.svgz +0 -0
- data/spec/middleman-core/binary_spec/unicode +1 -0
- data/spec/middleman-core/binary_spec/unicode.txt +1 -0
- data/spec/middleman-core/binary_spec.rb +15 -0
- data/spec/middleman-core/sitemap_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- metadata +20 -14
@@ -65,7 +65,9 @@ module Middleman::Cli
|
|
65
65
|
action GlobAction.new(self, opts)
|
66
66
|
|
67
67
|
if @had_errors && !@debugging
|
68
|
-
|
68
|
+
cmd = "middleman build --verbose"
|
69
|
+
cmd = "bundle exec '#{cmd}'" if defined?(Bundler)
|
70
|
+
self.shell.say "There were errors during this build, re-run with `#{cmd}` to see the full exception."
|
69
71
|
end
|
70
72
|
|
71
73
|
exit(1) if @had_errors
|
@@ -231,7 +233,7 @@ module Middleman::Cli
|
|
231
233
|
|
232
234
|
paths = ::Middleman::Util.all_files_under(@destination)
|
233
235
|
@cleaning_queue += paths.select do |path|
|
234
|
-
|
236
|
+
path.to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/
|
235
237
|
end
|
236
238
|
end
|
237
239
|
|
@@ -25,11 +25,11 @@ module Middleman
|
|
25
25
|
# parsing config.rb
|
26
26
|
def initialize
|
27
27
|
self.files.changed DataStore.matcher do |file|
|
28
|
-
self.data.touch_file(file) if file.
|
28
|
+
self.data.touch_file(file) if file.start_with?("#{self.data_dir}/")
|
29
29
|
end
|
30
30
|
|
31
31
|
self.files.deleted DataStore.matcher do |file|
|
32
|
-
self.data.remove_file(file) if file.
|
32
|
+
self.data.remove_file(file) if file.start_with?("#{self.data_dir}/")
|
33
33
|
end
|
34
34
|
|
35
35
|
super
|
@@ -145,7 +145,8 @@ module Middleman
|
|
145
145
|
# @param [Pathname] path
|
146
146
|
# @return [Boolean]
|
147
147
|
def ignored?(path)
|
148
|
-
|
148
|
+
path = path.to_s
|
149
|
+
IGNORE_LIST.any? { |r| path =~ r }
|
149
150
|
end
|
150
151
|
|
151
152
|
# Notify callbacks for a file given an array of callbacks
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
# Extensions namespace
|
2
4
|
module Middleman::CoreExtensions
|
3
5
|
|
@@ -70,8 +72,9 @@ module Middleman::CoreExtensions
|
|
70
72
|
@cache.delete(path)
|
71
73
|
end
|
72
74
|
|
73
|
-
YAML_ERRORS = [
|
75
|
+
YAML_ERRORS = [ StandardError ]
|
74
76
|
|
77
|
+
# https://github.com/tenderlove/psych/issues/23
|
75
78
|
if defined?(Psych) && defined?(Psych::SyntaxError)
|
76
79
|
YAML_ERRORS << Psych::SyntaxError
|
77
80
|
end
|
@@ -127,7 +130,12 @@ module Middleman::CoreExtensions
|
|
127
130
|
# @param [String] path
|
128
131
|
# @return [Array<Thor::CoreExt::HashWithIndifferentAccess, String>]
|
129
132
|
def frontmatter_and_content(path)
|
130
|
-
full_path =
|
133
|
+
full_path = if Pathname(path).relative?
|
134
|
+
File.join(@app.source_dir, path)
|
135
|
+
else
|
136
|
+
path
|
137
|
+
end
|
138
|
+
|
131
139
|
data = {}
|
132
140
|
content = nil
|
133
141
|
|
@@ -155,7 +163,7 @@ module Middleman::CoreExtensions
|
|
155
163
|
end
|
156
164
|
|
157
165
|
def normalize_path(path)
|
158
|
-
path.sub(@app.source_dir, "")
|
166
|
+
path.sub(%r{^#{@app.source_dir}\/}, "")
|
159
167
|
end
|
160
168
|
|
161
169
|
# Update the main sitemap resource list
|
@@ -19,6 +19,9 @@ module Middleman
|
|
19
19
|
# Include methods
|
20
20
|
app.send :include, InstanceMethods
|
21
21
|
|
22
|
+
app.define_hook :before_render
|
23
|
+
app.define_hook :after_render
|
24
|
+
|
22
25
|
# Activate custom renderers
|
23
26
|
require "middleman-core/renderers/erb"
|
24
27
|
app.register Middleman::Renderers::ERb
|
@@ -243,13 +246,27 @@ module Middleman
|
|
243
246
|
options = opts.merge(options_for_ext(extension))
|
244
247
|
options[:outvar] ||= '@_out_buf'
|
245
248
|
|
249
|
+
template_class = Tilt[path]
|
250
|
+
# Allow hooks to manipulate the template before render
|
251
|
+
self.class.callbacks_for_hook(:before_render).each do |callback|
|
252
|
+
newbody = callback.call(body, path, locs, template_class)
|
253
|
+
body = newbody if newbody # Allow the callback to return nil to skip it
|
254
|
+
end
|
255
|
+
|
246
256
|
# Read compiled template from disk or cache
|
247
257
|
template = cache.fetch(:compiled_template, options, body) do
|
248
258
|
::Tilt.new(path, 1, options) { body }
|
249
259
|
end
|
250
260
|
|
251
261
|
# Render using Tilt
|
252
|
-
template.render(context, locs, &block)
|
262
|
+
content = template.render(context, locs, &block)
|
263
|
+
|
264
|
+
# Allow hooks to manipulate the result after render
|
265
|
+
self.class.callbacks_for_hook(:after_render).each do |callback|
|
266
|
+
content = callback.call(content, path, locs, template_class)
|
267
|
+
end
|
268
|
+
|
269
|
+
return content
|
253
270
|
ensure
|
254
271
|
# Reset stored buffer
|
255
272
|
@_out_buf = _buf_was
|
@@ -402,7 +419,7 @@ module Middleman
|
|
402
419
|
# Find the path by searching or using the cache
|
403
420
|
request_path = request_path.to_s
|
404
421
|
cache.fetch(:resolve_template, request_path, options) do
|
405
|
-
relative_path =
|
422
|
+
relative_path = Util.strip_leading_slash(request_path)
|
406
423
|
on_disk_path = File.expand_path(relative_path, self.source_dir)
|
407
424
|
|
408
425
|
# By default, any engine will do
|
@@ -11,25 +11,29 @@ module Middleman
|
|
11
11
|
class << self
|
12
12
|
# Once registered
|
13
13
|
def registered(app)
|
14
|
-
app.before_configuration do
|
15
|
-
template_extensions :coffee => :js
|
16
|
-
end
|
17
|
-
|
18
14
|
# Tell Tilt to use it as well (for inline scss blocks)
|
19
15
|
::Tilt.register 'coffee', DebuggingCoffeeScriptTemplate
|
20
16
|
::Tilt.prefer(DebuggingCoffeeScriptTemplate)
|
17
|
+
|
18
|
+
app.before_configuration do
|
19
|
+
template_extensions :coffee => :js
|
20
|
+
DebuggingCoffeeScriptTemplate.middleman_app = self
|
21
|
+
end
|
21
22
|
end
|
22
23
|
alias :included :registered
|
23
24
|
end
|
24
25
|
|
25
26
|
# A Template for Tilt which outputs debug messages
|
26
27
|
class DebuggingCoffeeScriptTemplate < ::Tilt::CoffeeScriptTemplate
|
28
|
+
# Make the current Middleman app accessible to the template
|
29
|
+
cattr_accessor :middleman_app
|
30
|
+
|
27
31
|
# Add exception messaging
|
28
32
|
# @param [Class] context
|
29
33
|
# @param [Hash] locals
|
30
34
|
# @return [String]
|
31
35
|
def evaluate(context, locals, &block)
|
32
|
-
return super if
|
36
|
+
return super if middleman_app.build?
|
33
37
|
|
34
38
|
begin
|
35
39
|
super
|
@@ -108,7 +108,7 @@ module Middleman
|
|
108
108
|
blank_metadata = { :options => {}, :locals => {}, :page => {}, :blocks => [] }
|
109
109
|
|
110
110
|
provides_metadata.inject(blank_metadata) do |result, (callback, matcher)|
|
111
|
-
next result if
|
111
|
+
next result if matcher && !source_file.match(matcher)
|
112
112
|
|
113
113
|
metadata = callback.call(source_file)
|
114
114
|
|
@@ -146,9 +146,9 @@ module Middleman
|
|
146
146
|
@_cached_metadata[request_path] = provides_metadata_for_path.inject(blank_metadata) do |result, (callback, matcher)|
|
147
147
|
case matcher
|
148
148
|
when Regexp
|
149
|
-
next result unless request_path
|
149
|
+
next result unless request_path =~ matcher
|
150
150
|
when String
|
151
|
-
next result unless File.fnmatch("/" +
|
151
|
+
next result unless File.fnmatch("/" + Util.strip_leading_slash(matcher), "/#{request_path}")
|
152
152
|
end
|
153
153
|
|
154
154
|
metadata = callback.call(request_path)
|
@@ -25,18 +25,18 @@ module Middleman
|
|
25
25
|
# Setup callbacks which can exclude paths from the sitemap
|
26
26
|
app.set :ignored_sitemap_matchers, {
|
27
27
|
# dotfiles and folders in the root
|
28
|
-
:root_dotfiles => proc { |file| file.
|
28
|
+
:root_dotfiles => proc { |file| file.start_with?('.') },
|
29
29
|
|
30
30
|
# Files starting with an dot, but not .htaccess
|
31
31
|
:source_dotfiles => proc { |file|
|
32
|
-
file
|
32
|
+
file =~ %r{/\.} && file !~ %r{/\.(htaccess|htpasswd)}
|
33
33
|
},
|
34
34
|
|
35
35
|
# Files starting with an underscore, but not a double-underscore
|
36
|
-
:partials => proc { |file| file
|
36
|
+
:partials => proc { |file| file =~ %r{/_} && file !~ %r{/__} },
|
37
37
|
|
38
38
|
:layout => proc { |file|
|
39
|
-
file.
|
39
|
+
file.start_with?('source/layout.') || file.start_with?('source/layouts/')
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
@@ -70,6 +70,7 @@ module Middleman
|
|
70
70
|
# Get the resource object for the current path
|
71
71
|
# @return [Middleman::Sitemap::Resource]
|
72
72
|
def current_resource
|
73
|
+
return nil unless current_path
|
73
74
|
sitemap.find_resource_by_destination_path(current_path)
|
74
75
|
end
|
75
76
|
|
data/lib/middleman-core/util.rb
CHANGED
@@ -10,6 +10,9 @@ require "thor"
|
|
10
10
|
# Core Pathname library used for traversal
|
11
11
|
require "pathname"
|
12
12
|
|
13
|
+
require "tilt"
|
14
|
+
require "rack/mime"
|
15
|
+
|
13
16
|
module Middleman
|
14
17
|
|
15
18
|
module Util
|
@@ -20,11 +23,19 @@ module Middleman
|
|
20
23
|
# @return [Boolean]
|
21
24
|
def self.binary?(filename)
|
22
25
|
ext = File.extname(filename)
|
26
|
+
return true if ext == '.svgz'
|
23
27
|
return false if Tilt.registered?(ext.sub('.',''))
|
24
28
|
|
25
29
|
ext = ".#{ext}" unless ext.to_s[0] == ?.
|
26
30
|
mime = ::Rack::Mime.mime_type(ext, nil)
|
27
|
-
|
31
|
+
unless mime
|
32
|
+
binary_bytes = [0, 1, 2, 3, 4, 5, 6, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31]
|
33
|
+
s = File.read(filename, 4096) || ''
|
34
|
+
s.each_byte do |c|
|
35
|
+
return true if binary_bytes.include?(c)
|
36
|
+
end
|
37
|
+
return false
|
38
|
+
end
|
28
39
|
return false if mime.start_with?('text/')
|
29
40
|
return false if mime.include?('xml')
|
30
41
|
return false if mime.include?('json')
|
@@ -76,7 +87,13 @@ module Middleman
|
|
76
87
|
# @return [String]
|
77
88
|
def self.normalize_path(path)
|
78
89
|
# The tr call works around a bug in Ruby's Unicode handling
|
79
|
-
path.sub(
|
90
|
+
path.sub(%r{^/}, "").tr('','')
|
91
|
+
end
|
92
|
+
|
93
|
+
# This is a separate method from normalize_path in case we
|
94
|
+
# change how we normalize paths
|
95
|
+
def self.strip_leading_slash(path)
|
96
|
+
path.sub(%r{^/}, "")
|
80
97
|
end
|
81
98
|
|
82
99
|
# Extract the text of a Rack response as a string.
|
@@ -33,6 +33,6 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_dependency("activesupport", ["~> 3.2.6"])
|
34
34
|
|
35
35
|
# Watcher
|
36
|
-
s.add_dependency("listen", ["~> 0.
|
37
|
-
s.add_dependency("wdm", ["~> 0.0
|
36
|
+
s.add_dependency("listen", ["~> 0.7.2"])
|
37
|
+
s.add_dependency("wdm", ["~> 0.1.0"]) # Windows
|
38
38
|
end
|
data/middleman-core.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "middleman-core/version"
|
2
|
+
require File.expand_path("../lib/middleman-core/version", __FILE__)
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "middleman-core"
|
@@ -33,7 +32,7 @@ Gem::Specification.new do |s|
|
|
33
32
|
s.add_dependency("activesupport", ["~> 3.2.6"])
|
34
33
|
|
35
34
|
# Watcher
|
36
|
-
s.add_dependency("listen", ["~> 0.
|
37
|
-
s.add_dependency("rb-fsevent", ["~> 0.9.
|
38
|
-
s.add_dependency("rb-inotify", ["~> 0.
|
35
|
+
s.add_dependency("listen", ["~> 0.7.2"])
|
36
|
+
s.add_dependency("rb-fsevent", ["~> 0.9.3"]) # OS X
|
37
|
+
# s.add_dependency("rb-inotify", ["~> 0.9.0"]) # Linux
|
39
38
|
end
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
Some plain text
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
明日がある。
|
@@ -0,0 +1 @@
|
|
1
|
+
明日がある。
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'middleman-core/util'
|
2
|
+
|
3
|
+
describe "Middleman::Util#binary?" do
|
4
|
+
%w(plain.txt unicode.txt unicode).each do |file|
|
5
|
+
it "recognizes #{file} as not binary" do
|
6
|
+
Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}")).should be_false
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
%w(middleman.png middleman stars.svgz).each do |file|
|
11
|
+
it "recognizes #{file} as binary" do
|
12
|
+
Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}")).should be_true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
ADDED
File without changes
|
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.
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.12.pre.1
|
5
|
+
prerelease: 7
|
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: 2013-
|
13
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
requirements:
|
116
116
|
- - ~>
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.
|
118
|
+
version: 0.7.2
|
119
119
|
type: :runtime
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
requirements:
|
124
124
|
- - ~>
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.
|
126
|
+
version: 0.7.2
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: wdm
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
requirements:
|
132
132
|
- - ~>
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: 0.0
|
134
|
+
version: 0.1.0
|
135
135
|
type: :runtime
|
136
136
|
prerelease: false
|
137
137
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -139,7 +139,7 @@ dependencies:
|
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: 0.0
|
142
|
+
version: 0.1.0
|
143
143
|
description: A static site generator. Provides dozens of templating languages (Haml,
|
144
144
|
Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache
|
145
145
|
busting, Yaml data (and more) an easy part of your development cycle.
|
@@ -575,6 +575,15 @@ files:
|
|
575
575
|
- lib/middleman/rack.rb
|
576
576
|
- middleman-core-x86-mingw32.gemspec
|
577
577
|
- middleman-core.gemspec
|
578
|
+
- spec/middleman-core/binary_spec.rb
|
579
|
+
- spec/middleman-core/binary_spec/middleman
|
580
|
+
- spec/middleman-core/binary_spec/middleman.png
|
581
|
+
- spec/middleman-core/binary_spec/plain.txt
|
582
|
+
- spec/middleman-core/binary_spec/stars.svgz
|
583
|
+
- spec/middleman-core/binary_spec/unicode
|
584
|
+
- spec/middleman-core/binary_spec/unicode.txt
|
585
|
+
- spec/middleman-core/sitemap_spec.rb
|
586
|
+
- spec/spec_helper.rb
|
578
587
|
homepage: http://middlemanapp.com
|
579
588
|
licenses:
|
580
589
|
- MIT
|
@@ -590,19 +599,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
590
599
|
version: '0'
|
591
600
|
segments:
|
592
601
|
- 0
|
593
|
-
hash:
|
602
|
+
hash: 2087095556849792709
|
594
603
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
595
604
|
none: false
|
596
605
|
requirements:
|
597
|
-
- - ! '
|
606
|
+
- - ! '>'
|
598
607
|
- !ruby/object:Gem::Version
|
599
|
-
version:
|
600
|
-
segments:
|
601
|
-
- 0
|
602
|
-
hash: -2883792952471512729
|
608
|
+
version: 1.3.1
|
603
609
|
requirements: []
|
604
610
|
rubyforge_project:
|
605
|
-
rubygems_version: 1.8.
|
611
|
+
rubygems_version: 1.8.23
|
606
612
|
signing_key:
|
607
613
|
specification_version: 3
|
608
614
|
summary: Hand-crafted frontend development
|