mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
Minor tweak to #1695
This commit is contained in:
parent
b0582bcebf
commit
4594f46fb8
8 changed files with 20 additions and 33 deletions
|
@ -398,7 +398,6 @@ module Middleman
|
|||
execute_callbacks(:before_shutdown)
|
||||
end
|
||||
|
||||
|
||||
# Set attributes (global variables)
|
||||
#
|
||||
# @deprecated Prefer accessing settings through "config".
|
||||
|
|
|
@ -37,7 +37,8 @@ module Middleman
|
|||
engine = extension[1..-1].to_sym
|
||||
|
||||
# Store last engine for later (could be inside nested renders)
|
||||
context.current_engine, engine_was = engine, context.current_engine
|
||||
context.current_engine = engine
|
||||
engine_was = context.current_engine
|
||||
|
||||
# Save current buffer for later
|
||||
buf_was = context.save_buffer
|
||||
|
|
|
@ -62,7 +62,7 @@ module Middleman
|
|||
# To output the child PID, let's make preview server a daemon by hand
|
||||
if child_pid = fork
|
||||
app.logger.info "== Middleman preview server is running in background with PID #{child_pid}"
|
||||
Process.detach child_pid
|
||||
Process.detach child_pid
|
||||
exit 0
|
||||
else
|
||||
$stdout.reopen('/dev/null', 'w')
|
||||
|
@ -183,7 +183,7 @@ module Middleman
|
|||
|
||||
app.logger.warn format('== The Middleman uses a different port "%s" then the configured one "%s" because some other server is listening on that port.', server_information.port, configured_port) unless app.config[:port] == configured_port
|
||||
|
||||
@environment = app.config[:environment]
|
||||
@environment = app.config[:environment]
|
||||
|
||||
@ssl_certificate = app.config[:ssl_certificate]
|
||||
@ssl_private_key = app.config[:ssl_private_key]
|
||||
|
|
|
@ -13,15 +13,15 @@ module Middleman
|
|||
attr_reader :server_name, :port, :site_addresses, :listeners
|
||||
|
||||
def initialize(server_information)
|
||||
@listeners = ServerUrl.new(
|
||||
@listeners = ServerUrl.new(
|
||||
hosts: server_information.listeners,
|
||||
port: server_information.port,
|
||||
port: server_information.port,
|
||||
https: server_information.https?,
|
||||
format_output: false
|
||||
).to_bind_addresses
|
||||
|
||||
@port = server_information.port
|
||||
@server_name = server_information.server_name.dup unless server_information.server_name == nil
|
||||
@server_name = server_information.server_name.dup unless server_information.server_name.nil?
|
||||
|
||||
@site_addresses = ServerUrl.new(
|
||||
hosts: server_information.site_addresses,
|
||||
|
|
|
@ -133,9 +133,7 @@ module Middleman
|
|||
locs[:current_path] ||= destination_path
|
||||
|
||||
# Certain output file types don't use layouts
|
||||
unless opts.key?(:layout)
|
||||
opts[:layout] = false if ext != '.html'
|
||||
end
|
||||
opts[:layout] = false unless opts.key?(:layout) || !ext != '.html'
|
||||
|
||||
renderer = ::Middleman::TemplateRenderer.new(@app, file_descriptor[:full_path].to_s)
|
||||
renderer.render(locs, opts)
|
||||
|
|
|
@ -182,14 +182,8 @@ module Middleman
|
|||
# @return [void]
|
||||
Contract Any
|
||||
def poll_once!
|
||||
removed = @files.keys
|
||||
|
||||
updated = []
|
||||
|
||||
::Middleman::Util.all_files_under(@directory.to_s).each do |filepath|
|
||||
removed.delete(filepath)
|
||||
updated << filepath
|
||||
end
|
||||
updated = ::Middleman::Util.all_files_under(@directory.to_s)
|
||||
removed = @files.keys.reject { |p| updated.include?(p) }
|
||||
|
||||
update(updated, removed)
|
||||
|
||||
|
@ -314,16 +308,10 @@ module Middleman
|
|||
# @return [Array] All related file paths, not including the source file paths.
|
||||
Contract ArrayOf[String] => ArrayOf[String]
|
||||
def find_related_files(files)
|
||||
files.map do |file|
|
||||
related_files = []
|
||||
|
||||
# If any SASS file changes, reload all non-partials
|
||||
if file =~ /\.(sass|scss)$/
|
||||
related_files |= Dir[File.join(@directory, app.config[:css_dir], '**/[^_]*.{scss,sass}')]
|
||||
end
|
||||
|
||||
related_files
|
||||
end.flatten.uniq - files
|
||||
files.flat_map do |file|
|
||||
# If any partial file changes, reload all non-partials
|
||||
Dir[File.join(@directory, app.config[:source], "**/[^_]*.#{File.extname(file)}")] if File.basename(file).start_with?('_')
|
||||
end.compact.uniq - files
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,7 +42,8 @@ module Middleman
|
|||
# @api private
|
||||
# @return [String] The old buffer.
|
||||
def save_buffer
|
||||
@_out_buf, buf_was = '', @_out_buf
|
||||
buf_was = @_out_buf
|
||||
@_out_buf = ''
|
||||
buf_was
|
||||
end
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ module Middleman::Util::Data
|
|||
end
|
||||
|
||||
start_delims, stop_delims = frontmatter_delims
|
||||
.values
|
||||
.flatten(1)
|
||||
.transpose
|
||||
.map(&Regexp.method(:union))
|
||||
.values
|
||||
.flatten(1)
|
||||
.transpose
|
||||
.map(&Regexp.method(:union))
|
||||
|
||||
match = /
|
||||
\A(?:[^\r\n]*coding:[^\r\n]*\r?\n)?
|
||||
|
|
Loading…
Reference in a new issue