add some build cleaning tests

This commit is contained in:
Thomas Reynolds 2011-10-15 11:21:56 -07:00
parent 1d21cc4c5b
commit e4bbed33c5
17 changed files with 73 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2.0.13
====
middleman build --clean keeps the build directory clean of leftover files
2.0.12
====
Sinatra 1.3.1 and Padrino 0.10.4

View file

@ -0,0 +1,10 @@
Feature: Build Clean
Scenario: Build and Clean an app
Given app "clean-app" is using config "empty"
And a built app at "clean-app"
And app "clean-app" is using config "complications"
And a built app at "clean-app" with flags "--clean"
Then "should_be_ignored.html" should not exist at "clean-app"
And "should_be_ignored2.html" should not exist at "clean-app"
And "should_be_ignored3.html" should not exist at "clean-app"
And cleanup built app at "clean-app"

View file

@ -1,5 +1,13 @@
require 'fileutils'
Given /^app "([^"]*)" is using config "([^"]*)"$/ do |path, config_name|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path)
config_path = File.join(target, "config-#{config_name}.rb")
config_dest = File.join(target, "config.rb")
FileUtils.cp(config_path, config_dest)
end
Given /^a built app at "([^"]*)"$/ do |path|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path)

View file

@ -0,0 +1,11 @@
page "/fake.html", :proxy => "/real.html", :layout => false
ignore "/should_be_ignored.html"
page "/should_be_ignored2.html", :ignore => true
page "/target_ignore.html", :proxy => "/should_be_ignored3.html", :ignore => true
%w(one two).each do |num|
page "/fake/#{num}.html", :proxy => "/real/index.html" do
@num = num
end
end

View file

View file

@ -0,0 +1,11 @@
page "/fake.html", :proxy => "/real.html", :layout => false
ignore "/should_be_ignored.html"
page "/should_be_ignored2.html", :ignore => true
page "/target_ignore.html", :proxy => "/should_be_ignored3.html", :ignore => true
%w(one two).each do |num|
page "/fake/#{num}.html", :proxy => "/real/index.html" do
@num = num
end
end

View file

@ -0,0 +1,6 @@
%h1 Welcome
:markdown
## H2
Paragraph

View file

@ -0,0 +1,6 @@
%html
%head
%title My Sample Site
/ Comment in layout
%body
= yield

View file

@ -0,0 +1,5 @@
%html
%head
%title Custom Layout
%body
= yield

View file

@ -0,0 +1 @@
I am real

View file

@ -0,0 +1,5 @@
---
layout: false
---
I am real: <%= @num %>

View file

@ -0,0 +1 @@
<h1>Ignore me!</h1>

View file

@ -0,0 +1 @@
<h1>Ignore me! 2</h1>

View file

@ -0,0 +1 @@
<h1>Ignore me! 3</h1>

View file

@ -0,0 +1 @@
Static, no code!

View file

@ -211,7 +211,7 @@ module Middleman
files.each { |f| base.remove_file f, config }
directories.sort_by! {|d| d.length }.reverse!
directories = directories.sort_by {|d| d.length }.reverse!
directories.each do |d|
base.remove_file(d, config) if directory_empty? d

View file

@ -1,3 +1,3 @@
module Middleman
VERSION = "2.0.12"
VERSION = "2.0.13"
end