better default project and test for layout working

This commit is contained in:
tdreyno 2009-11-02 16:11:24 -08:00
parent 8084d9eb95
commit 6a9870ed1c
6 changed files with 25 additions and 8 deletions

View file

@ -25,10 +25,6 @@ begin
gem.add_development_dependency("sdoc") gem.add_development_dependency("sdoc")
end end
Jeweler::RubyforgeTasks.new do |rubyforge|
rubyforge.doc_task = "rdoc"
end
Jeweler::GemcutterTasks.new Jeweler::GemcutterTasks.new
rescue LoadError rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"

View file

@ -70,6 +70,8 @@ module Middleman
path << options.index_file if path.match(%r{/$}) path << options.index_file if path.match(%r{/$})
path.gsub!(%r{^/}, '') path.gsub!(%r{^/}, '')
# layout(:"layout.html") # Insert the .html into the layout name like the rest of the templates
# If the enabled renderers succeed, return the content, mime-type and an HTTP 200 # If the enabled renderers succeed, return the content, mime-type and an HTTP 200
if content = render_path(path) if content = render_path(path)
content_type media_type(File.extname(path)), :charset => 'utf-8' content_type media_type(File.extname(path)), :charset => 'utf-8'

View file

@ -1,4 +1,4 @@
- content_for :head do - content_for :head do
%title Custom head title %title The Middleman!
%h1 The Middleman is watching. %h1 The Middleman is watching.

View file

@ -1,7 +1,9 @@
%html %html
%head %head
%title The Middleman! // Comment in layout
= stylesheet_link_tag "site.css"
= yield_content :head = yield_content :head
%body %body
#frame
= yield = yield

View file

@ -1 +1,11 @@
@import compass/reset.sass @import compass.sass
@import blueprint/modules/grid.sass
@import blueprint/modules/typography.sass
+global-reset
+blueprint-typography
#frame
padding: 50px
text-align: center
+container

View file

@ -18,6 +18,13 @@ describe "Generator" do
FileUtils.rm_rf(@root_dir) FileUtils.rm_rf(@root_dir)
end end
it "should use layout file" do
build_cmd = project_file("bin", "mm-build")
`cd #{@root_dir} && #{build_cmd}`
File.exists?("#{@root_dir}/build/index.html").should be_true
File.read("#{@root_dir}/build/index.html").should include("Comment in layout")
end
it "should copy template files" do it "should copy template files" do
template_dir = project_file("lib", "template", "**/*") template_dir = project_file("lib", "template", "**/*")
Dir[template_dir].each do |f| Dir[template_dir].each do |f|