middleman-core 3.0.0.rc.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -206,12 +206,12 @@ module Middleman::Cli
206
206
  # @return [void]
207
207
  def queue_current_paths
208
208
  @cleaning_queue = []
209
- Find.find(@destination) do |path|
210
- next if path.match(/\/\./) && !path.match(/\.htaccess/)
211
- unless path == destination
212
- @cleaning_queue << Pathname.new(path)
213
- end
214
- end if File.exist?(@destination)
209
+ return unless File.exist?(@destination)
210
+
211
+ paths = ::Middleman::Util.all_files_under(@destination)
212
+ @cleaning_queue += paths.select do |path|
213
+ !path.to_s.match(/\/\./) || path.to_s.match(/\.htaccess/)
214
+ end
215
215
  end
216
216
 
217
217
  # Actually build the app
@@ -10,7 +10,7 @@ module Middleman
10
10
  def registered(app)
11
11
  # Setup a default helpers paths
12
12
  app.set :helpers_dir, "helpers"
13
- app.set :helpers_filename_glob, "**/*.rb"
13
+ app.set :helpers_filename_glob, "**{,/*/**}/*.rb"
14
14
  app.set :helpers_filename_to_module_name_proc, Proc.new { |filename|
15
15
  basename = File.basename(filename, File.extname(filename))
16
16
  basename.camelcase
@@ -16,7 +16,8 @@ module Middleman
16
16
  /^\.rbenv-.*$/,
17
17
  /^Gemfile$/,
18
18
  /^Gemfile\.lock$/,
19
- /~$/
19
+ /~$/,
20
+ /(^|\/)\.?#/
20
21
  ]
21
22
 
22
23
  # Setup extension
@@ -112,9 +113,8 @@ module Middleman
112
113
  glob = "#{path}**/*"
113
114
  subset = @known_paths.select { |p| p.fnmatch(glob) }
114
115
 
115
- path.find do |filepath|
116
+ ::Middleman::Util.all_files_under(path).each do |filepath|
116
117
  full_path = path + filepath
117
- next if full_path.directory?
118
118
 
119
119
  if only_new
120
120
  next if subset.include?(full_path)
@@ -161,4 +161,4 @@ module Middleman
161
161
  end
162
162
  end
163
163
  end
164
- end
164
+ end
@@ -1,3 +1,5 @@
1
+ require "webrick"
2
+
1
3
  module Middleman
2
4
 
3
5
  WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
@@ -11,8 +13,6 @@ module Middleman
11
13
  # Start an instance of Middleman::Application
12
14
  # @return [void]
13
15
  def start(options={})
14
- require "webrick"
15
-
16
16
  app = ::Middleman::Application.server.inst do
17
17
  if options[:environment]
18
18
  set :environment, options[:environment].to_sym
@@ -140,8 +140,10 @@ module Middleman
140
140
  :AccessLog => []
141
141
  }
142
142
 
143
- unless is_logging
144
- http_opts[:Logger] = ::WEBrick::Log::new(nil, 0)
143
+ if is_logging
144
+ http_opts[:Logger] = FilteredWebrickLog.new
145
+ else
146
+ http_opts[:Logger] = ::WEBrick::Log.new(nil, 0)
145
147
  end
146
148
 
147
149
  ::WEBrick::HTTPServer.new(http_opts)
@@ -171,5 +173,13 @@ module Middleman
171
173
  end
172
174
  end
173
175
  end
176
+
177
+ class FilteredWebrickLog < ::WEBrick::Log
178
+ def log(level, data)
179
+ unless data =~ %r{Could not determine content-length of response body.}
180
+ super(level, data)
181
+ end
182
+ end
183
+ end
174
184
  end
175
185
  end
@@ -31,7 +31,9 @@ module Middleman
31
31
  def evaluate(context, locals, &block)
32
32
  begin
33
33
  super
34
- rescue ::ExecJS::RuntimeError=> e
34
+ rescue ::ExecJS::RuntimeError => e
35
+ e.to_s
36
+ rescue => e
35
37
  e.to_s
36
38
  end
37
39
  end
@@ -74,6 +74,21 @@ module Middleman
74
74
  File.fnmatch(matcher.to_s, path)
75
75
  end
76
76
  end
77
+
78
+ # Get a recusive list of files inside a set of paths.
79
+ # Works with symlinks.
80
+ #
81
+ # @param path A path string or Pathname
82
+ # @return [Array] An array of filenames
83
+ def self.all_files_under(*paths)
84
+ paths.flatten!
85
+ paths.map! { |p| Pathname(p) }
86
+ files = paths.select { |p| p.file? }
87
+ paths.select {|p| p.directory? }.each do |dir|
88
+ files << all_files_under(dir.children)
89
+ end
90
+ files.flatten
91
+ end
77
92
 
78
93
  # Simple shared cache implementation
79
94
  class Cache
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.0.0.rc.4' unless const_defined?(:VERSION)
4
+ VERSION = '3.0.0' unless const_defined?(:VERSION)
5
5
  end
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.0.rc.4
5
- prerelease: 6
4
+ version: 3.0.0
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: 2012-07-04 00:00:00.000000000 Z
13
+ date: 2012-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -530,16 +530,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
530
530
  version: '0'
531
531
  segments:
532
532
  - 0
533
- hash: 362783579195130288
533
+ hash: 3714652259442749458
534
534
  required_rubygems_version: !ruby/object:Gem::Requirement
535
535
  none: false
536
536
  requirements:
537
- - - ! '>'
537
+ - - ! '>='
538
538
  - !ruby/object:Gem::Version
539
- version: 1.3.1
539
+ version: '0'
540
+ segments:
541
+ - 0
542
+ hash: 3714652259442749458
540
543
  requirements: []
541
544
  rubyforge_project:
542
- rubygems_version: 1.8.23
545
+ rubygems_version: 1.8.24
543
546
  signing_key:
544
547
  specification_version: 3
545
548
  summary: Hand-crafted frontend development