Class: Nanoc::CLI::Commands::View Private
- Inherits:
-
Nanoc::CLI::CommandRunner
- Object
- Cri::CommandRunner
- Nanoc::CLI::CommandRunner
- Nanoc::CLI::Commands::View
- Defined in:
- lib/nanoc/cli/commands/view.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- DEFAULT_HANDLER_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
:thin
Instance Method Summary collapse
- #run ⇒ Object private
Methods inherited from Nanoc::CLI::CommandRunner
#call, #debug?, #in_site_dir?, #load_site, #site, #site=
Instance Method Details
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/nanoc/cli/commands/view.rb', line 17 def run load_adsf require 'rack' load_site # Set options = { Port: ([:port] || 3000).to_i, Host: ([:host] || '0.0.0.0'), } # Get handler if .key?(:handler) handler = Rack::Handler.get([:handler]) else begin handler = Rack::Handler.get(DEFAULT_HANDLER_NAME) rescue LoadError handler = Rack::Handler::WEBrick end end # Build app site = self.site app = Rack::Builder.new do use Rack::CommonLogger use Rack::ShowExceptions use Rack::Lint use Rack::Head use Adsf::Rack::IndexFileFinder, root: site.config[:output_dir] run Rack::File.new(site.config[:output_dir]) end.to_app # Run autocompiler handler.run(app, ) end |