diff --git a/middleman-core/features/clean_build.feature b/middleman-core/features/clean_build.feature index e70d5d3e..e9400558 100644 --- a/middleman-core/features/clean_build.feature +++ b/middleman-core/features/clean_build.feature @@ -3,29 +3,39 @@ Feature: Build Clean Given a fixture app "clean-app" And app "clean-app" is using config "empty" And a successfully built app at "clean-app" + Then the following files should exist: + | build/index.html | + | build/should_be_ignored.html | + | build/should_be_ignored2.html | + | build/should_be_ignored3.html | And app "clean-app" is using config "complications" - Given a successfully built app at "clean-app" with flags "--clean" - When I cd to "build" Then the following files should not exist: - | should_be_ignored.html | - | should_be_ignored2.html | - | should_be_ignored3.html | - And the file "index.html" should contain "Comment in layout" + | build/should_be_ignored.html | + | build/should_be_ignored2.html | + | build/should_be_ignored3.html | + And the file "build/index.html" should contain "Comment in layout" Scenario: Clean an app with directory indexes Given a successfully built app at "clean-dir-app" - When I cd to "build" Then the following files should exist: - | about/index.html | - + | build/about/index.html | Given a successfully built app at "clean-dir-app" with flags "--clean" - When I cd to "build" Then the following files should exist: - | about/index.html | - + | build/about/index.html | + Scenario: Clean build an app that's never been built Given a successfully built app at "clean-dir-app" with flags "--clean" - When I cd to "build" Then the following files should exist: - | about/index.html | + | build/about/index.html | + + Scenario: Clean build an app with newly ignored files and a nested output directory + Given a built app at "clean-nested-app" + Then a directory named "sub/dir" should exist + Then the following files should exist: + | sub/dir/about.html | + When I append to "config.rb" with "ignore 'about.html'" + Given a built app at "clean-nested-app" with flags "--clean" + Then the following files should not exist: + | sub/dir/about.html | + diff --git a/middleman-core/fixtures/clean-dir-app/config.rb b/middleman-core/fixtures/clean-dir-app/config.rb index f343b291..065e6f0e 100644 --- a/middleman-core/fixtures/clean-dir-app/config.rb +++ b/middleman-core/fixtures/clean-dir-app/config.rb @@ -1 +1,2 @@ -activate :directory_indexes \ No newline at end of file +activate :directory_indexes + diff --git a/middleman-core/fixtures/clean-nested-app/config.rb b/middleman-core/fixtures/clean-nested-app/config.rb new file mode 100644 index 00000000..de126643 --- /dev/null +++ b/middleman-core/fixtures/clean-nested-app/config.rb @@ -0,0 +1,3 @@ +set :build_dir, "sub/dir" + + diff --git a/middleman-core/fixtures/clean-nested-app/source/about.html b/middleman-core/fixtures/clean-nested-app/source/about.html new file mode 100644 index 00000000..c4c4ce51 --- /dev/null +++ b/middleman-core/fixtures/clean-nested-app/source/about.html @@ -0,0 +1 @@ +Fun times \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb index 16fad844..e52c57bd 100644 --- a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb @@ -2,12 +2,16 @@ require 'fileutils' Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name| target = File.join(PROJECT_ROOT_PATH, "fixtures", path) - config_path = File.join(target, "config-#{config_name}.rb") + config_path = File.join(current_dir, "config-#{config_name}.rb") config_dest = File.join(current_dir, "config.rb") FileUtils.cp(config_path, config_dest) end Given /^a fixture app "([^\"]*)"$/ do |path| + # This step can be reentered from several places but we don't want + # to keep re-copying and re-cd-ing into ever-deeper directories + next if File.basename(current_dir) == path + step %Q{a directory named "#{path}"} target_path = File.join(PROJECT_ROOT_PATH, "fixtures", path)