middleman-core 3.0.10.pre.1 → 3.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/features/builder.feature +1 -0
- data/fixtures/large-build-app/source/.htpasswd +1 -0
- data/lib/middleman-core/cli/build.rb +1 -1
- data/lib/middleman-core/cli/server.rb +8 -3
- data/lib/middleman-core/core_extensions/front_matter.rb +17 -13
- data/lib/middleman-core/preview_server.rb +2 -2
- data/lib/middleman-core/renderers/sass.rb +3 -3
- data/lib/middleman-core/sitemap.rb +1 -1
- data/lib/middleman-core/sitemap/resource.rb +1 -4
- data/lib/middleman-core/templates/shared/config.tt +1 -1
- data/lib/middleman-core/util.rb +18 -0
- data/lib/middleman-core/version.rb +1 -1
- data/middleman-core-x86-mingw32.gemspec +0 -3
- data/middleman-core.gemspec +1 -1
- metadata +13 -8
data/features/builder.feature
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
# .htpasswd
|
@@ -231,7 +231,7 @@ module Middleman::Cli
|
|
231
231
|
|
232
232
|
paths = ::Middleman::Util.all_files_under(@destination)
|
233
233
|
@cleaning_queue += paths.select do |path|
|
234
|
-
!path.to_s.match(/\/\./) || path.to_s.match(/\.htaccess/)
|
234
|
+
!path.to_s.match(/\/\./) || path.to_s.match(/\.htaccess|\.htpasswd/)
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
@@ -29,7 +29,7 @@ module Middleman::Cli
|
|
29
29
|
:type => :string,
|
30
30
|
:default => false,
|
31
31
|
:desc => 'Print instrument messages'
|
32
|
-
method_option
|
32
|
+
method_option :disable_watcher,
|
33
33
|
:type => :boolean,
|
34
34
|
:default => false,
|
35
35
|
:desc => 'Disable the file change and delete watcher process'
|
@@ -41,6 +41,10 @@ module Middleman::Cli
|
|
41
41
|
:type => :string,
|
42
42
|
:default => false,
|
43
43
|
:desc => 'Additional paths to auto-reload when files change'
|
44
|
+
method_option :force_polling,
|
45
|
+
:type => :boolean,
|
46
|
+
:default => false,
|
47
|
+
:desc => 'Force file watcher into polling mode'
|
44
48
|
|
45
49
|
# Start the server
|
46
50
|
def server
|
@@ -60,8 +64,9 @@ module Middleman::Cli
|
|
60
64
|
:environment => options["environment"],
|
61
65
|
:debug => options["verbose"],
|
62
66
|
:instrumenting => options["instrument"],
|
63
|
-
:
|
64
|
-
:reload_paths => options["reload_paths"]
|
67
|
+
:disable_watcher => options["disable_watcher"],
|
68
|
+
:reload_paths => options["reload_paths"],
|
69
|
+
:force_polling => options["force_polling"]
|
65
70
|
}
|
66
71
|
|
67
72
|
puts "== The Middleman is loading"
|
@@ -128,23 +128,27 @@ module Middleman::CoreExtensions
|
|
128
128
|
# @return [Array<Thor::CoreExt::HashWithIndifferentAccess, String>]
|
129
129
|
def frontmatter_and_content(path)
|
130
130
|
full_path = File.expand_path(File.join(@app.source_dir, path))
|
131
|
-
content = File.read(full_path)
|
132
131
|
data = {}
|
132
|
+
content = nil
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
content
|
139
|
-
|
134
|
+
if !::Middleman::Util.binary?(full_path)
|
135
|
+
content = File.read(full_path)
|
136
|
+
|
137
|
+
begin
|
138
|
+
if content =~ /\A.*coding:/
|
139
|
+
lines = content.split(/\n/)
|
140
|
+
lines.shift
|
141
|
+
content = lines.join("\n")
|
142
|
+
end
|
140
143
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
144
|
+
if result = parse_yaml_front_matter(content)
|
145
|
+
data, content = result
|
146
|
+
elsif result = parse_json_front_matter(content)
|
147
|
+
data, content = result
|
148
|
+
end
|
149
|
+
rescue => e
|
150
|
+
# Probably a binary file, move on
|
145
151
|
end
|
146
|
-
rescue => e
|
147
|
-
# Probably a binary file, move on
|
148
152
|
end
|
149
153
|
|
150
154
|
[::Middleman::Util.recursively_enhance(data).freeze, content]
|
@@ -80,14 +80,14 @@ module Middleman
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def start_file_watcher
|
83
|
-
return if @options[:
|
83
|
+
return if @options[:disable_watcher]
|
84
84
|
|
85
85
|
first_run = !@listener
|
86
86
|
|
87
87
|
if first_run
|
88
88
|
# Watcher Library
|
89
89
|
require "listen"
|
90
|
-
@listener = Listen.to(Dir.pwd, :relative_paths => true)
|
90
|
+
@listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling])
|
91
91
|
end
|
92
92
|
|
93
93
|
@listener.change do |modified, added, removed|
|
@@ -14,10 +14,10 @@ module Middleman
|
|
14
14
|
# Default sass options
|
15
15
|
app.set :sass, {}
|
16
16
|
|
17
|
-
# Location of SASS .
|
17
|
+
# Location of SASS .sass-cache directory.
|
18
18
|
# @return [String]
|
19
|
-
# set :sass_cache_path, "/tmp/middleman-app-name/
|
20
|
-
app.set(:sass_cache_path) { File.join(app.root_path, '.
|
19
|
+
# set :sass_cache_path, "/tmp/middleman-app-name/sass-cache"
|
20
|
+
app.set(:sass_cache_path) { File.join(app.root_path, '.sass-cache') } # runtime compile of path
|
21
21
|
|
22
22
|
app.before_configuration do
|
23
23
|
template_extensions :scss => :css,
|
@@ -29,7 +29,7 @@ module Middleman
|
|
29
29
|
|
30
30
|
# Files starting with an dot, but not .htaccess
|
31
31
|
:source_dotfiles => proc { |file|
|
32
|
-
file.match(%r{/\.}) && !file.match(%r{/\.htaccess})
|
32
|
+
file.match(%r{/\.}) && !file.match(%r{/\.htaccess|\.htpasswd})
|
33
33
|
},
|
34
34
|
|
35
35
|
# Files starting with an underscore, but not a double-underscore
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require "middleman-core/sitemap/extensions/traversal"
|
2
2
|
|
3
|
-
require 'win32/file' if File::ALT_SEPARATOR
|
4
|
-
|
5
3
|
module Middleman
|
6
4
|
|
7
5
|
# Sitemap namespace
|
@@ -153,8 +151,7 @@ module Middleman
|
|
153
151
|
#
|
154
152
|
# @retrun [Boolean]
|
155
153
|
def binary?
|
156
|
-
|
157
|
-
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
|
154
|
+
::Middleman::Util.binary?(source_file)
|
158
155
|
end
|
159
156
|
end
|
160
157
|
end
|
data/lib/middleman-core/util.rb
CHANGED
@@ -14,6 +14,24 @@ module Middleman
|
|
14
14
|
|
15
15
|
module Util
|
16
16
|
|
17
|
+
# Whether the source file is binary.
|
18
|
+
#
|
19
|
+
# @param [String] filename The file to check.
|
20
|
+
# @return [Boolean]
|
21
|
+
def self.binary?(filename)
|
22
|
+
ext = File.extname(filename)
|
23
|
+
return false if Tilt.registered?(ext.sub('.',''))
|
24
|
+
|
25
|
+
ext = ".#{ext}" unless ext.to_s[0] == ?.
|
26
|
+
mime = ::Rack::Mime.mime_type(ext, nil)
|
27
|
+
return false unless mime
|
28
|
+
return false if mime.start_with?('text/')
|
29
|
+
return false if mime.include?('xml')
|
30
|
+
return false if mime.include?('json')
|
31
|
+
return false if mime.include?('javascript')
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
17
35
|
# The logger
|
18
36
|
#
|
19
37
|
# @return [Middleman::Logger] The logger
|
data/middleman-core.gemspec
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.11
|
5
|
+
prerelease:
|
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-01-
|
13
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
|
-
- -
|
36
|
+
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: 1.4.1
|
39
39
|
type: :runtime
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.4.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
@@ -332,6 +332,7 @@ files:
|
|
332
332
|
- fixtures/instance-vars-app/source/layout.erb
|
333
333
|
- fixtures/large-build-app/config.rb
|
334
334
|
- fixtures/large-build-app/source/.htaccess
|
335
|
+
- fixtures/large-build-app/source/.htpasswd
|
335
336
|
- fixtures/large-build-app/source/_partial.erb
|
336
337
|
- fixtures/large-build-app/source/feed.xml.builder
|
337
338
|
- fixtures/large-build-app/source/images/Child folder/regular_file(example).txt
|
@@ -605,13 +606,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
605
606
|
version: '0'
|
606
607
|
segments:
|
607
608
|
- 0
|
608
|
-
hash:
|
609
|
+
hash: 714789105575917864
|
609
610
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
610
611
|
none: false
|
611
612
|
requirements:
|
612
|
-
- - ! '
|
613
|
+
- - ! '>='
|
613
614
|
- !ruby/object:Gem::Version
|
614
|
-
version:
|
615
|
+
version: '0'
|
616
|
+
segments:
|
617
|
+
- 0
|
618
|
+
hash: 714789105575917864
|
615
619
|
requirements: []
|
616
620
|
rubyforge_project:
|
617
621
|
rubygems_version: 1.8.24
|
@@ -779,6 +783,7 @@ test_files:
|
|
779
783
|
- fixtures/instance-vars-app/source/layout.erb
|
780
784
|
- fixtures/large-build-app/config.rb
|
781
785
|
- fixtures/large-build-app/source/.htaccess
|
786
|
+
- fixtures/large-build-app/source/.htpasswd
|
782
787
|
- fixtures/large-build-app/source/_partial.erb
|
783
788
|
- fixtures/large-build-app/source/feed.xml.builder
|
784
789
|
- fixtures/large-build-app/source/images/Child folder/regular_file(example).txt
|