Class: Nanoc::CLI::Commands::View Private

Inherits:
Nanoc::CLI::CommandRunner show all
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.

Instance Method Summary collapse

Methods inherited from Nanoc::CLI::CommandRunner

#call, #debug?, enter_site_dir, find_site_dir, #in_site_dir?, #load_site

Instance Method Details

#runObject

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.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/nanoc/cli/commands/view.rb', line 19

def run
  load_adsf

  config = Nanoc::Core::ConfigLoader.new.new_from_cwd

  # Create output dir so that viewer/watcher doesn’t explode.
  FileUtils.mkdir_p(config.output_dir)

  server =
    Adsf::Server.new(
      root: File.absolute_path(config.output_dir),
      live: options[:'live-reload'],
      index_filenames: config[:index_filenames],
      host: options[:host],
      port: options[:port],
      handler: options[:handler],
    )

  server.run
end