# File lib/nanoc/cli/commands/autocompile.rb, line 28 def run warn 'WARNING: The `autocompile` command is deprecated. Please consider using `guard-nanoc` instead (see https://github.com/nanoc/guard-nanoc).' require 'rack' # Make sure we are in a nanoc site directory self.require_site autocompile_config = self.site.config[:autocompile] || {} # Set options options_for_rack = { :Port => (options[:port] || autocompile_config[:port] || 3000).to_i, :Host => (options[:host] || autocompile_config[:host] || '0.0.0.0') } # Guess which handler we should use handler_option = options[:handler] || autocompile_config[:handler] unless handler = Rack::Handler.get(handler_option) begin handler = Rack::Handler::Mongrel rescue LoadError => e handler = Rack::Handler::WEBrick end end # Build app autocompiler = Nanoc::Extra::AutoCompiler.new('.') app = Rack::Builder.new do use Rack::CommonLogger, $stderr use Rack::ShowExceptions run autocompiler end.to_app # Run autocompiler puts "Running on http://#{options_for_rack[:Host]}:#{options_for_rack[:Port]}/" handler.run(app, options_for_rack) end
Generated with the Darkfish Rdoc Generator 2.