Class: Nanoc::CLI::Commands::Shell Private
- Inherits:
-
Nanoc::CLI::CommandRunner
- Object
- Cri::CommandRunner
- Nanoc::CLI::CommandRunner
- Nanoc::CLI::Commands::Shell
- Defined in:
- lib/nanoc/cli/commands/shell.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.
Class Method Summary collapse
- .env_for_site(site) ⇒ Object private
- .reps_for(site) ⇒ Object private
- .view_context_for(site) ⇒ Object private
Instance Method Summary collapse
- #env ⇒ Object private
- #run ⇒ Object private
Methods inherited from Nanoc::CLI::CommandRunner
#call, #debug?, enter_site_dir, find_site_dir, #in_site_dir?, #load_site
Class Method Details
.env_for_site(site) ⇒ 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.
45 46 47 48 49 50 51 52 53 |
# File 'lib/nanoc/cli/commands/shell.rb', line 45 def self.env_for_site(site) view_context = view_context_for(site) { items: Nanoc::Core::ItemCollectionWithRepsView.new(site.items, view_context), layouts: Nanoc::Core::LayoutCollectionView.new(site.layouts, view_context), config: Nanoc::Core::ConfigView.new(site.config, view_context), } end |
.reps_for(site) ⇒ 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.
30 31 32 33 34 35 36 |
# File 'lib/nanoc/cli/commands/shell.rb', line 30 def self.reps_for(site) Nanoc::Core::ItemRepRepo.new.tap do |reps| action_provider = Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site) builder = Nanoc::Core::ItemRepBuilder.new(site, action_provider, reps) builder.run end end |
.view_context_for(site) ⇒ 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.
38 39 40 41 42 43 |
# File 'lib/nanoc/cli/commands/shell.rb', line 38 def self.view_context_for(site) Nanoc::Core::ViewContextForShell.new( items: site.items, reps: reps_for(site), ) end |
Instance Method Details
#env ⇒ 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.
26 27 28 |
# File 'lib/nanoc/cli/commands/shell.rb', line 26 def env self.class.env_for_site(@site) end |
#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.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nanoc/cli/commands/shell.rb', line 14 def run require 'pry' # Needed to make pry behave properly sometimes -- see nanoc/nanoc#1309 Signal.trap('SIGINT') { raise Interrupt } @site = load_site Nanoc::Core::Compiler.new_for(@site).run_until_preprocessed if [:preprocess] Nanoc::Core::Context.new(env).pry end |