Sha256: 2b11cc44a88fe1777d193a40d604a11935868a3cfa22ecdfda7210a4c8933ada

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

# encoding: utf-8

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

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 lib/nanoc/cli/commands/shell.rb
nanoc-4.0.0b1 lib/nanoc/cli/commands/shell.rb