Merge pull request #1199 from middleman/cross-platform-localhost

Friendlier localhost print
This commit is contained in:
Ben Hollis 2014-03-14 15:25:32 -07:00
commit fc3658bc9d

View file

@ -19,8 +19,8 @@ module Middleman
@port = @options[:port] || DEFAULT_PORT @port = @options[:port] || DEFAULT_PORT
mount_instance(new_app) mount_instance(new_app)
logger.info "== The Middleman is standing watch at http://#{host}:#{port}" logger.info "== The Middleman is standing watch at #{uri}"
logger.info "== Inspect your site configuration at http://#{host}:#{port}/__middleman/" logger.info "== Inspect your site configuration at #{uri + '__middleman'}"
@initialized ||= false @initialized ||= false
unless @initialized unless @initialized
@ -226,6 +226,14 @@ module Middleman
end end
end end
end end
# Returns the URI the preview server will run on
# @return [URI]
def uri
host = (@host == '0.0.0.0') ? 'localhost' : @host
URI("http://#{host}:#{@port}")
end
end end
class FilteredWebrickLog < ::WEBrick::Log class FilteredWebrickLog < ::WEBrick::Log