Merge branch 'master' of github.com:middleman/middleman

This commit is contained in:
Thomas Reynolds 2013-05-31 21:01:34 -04:00
commit 9d50cad910
5 changed files with 42 additions and 5 deletions

View file

@ -12,6 +12,9 @@
3.1.0.rc.2
===
* Custom template classes can now override the file used for creating the project Gemfile.
* Add an "empty" template that produces the minimum necessary structure for a Middleman project.
* Fix ignoring layouts from the sitemap when the source directory has been set to something other than 'source'. #896
* Track test coverage with simplecov
* i18n only autodetects languages in the `locales` root
* Frontmatter cache fixes solve performance regressions found in 3.1.x
@ -22,7 +25,6 @@
3.1.0.rc.1
===
* Fix ignoring layouts from the sitemap when the source directory has been set to something other than 'source'. #896
* Move more into core, autoloaded if gems are available.
* DataStore may now be accessed like a hash with #[] and #has_key?. #880
* The i18n extension now supports providing localized templates as separate files, like index.es.html.haml. #816, #823

View file

@ -29,11 +29,11 @@ module Middleman
# Files starting with an dot, but not .htaccess
:source_dotfiles => proc { |file|
file =~ %r{/\.} && file !~ %r{/\.(htaccess|htpasswd)}
file =~ %r{/\.} && file !~ %r{/\.ht(access|passwd)}
},
# Files starting with an underscore, but not a double-underscore
:partials => proc { |file| file =~ %r{/_} && file !~ %r{/__} },
:partials => proc { |file| file =~ %r{/_[^_]} },
:layout => proc { |file, app|
file.start_with?(File.join(app.config[:source], 'layout.')) || file.start_with?(File.join(app.config[:source], 'layouts/'))

View file

@ -34,6 +34,12 @@ module Middleman::Templates
source_paths << File.join(File.dirname(__FILE__), 'templates')
end
# The gemfile template to use. Individual templates can define this class
# method to override the template path.
def self.gemfile_template
"shared/Gemfile.tt"
end
# Required path for the new project to be generated
argument :location, :type => :string
@ -57,7 +63,7 @@ module Middleman::Templates
# @return [void]
def generate_bundler!
return if options[:'skip-gemfile']
template "shared/Gemfile.tt", File.join(location, "Gemfile")
template self.class.gemfile_template, File.join(location, "Gemfile")
return if options[:'skip-bundle']
inside(location) do
@ -91,3 +97,6 @@ require "middleman-more/templates/smacss"
# Local templates
require "middleman-core/templates/local"
# Barebones template
require "middleman-core/templates/empty"

View file

@ -0,0 +1,23 @@
# A barebones template with nothing much in it
class Middleman::Templates::Empty < Middleman::Templates::Base
# Template files are relative to this file
# @return [String]
def self.source_root
File.dirname(__FILE__)
end
def self.gemfile_template
"empty/Gemfile.tt"
end
# Actually output the files
# @return [void]
def build_scaffold!
create_file File.join(location, "config.rb"), "\n"
empty_directory File.join(location, "source")
end
end
# Register this template
Middleman::Templates.register(:empty, Middleman::Templates::Empty)

View file

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem "middleman", "~><%= Middleman::VERSION %>"