Module: Middleman

Defined in:
lib/middleman-core.rb,
lib/middleman-core/cli.rb,
lib/middleman-core/util.rb,
lib/middleman-core/logger.rb,
lib/middleman-core/sitemap.rb,
lib/middleman-core/version.rb,
lib/middleman-core/extension.rb,
lib/middleman-core/profiling.rb,
lib/middleman-core/extensions.rb,
lib/middleman-core/load_paths.rb,
lib/middleman-core/meta_pages.rb,
lib/middleman-core/application.rb,
lib/middleman-core/configuration.rb,
lib/middleman-core/renderers/erb.rb,
lib/middleman-core/sitemap/store.rb,
lib/middleman-core/preview_server.rb,
lib/middleman-core/renderers/less.rb,
lib/middleman-core/renderers/sass.rb,
lib/middleman-core/renderers/liquid.rb,
lib/middleman-core/renderers/stylus.rb,
lib/middleman-core/sitemap/resource.rb,
lib/middleman-core/sitemap/queryable.rb,
lib/middleman-core/renderers/asciidoc.rb,
lib/middleman-core/renderers/kramdown.rb,
lib/middleman-core/renderers/markdown.rb,
lib/middleman-core/renderers/redcarpet.rb,
lib/middleman-core/core_extensions/data.rb,
lib/middleman-core/core_extensions/request.rb,
lib/middleman-core/core_extensions/routing.rb,
lib/middleman-core/meta_pages/sitemap_tree.rb,
lib/middleman-core/renderers/coffee_script.rb,
lib/middleman-core/meta_pages/config_setting.rb,
lib/middleman-core/core_extensions/extensions.rb,
lib/middleman-core/sitemap/extensions/ignores.rb,
lib/middleman-core/sitemap/extensions/on_disk.rb,
lib/middleman-core/sitemap/extensions/proxies.rb,
lib/middleman-core/meta_pages/sitemap_resource.rb,
lib/middleman-core/core_extensions/file_watcher.rb,
lib/middleman-core/sitemap/extensions/redirects.rb,
lib/middleman-core/sitemap/extensions/traversal.rb,
lib/middleman-core/core_extensions/show_exceptions.rb,
lib/middleman-core/core_extensions/external_helpers.rb,
lib/middleman-core/sitemap/extensions/request_endpoints.rb,
lib/middleman-core/core_extensions/rendering.rb,
lib/middleman-core/renderers/slim.rb,
lib/middleman-core/renderers/haml.rb

Overview

Rendering extension rubocop:disable UnderscorePrefixedVariableName

Defined Under Namespace

Modules: Cli, Configuration, CoreExtensions, Extensions, Features, MetaPages, PreviewServer, Profiling, Renderers, Sitemap, Templates, Util Classes: Application, Extension, Logger

Constant Summary collapse

VERSION =

Current Version

Returns:

  • (String)
'3.3.10'
EXTENSION_FILE =

Where to look in gems for extensions to auto-register

File.join('lib', 'middleman_extension.rb')

Class Method Summary collapse

Class Method Details

.locate_root(cwd = Pathname.new(Dir.pwd)) ⇒ Object

Recursive method to find config.rb



47
48
49
50
51
# File 'lib/middleman-core/load_paths.rb', line 47

def locate_root(cwd=Pathname.new(Dir.pwd))
  return cwd.to_s if (cwd + 'config.rb').exist?
  return false if cwd.root?
  locate_root(cwd.parent)
end

.setup_load_pathsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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/load_paths.rb', line 6

def setup_load_paths
  @_is_setup ||= begin

    # Only look for config.rb if MM_ROOT isn't set
    if !ENV['MM_ROOT'] && found_path = locate_root
      ENV['MM_ROOT'] = found_path
    end

    is_bundler_setup = false

    # If we've found the root, try to setup Bundler
    if ENV['MM_ROOT']

      root_gemfile = File.expand_path('Gemfile', ENV['MM_ROOT'])
      ENV['BUNDLE_GEMFILE'] ||= root_gemfile

      unless File.exist?(ENV['BUNDLE_GEMFILE'])
        git_gemfile = Pathname.new(__FILE__).expand_path.parent.parent.parent + 'Gemfile'
        ENV['BUNDLE_GEMFILE'] = git_gemfile.to_s
      end

      if File.exist?(ENV['BUNDLE_GEMFILE'])
        is_bundler_setup = true
        require 'bundler/setup'
      end
    end

    # Automatically discover extensions in RubyGems
    require 'middleman-core/extensions'

    if is_bundler_setup
      Bundler.require
    else
      ::Middleman.load_extensions_in_path
    end

    true
  end
end