Sha256: 879edf188ed492b2fec22576ef8c0735585935827e7cc1d2b8f5dacade87e94d

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

#!/usr/bin/env ruby

require 'middleman-core/profiling'
Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new if ARGV.include? '--profile'

require 'middleman-core/load_paths'
Middleman.setup_load_paths

require 'dotenv'
::Dotenv.load

require 'middleman-core'
require 'middleman-core/logger'

module Middleman::Cli
  class << self
    attr_accessor :config
  end

  def self.import_config(base)
    ::Middleman::Cli.config.all_settings.each do |setting|
      if setting.default.is_a?(String) || setting.default.is_a?(NilClass)
        base.class_option setting.key,
                          type: :string,
                          desc: setting.description
      elsif setting.default.is_a?(TrueClass) || setting.default.is_a?(FalseClass)
        base.class_option setting.key,
                          type: :boolean,
                          desc: setting.description
      end
    end
  end
end

require 'middleman-cli'

# Change directory to the root
Dir.chdir(ENV['MM_ROOT']) if ENV['MM_ROOT']

# Default command is server
ARGV.unshift('server') if ARGV[0] != 'help' && (ARGV.empty? || ARGV.first.include?('-'))

::Middleman::Logger.singleton(3)
::Middleman::Cli.config = ::Middleman::Application.new do
  config[:environment] = (ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development').to_sym
  config[:mode] = :config
  config[:exit_before_ready] = true
  config[:watcher_disable] = true
  config[:disable_sitemap] = true
end.config

# Require the Middleman version
require 'middleman-core/version'

# Include the core CLI items
require 'middleman-cli/init'
require 'middleman-cli/extension'
require 'middleman-cli/server'
require 'middleman-cli/build'
require 'middleman-cli/console'
require 'middleman-cli/config'

# Support NO_COLOR: https://no-color.org
ENV['THOR_SHELL'] = 'Basic' if ENV['NO_COLOR']

# Start the CLI
Middleman::Cli::Base.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-cli-5.0.0.rc.1 bin/middleman