Sha256: 352b0edf710e07abb5894ad6a703f106bcae4ade7976ed1b00c9fdaeee5e448f

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 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)
      {
        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

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.0.0rc1 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.0b4 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.0b3 lib/nanoc/cli/commands/shell.rb