Sha256: 568c007c21b379bc7aa67f29f77f3a09f254cc72b165071ee7aec0c890b59db0

Contents?: true

Size: 763 Bytes

Versions: 51

Compression:

Stored size: 763 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
  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.exists?(template_file)
    require template_file
  else
    Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
  end
end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
middleman-core-3.2.1 lib/middleman-core/templates/local.rb
middleman-core-3.2.0 lib/middleman-core/templates/local.rb
middleman-core-3.1.6 lib/middleman-core/templates/local.rb
middleman-core-3.1.5 lib/middleman-core/templates/local.rb
middleman-core-3.1.4 lib/middleman-core/templates/local.rb
middleman-core-3.1.3 lib/middleman-core/templates/local.rb
middleman-core-3.1.2 lib/middleman-core/templates/local.rb
middleman-core-3.1.1 lib/middleman-core/templates/local.rb
middleman-core-3.1.0 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.rc.4 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.rc.3 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.rc.2 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.rc.1 lib/middleman-core/templates/local.rb
middleman-core-x86-mingw32-3.0.14 lib/middleman-core/templates/local.rb
middleman-core-3.0.14 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.beta.3 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.beta.2 lib/middleman-core/templates/local.rb
middleman-core-3.1.0.beta.1 lib/middleman-core/templates/local.rb
middleman-core-x86-mingw32-3.0.13 lib/middleman-core/templates/local.rb
middleman-core-3.0.13 lib/middleman-core/templates/local.rb