Class: Nanoc3::CLI::Commands::AutoCompile
- Inherits:
-
Nanoc3::CLI::Command
- Object
- Nanoc3::CLI::Command
- Nanoc3::CLI::Commands::AutoCompile
- Defined in:
- lib/nanoc3/cli/commands/autocompile.rb
Instance Attribute Summary
Attributes inherited from Nanoc3::CLI::Command
#arguments, #command, #options
Instance Method Summary collapse
Methods inherited from Nanoc3::CLI::Command
#call, call, #initialize, #site
Constructor Details
This class inherits a constructor from Nanoc3::CLI::Command
Instance Method Details
#run ⇒ Object
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 54 55 56 |
# File 'lib/nanoc3/cli/commands/autocompile.rb', line 24 def run require 'rack' # Make sure we are in a nanoc site directory self.require_site # Set options = { :Port => ([:port] || 3000).to_i, :Host => ([:host] || '0.0.0.0') } # Guess which handler we should use unless handler = Rack::Handler.get([:handler]) begin handler = Rack::Handler::Mongrel rescue LoadError => e handler = Rack::Handler::WEBrick end end # Build app autocompiler = Nanoc3::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://#{[:Host]}:#{[:Port]}/" handler.run(app, ) end |