Sha256: 3e678ce1d011ae48d01fe745088fca85a2fd437818ab4ccac4782d3f826b1aea

Contents?: true

Size: 569 Bytes

Versions: 2

Compression:

Stored size: 569 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, @config and @site.
"

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

      require_site

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

    protected

    def env
      {
        site: site,
        items: site.items,
        layouts: site.layouts,
        config: site.config
      }
    end
  end
end

runner Nanoc::CLI::Commands::Shell

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 lib/nanoc/cli/commands/shell.rb
nanoc-3.7.5 lib/nanoc/cli/commands/shell.rb