lib/ember-cli/app.rb in ember-cli-rails-0.4.2 vs lib/ember-cli/app.rb in ember-cli-rails-0.4.3

- old
+ new

@@ -58,11 +58,12 @@ set_on_exit_callback end def run_tests prepare - exit 1 unless exec("#{ember_path} test") + + exec("#{ember_path} test") end def stop Process.kill :INT, pid if pid @pid = nil @@ -176,16 +177,16 @@ def reset_build_error! build_error_file_path.delete if build_error? end def build_error? - build_error_file_path.exist? + build_error_file_path.exist? && build_error_file_path.size? end def raise_build_error! error = BuildError.new("EmberCLI app #{name.inspect} has failed to build") - error.set_backtrace build_error_file_path.read.split(?\n) + error.set_backtrace build_error_file_path.readlines fail error end def prepare @prepared ||= begin @@ -280,13 +281,17 @@ if watcher watch_flag += " --watcher #{watcher}" end end - "#{ember_path} build #{watch_flag} --environment #{environment} --output-path #{dist_path} #{log_pipe}" + "#{ember_path} build #{watch_flag} --environment #{environment} --output-path #{dist_path} #{redirect_errors} #{log_pipe}" end + def redirect_errors + "2> #{build_error_file_path}" + end + def log_pipe "| #{tee_path} -a #{log_path}" if tee_path end def ember_app_name @@ -337,10 +342,10 @@ end end def exec(cmd, method: :system) Dir.chdir root do - Kernel.public_send(method, env_hash, cmd, err: :out) + Kernel.public_send(method, env_hash, cmd, err: :out) || exit(1) end end def wait_for_build_complete_or_error loop do