Sha256: b80540956986e3ac6551ad80354cb069e66eaac3a886cce09a9480c401047512

Contents?: true

Size: 815 Bytes

Versions: 7

Compression:

Stored size: 815 Bytes

Contents

# Local templates
class Middleman::Templates::Local < Middleman::Templates::Base
  # Look for templates in ~/.middleman
  # @return [String]
  def self.source_root
    File.join(File.expand_path('~/'), '.middleman')
  end

  # Just copy from the template path
  # @return [void]
  def build_scaffold!
    directory options[:template].to_s, location, force: options[:force], exclude_pattern: /\.git\/.*/
  end
end

# Iterate over the directories in the templates path and register each one.
Dir[File.join(Middleman::Templates::Local.source_root, '*')].each do |dir|
  next unless File.directory?(dir)

  template_file = File.join(dir, 'template.rb')

  if File.exist?(template_file)
    require template_file
  else
    Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
middleman-core-3.4.1 lib/middleman-core/templates/local.rb
middleman-core-3.4.0 lib/middleman-core/templates/local.rb
middleman-core-3.3.12 lib/middleman-core/templates/local.rb
middleman-core-3.3.11 lib/middleman-core/templates/local.rb
middleman-core-3.3.10 lib/middleman-core/templates/local.rb
middleman-core-3.3.9 lib/middleman-core/templates/local.rb
middleman-core-3.3.8 lib/middleman-core/templates/local.rb