Sha256: 44f074df62eead146a0a1f201a9d63452d047b3a5701fd128a07dae5b1bb272f

Contents?: true

Size: 714 Bytes

Versions: 17

Compression:

Stored size: 714 Bytes

Contents

usage 'shell'
summary 'open a shell on the Nanoc environment'
aliases 'console'
description "
Open an IRB shell on a context that contains @items, @layouts, and @config.
"

module Nanoc::CLI::Commands
  class Shell < ::Nanoc::CLI::CommandRunner
    def run
      require 'pry'

      load_site

      Nanoc::Int::Context.new(env).pry
    end

    protected

    def env
      self.class.env_for_site(site)
    end

    def self.env_for_site(site)
      {
        items: Nanoc::ItemCollectionWithRepsView.new(site.items, nil),
        layouts: Nanoc::LayoutCollectionView.new(site.layouts, nil),
        config: Nanoc::ConfigView.new(site.config, nil),
      }
    end
  end
end

runner Nanoc::CLI::Commands::Shell

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
nanoc-4.3.5 lib/nanoc/cli/commands/shell.rb
nanoc-4.3.4 lib/nanoc/cli/commands/shell.rb
nanoc-4.3.3 lib/nanoc/cli/commands/shell.rb
nanoc-4.3.2 lib/nanoc/cli/commands/shell.rb
nanoc-4.3.1 lib/nanoc/cli/commands/shell.rb
nanoc-4.3.0 lib/nanoc/cli/commands/shell.rb
nanoc-4.2.4 lib/nanoc/cli/commands/shell.rb
nanoc-4.2.3 lib/nanoc/cli/commands/shell.rb
nanoc-4.2.2 lib/nanoc/cli/commands/shell.rb
nanoc-4.2.1 lib/nanoc/cli/commands/shell.rb
nanoc-4.2.0 lib/nanoc/cli/commands/shell.rb
nanoc-4.1.6 lib/nanoc/cli/commands/shell.rb
nanoc-4.2.0b1 lib/nanoc/cli/commands/shell.rb
nanoc-4.1.5 lib/nanoc/cli/commands/shell.rb
nanoc-4.1.4 lib/nanoc/cli/commands/shell.rb
nanoc-4.1.3 lib/nanoc/cli/commands/shell.rb
nanoc-4.1.2 lib/nanoc/cli/commands/shell.rb