diff --git a/middleman-cli/lib/middleman-cli/build.rb b/middleman-cli/lib/middleman-cli/build.rb index 9e521dde..e107c33a 100644 --- a/middleman-cli/lib/middleman-cli/build.rb +++ b/middleman-cli/lib/middleman-cli/build.rb @@ -42,7 +42,9 @@ module Middleman::Cli # Core build Thor command # @return [void] def build - unless ENV['MM_ROOT'] + root = ENV['MM_ROOT'] || Dir.pwd + + unless File.exists?(File.join(root, "config.rb")) raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?' end @@ -79,7 +81,7 @@ module Middleman::Cli ::Middleman::Util.instrument 'builder.run' do if builder.run! clean_directories! if options['clean'] - shell.say 'Project built successfully.' + puts 'Project built successfully.' else msg = 'There were errors during this build' unless options['verbose'] diff --git a/middleman-core/features/builder.feature b/middleman-core/features/builder.feature index d99c165c..d1e4f684 100644 --- a/middleman-core/features/builder.feature +++ b/middleman-core/features/builder.feature @@ -41,7 +41,7 @@ Feature: Builder Scenario: Build empty errors Given a built app at "empty-app" - Then the exit status should be 1 + Then was not successfully built Scenario: Build external_pipeline errors Given a built app at "external-pipeline-error" 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 d4fb274c..2972c20b 100644 --- a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb @@ -19,6 +19,12 @@ Given /^was successfully built$/ do step %Q{a directory named "build" should exist} end +Given /^was not successfully built$/ do + step %Q{the output should not contain "Project built successfully."} + step %Q{the exit status should be 1} + step %Q{a directory named "build" should not exist} +end + Given /^a successfully built app at "([^\"]*)"$/ do |path| step %Q{a built app at "#{path}"} step %Q{was successfully built}