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")
end
Jeweler::RubyforgeTasks.new do |rubyforge|
rubyforge.doc_task = "rdoc"
end
Jeweler::GemcutterTasks.new
rescue LoadError
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.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 content = render_path(path)
content_type media_type(File.extname(path)), :charset => 'utf-8'

View file

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

View file

@ -1,7 +1,9 @@
%html
%head
%title The Middleman!
// Comment in layout
= stylesheet_link_tag "site.css"
= yield_content :head
%body
#frame
= 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)
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
template_dir = project_file("lib", "template", "**/*")
Dir[template_dir].each do |f|