middleman-core 3.0.10.pre.1 → 3.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ Feature: Builder
14
14
  | images/Read me (example).txt |
15
15
  | images/Child folder/regular_file(example).txt |
16
16
  | .htaccess |
17
+ | .htpasswd |
17
18
  | feed.xml |
18
19
  Then the following files should not exist:
19
20
  | _partial |
@@ -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 "disable-watcher",
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
- :"disable-watcher" => options["disable-watcher"],
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
- begin
135
- if content =~ /\A.*coding:/
136
- lines = content.split(/\n/)
137
- lines.shift
138
- content = lines.join("\n")
139
- end
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
- if result = parse_yaml_front_matter(content)
142
- data, content = result
143
- elsif result = parse_json_front_matter(content)
144
- data, content = result
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[:"disable-watcher"]
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 .sass_cache directory.
17
+ # Location of SASS .sass-cache directory.
18
18
  # @return [String]
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
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
- s = (File.read(source_file, File.stat(source_file).blksize) || "").split(//)
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
@@ -3,7 +3,7 @@
3
3
  ###
4
4
 
5
5
  # Susy grids in Compass
6
- # First: gem install susy --pre
6
+ # First: gem install susy
7
7
  # require 'susy'
8
8
 
9
9
  # Change Compass configuration
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.0.10.pre.1' unless const_defined?(:VERSION)
4
+ VERSION = '3.0.11' unless const_defined?(:VERSION)
5
5
  end
@@ -35,7 +35,4 @@ Gem::Specification.new do |s|
35
35
  # Watcher
36
36
  s.add_dependency("listen", ["~> 0.5.2"])
37
37
  s.add_dependency("wdm", ["~> 0.0.3"]) # Windows
38
-
39
- # Detect binary
40
- s.add_dependency('win32-file', '>= 0.5.4')
41
38
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # Core
22
22
  s.add_dependency("bundler", ["~> 1.1"])
23
- s.add_dependency("rack", ["1.4.1"])
23
+ s.add_dependency("rack", ["~> 1.4.1"])
24
24
  s.add_dependency("tilt", ["~> 1.3.1"])
25
25
 
26
26
  # Builder
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.10.pre.1
5
- prerelease: 7
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-09 00:00:00.000000000 Z
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: 1006188105979529752
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: 1.3.1
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