Sha256: 03fe8c5874c834512d28edd7f0140e22857b381bbc2e95e8f331fab8bea04248

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 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'

      require_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::ItemCollectionView.new(site.items),
        layouts: Nanoc::LayoutCollectionView.new(site.layouts),
        config: Nanoc::ConfigView.new(site.config),
      }
    end
  end
end

runner Nanoc::CLI::Commands::Shell

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nanoc-4.0.2 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.1 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.0 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.0rc3 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.0rc2 lib/nanoc/cli/commands/shell.rb