mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
Remove FormatStringToken exemption
This commit is contained in:
parent
ffe6fd27d1
commit
93dcde2bb2
5 changed files with 59 additions and 16 deletions
|
@ -59,8 +59,6 @@ Style/MethodMissingSuper:
|
|||
Enabled: false
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
Style/FormatStringToken:
|
||||
Enabled: false
|
||||
Style/EvalWithLocation:
|
||||
Enabled: false
|
||||
Style/Lambda:
|
||||
|
|
|
@ -42,9 +42,9 @@ module Middleman
|
|||
|
||||
app.logger.debug %(== Server information is provided by #{server_information.handler})
|
||||
app.logger.debug %(== The Middleman is running in "#{environment}" environment)
|
||||
app.logger.debug format('== The Middleman preview server is bound to %s', ServerUrl.new(hosts: server_information.listeners, port: server_information.port, https: server_information.https?).to_bind_addresses.join(', '))
|
||||
app.logger.info format('== View your site at %s', ServerUrl.new(hosts: server_information.site_addresses, port: server_information.port, https: server_information.https?).to_urls.join(', '))
|
||||
app.logger.info format('== Inspect your site configuration at %s', ServerUrl.new(hosts: server_information.site_addresses, port: server_information.port, https: server_information.https?).to_config_urls.join(', '))
|
||||
app.logger.debug format('== The Middleman preview server is bound to %<url>s', url: ServerUrl.new(hosts: server_information.listeners, port: server_information.port, https: server_information.https?).to_bind_addresses.join(', '))
|
||||
app.logger.info format('== View your site at %<url>s', url: ServerUrl.new(hosts: server_information.site_addresses, port: server_information.port, https: server_information.https?).to_urls.join(', '))
|
||||
app.logger.info format('== Inspect your site configuration at %<url>s', url: ServerUrl.new(hosts: server_information.site_addresses, port: server_information.port, https: server_information.https?).to_config_urls.join(', '))
|
||||
|
||||
@initialized ||= false
|
||||
return if @initialized
|
||||
|
@ -187,7 +187,13 @@ module Middleman
|
|||
server_name: possible_from_cli(:server_name, app.config),
|
||||
https: possible_from_cli(:https, app.config))
|
||||
|
||||
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 server_information.port == configured_port
|
||||
unless server_information.port == configured_port
|
||||
app.logger.warn format(
|
||||
'== The Middleman uses a different port "%<new_port>s" then the configured one "%<old_port>s" because some other server is listening on that port.',
|
||||
new_port: server_information.port,
|
||||
old_port: configured_port
|
||||
)
|
||||
end
|
||||
|
||||
@environment = possible_from_cli(:environment, app.config)
|
||||
|
||||
|
|
|
@ -34,7 +34,11 @@ module Middleman
|
|||
return if resolver.ips_for(information.server_name).include? information.bind_address
|
||||
|
||||
information.valid = false
|
||||
information.reason = format('Server name "%s" does not resolve to bind address "%s"', information.server_name, information.bind_address)
|
||||
information.reason = format(
|
||||
'Server name "%<name>s" does not resolve to bind address "%<addr>s"',
|
||||
name: information.server_name,
|
||||
addr: information.bind_address
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -49,7 +53,11 @@ module Middleman
|
|||
return if information.bind_address.blank? || information.local_network_interfaces.include?(information.bind_address.to_s) || %w[0.0.0.0 ::].any? { |b| information.bind_address == b } || IPAddr.new('127.0.0.0/8').include?(information.bind_address.to_s)
|
||||
|
||||
information.valid = false
|
||||
information.reason = format('Bind address "%s" is not available on your system. Please use one of %s', information.bind_address, information.local_network_interfaces.map { |i| %("#{i}") }.join(', '))
|
||||
information.reason = format(
|
||||
'Bind address "%<bad_addr>s" is not available on your system. Please use one of %<good_addrs>s',
|
||||
bad_addr: information.bind_address,
|
||||
good_addrs: information.local_network_interfaces.map { |i| %("#{i}") }.join(', ')
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -61,7 +69,10 @@ module Middleman
|
|||
return unless information.bind_address.blank?
|
||||
|
||||
information.valid = false
|
||||
information.reason = format('Server name "%s" does not resolve to an ip address', information.server_name)
|
||||
information.reason = format(
|
||||
'Server name "%<name>s" does not resolve to an ip address',
|
||||
name: information.server_name
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ module Middleman
|
|||
end
|
||||
|
||||
def to_browser
|
||||
format('[%s]', to_s)
|
||||
format('[%<addr>s]', addr: to_s)
|
||||
end
|
||||
|
||||
if RUBY_VERSION < '2'
|
||||
|
|
|
@ -23,9 +23,9 @@ module Middleman
|
|||
# List of bind addresses of format host:port
|
||||
def to_bind_addresses
|
||||
if format_output
|
||||
hosts.map { |l| format('"%s:%s"', l.to_s, port) }
|
||||
hosts.map { |l| format('"%<host>s:%<port>s"', host: l.to_s, port: port) }
|
||||
else
|
||||
hosts.map { |l| format('%s:%s', l.to_s, port) }
|
||||
hosts.map { |l| format('%<host>s:%<port>s', host: l.to_s, port: port) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,9 +35,23 @@ module Middleman
|
|||
# List of urls of format http://host:port
|
||||
def to_urls
|
||||
if format_output
|
||||
hosts.map { |l| format('"%s://%s:%s"', https? ? 'https' : 'http', l.to_browser, port) }
|
||||
hosts.map do |l|
|
||||
format(
|
||||
'"%<protocol>s://%<host>s:%<port>s"',
|
||||
protocol: https? ? 'https' : 'http',
|
||||
host: l.to_browser,
|
||||
port: port
|
||||
)
|
||||
end
|
||||
else
|
||||
hosts.map { |l| format('%s://%s:%s', https? ? 'https' : 'http', l.to_browser, port) }
|
||||
hosts.map do |l|
|
||||
format(
|
||||
'%<protocol>s://%<host>s:%<port>s',
|
||||
protocol: https? ? 'https' : 'http',
|
||||
host: l.to_browser,
|
||||
port: port
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -47,9 +61,23 @@ module Middleman
|
|||
# List of urls of format http://host:port/__middleman
|
||||
def to_config_urls
|
||||
if format_output
|
||||
hosts.map { |l| format('"%s://%s:%s/__middleman"', https? ? 'https' : 'http', l.to_browser, port) }
|
||||
hosts.map do |l|
|
||||
format(
|
||||
'"%<protocol>s://%<host>s:%<port>s/__middleman"',
|
||||
protocol: https? ? 'https' : 'http',
|
||||
host: l.to_browser,
|
||||
port: port
|
||||
)
|
||||
end
|
||||
else
|
||||
hosts.map { |l| format('%s://%s:%s/__middleman', https? ? 'https' : 'http', l.to_browser, port) }
|
||||
hosts.map do |l|
|
||||
format(
|
||||
'%<protocol>s://%<host>s:%<port>s/__middleman',
|
||||
protocol: https? ? 'https' : 'http',
|
||||
host: l.to_browser,
|
||||
port: port
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue