Sha256: 22684ef955149ad3108467f09f54076ae0a92282297003c77b18cabc5fdf6091

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

require "thor"
require "thor/group"

module Middleman::Templates
  @@template_mappings = {}
  def self.register(name, klass)
    @@template_mappings[name] = klass
  end
  
  def self.registered_names
    @@template_mappings.keys
  end
  
  def self.registered_templates
    @@template_mappings
  end
  
  class Base < ::Thor::Group
    include Thor::Actions
    
    argument :location, :type => :string
    class_option :template, :default => "default"
    class_option :css_dir, :default => "stylesheets"
    class_option :js_dir, :default => "javascripts"
    class_option :images_dir, :default => "images"
    class_option :rack, :type => :boolean, :default => false
    class_option :bundler, :type => :boolean, :default => false
    
    def generate_rack
      if options[:rack]
        template "shared/config.ru", File.join(location, "config.ru")
      end
    end
    
    def generate_bundler
      if options[:bundler]
        template "shared/Gemfile.tt", File.join(location, "Gemfile")
        
        say_status :run, "bundle install"
        print `cd #{location} && "#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" install`
      end
    end
  end
end

# Default template
require "middleman/templates/default"

# Blog template
require "middleman/templates/blog"

# HTML5 template
require "middleman/templates/html5"

# Local templates
require "middleman/templates/local"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
middleman-2.0.2 lib/middleman/templates.rb
middleman-2.0.1.1 lib/middleman/templates.rb
middleman-2.0.1 lib/middleman/templates.rb
middleman-2.0.0.3 lib/middleman/templates.rb
middleman-2.0.0.2 lib/middleman/templates.rb
middleman-2.0.0.1 lib/middleman/templates.rb
middleman-2.0.0 lib/middleman/templates.rb