Class: Middleman::Cli::Config

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

Overview

The CLI Config class

Instance Method Summary collapse

Instance Method Details

#consoleObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'middleman-cli/lib/middleman-cli/config.rb', line 13

def console
  require 'json'
  require 'middleman-core'
  require 'middleman-core/logger'

  opts = {
    environment: options['environment']
  }

  # Don't output info messages
  ::Middleman::Logger.singleton(2, false)

  app = ::Middleman::Application.new do
    config[:mode] = :config
    config[:disable_sitemap] = true
    config[:watcher_disable] = true
    config[:exit_before_ready] = true
    config[:environment] = opts[:environment].to_sym if opts[:environment]
  end

  puts JSON.pretty_generate(app.config.to_h)

  app.shutdown!
end