 typeScript            = require 'gulp-typescript'
 uglify                = require 'gulp-uglify'
 
+onError = (e) ->
+	isArray  = Array.isArray e
+	err      = e.message or e
+	errors   = if isArray then err else [err]
+	messages = (error for error in errors)
+
+	gutil.log gutil.colors.red message for message in messages
+	@emit 'end'
+
 appUrl = "http://localhost:#{DEV_PORT}"
 
 bowerComponents = do ->

			'!app/app.coffee'
		], cwd: SRC_DIRECTORY
		.pipe coffeelint options
		.pipe coffeelint.reporter()

gulp.task 'copy:temp', ['clean:working', 'normalizeComponents'], ->
	gulp

	gulp
		.src 'index.html', cwd: DIST_DIRECTORY
		.pipe open '', options
		.on 'error', onError

gulp.task 'reload', ['build'], ->
	gulp
		.src 'index.html', cwd: DIST_DIRECTORY
		.pipe connect.reload()
		.on 'error', onError

gulp.task 'scripts', ['coffee', 'typeScript']

