Class: Middleman::Cli::Console

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/middleman-core/cli/console.rb

Overview

A thor task for creating new projects

Instance Method Summary collapse

Instance Method Details

#consoleObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/middleman-core/cli/console.rb', line 21

def console
  require "middleman-core"
  require "irb"

  opts = {
    :environment => options['environment'],
    :debug => options['verbose']
  }

  @app =::Middleman::Application.server.inst do
    if opts[:environment]
      set :environment, opts[:environment].to_sym
    end

    logger(opts[:debug] ? 0 : 1, opts[:instrumenting] || false)
  end

  # TODO: get file watcher / reload! working in console

  IRB.setup nil
  IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
  require 'irb/ext/multi-irb'
  IRB.irb nil, @app
end