make sure failed builds exit with correct status code
This commit is contained in:
parent
ecc77ae89f
commit
f2221cd9a0
|
@ -17,11 +17,17 @@ Feature: Builder
|
|||
Then "images/Read me (example).txt" should exist at "test-app"
|
||||
Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
|
||||
Then ".htaccess" should exist at "test-app"
|
||||
Then the last exit code should be "0"
|
||||
|
||||
Scenario: Build glob
|
||||
Given a built app at "glob-app" with flags "--glob '*.css'"
|
||||
Then "stylesheets/site.css" should exist at "glob-app" and include "html"
|
||||
Then "index.html" should not exist at "glob-app"
|
||||
Then the last exit code should be "0"
|
||||
|
||||
Scenario: Build with errors
|
||||
Given a built app at "build-with-errors-app"
|
||||
Then the last exit code should be "1"
|
||||
|
||||
# Scenario: Force relative assets
|
||||
# Given a built app at "relative-app" with flags "--relative"
|
||||
|
|
1
fixtures/build-with-errors-app/config.rb
Normal file
1
fixtures/build-with-errors-app/config.rb
Normal file
|
@ -0,0 +1 @@
|
|||
set :layout, false
|
1
fixtures/build-with-errors-app/source/index.html.erb
Normal file
1
fixtures/build-with-errors-app/source/index.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= error_error_error %>
|
|
@ -42,11 +42,13 @@ module Middleman
|
|||
destination, request_path = ::Middleman::Builder.shared_instance.reroute_builder(destination, request_path)
|
||||
|
||||
response = ::Middleman::Builder.shared_rack.get(request_path.gsub(/\s/, "%20"))
|
||||
create_file(destination, response.body, config) if response.status == 200
|
||||
|
||||
create_file(destination, response.body, config)
|
||||
|
||||
destination
|
||||
rescue
|
||||
say_status :error, destination, :red
|
||||
abort
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rack/showexceptions'
|
|||
module Middleman::CoreExtensions::ShowExceptions
|
||||
class << self
|
||||
def registered(app)
|
||||
app.after_configuration do
|
||||
app.configure :development do
|
||||
if show_exceptions
|
||||
use ::Middleman::CoreExtensions::ShowExceptions::Middleware
|
||||
end
|
||||
|
|
|
@ -43,3 +43,8 @@ Then /^"([^\"]*)" should not exist at "([^\"]*)"$/ do |target_file, path|
|
|||
target = File.join(PROJECT_ROOT_PATH, "fixtures", path, "build", target_file)
|
||||
File.exists?(target).should be_false
|
||||
end
|
||||
|
||||
Then /^the last exit code should be "([^\"]*)"$/ do |exit_code|
|
||||
exit_code = exit_code.to_i
|
||||
$?.exitstatus.should == exit_code
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue