     .pipe footer '}).call(this);'
     .pipe gulp.dest config.dir.deploy + 'js/'
 
+gulp.task 'build-system-test-script', ->
+  gulp.src 'src/main/steam/scripts/*.coffee'
+    .pipe ignore.exclude /unit\-tests.coffee$/
+    .pipe iff /global\..+\.coffee$/, (coffee bare: yes), (coffee bare: no)
+    .pipe order [ 'global.node.system-tests.js', 'global.prelude.js', 'global.*.js', '*.js' ]
+    .pipe concat 'steam-system-tests.js'
+    .pipe header '"use strict";(function(){'
+    .pipe footer '}).call(this);'
+    .pipe gulp.dest config.dir.deploy + 'js/'
+
 gulp.task 'build-templates', ->
   gulp.src 'src/main/steam/templates/*.jade'
     .pipe ignore.include /index.jade$/

  gulp.watch 'src/main/steam/styles/*.styl', [ 'build-styles' ]

gulp.task 'clean', ->
  gulp.src 'build/scripts/', read: no
    .pipe clean()

  gulp.src config.dir.deploy, read: no
    .pipe clean()

gulp.task 'build', [ 
  'compile-browser-assets'
  'build-browser-script'
  'build-unit-test-script'
  'build-templates'
  'build-styles'
]

gulp = require 'gulp'
path = require 'path'
through = require 'through2'
clean = require 'gulp-clean'
concat = require 'gulp-concat'
