 
 merge = (files) -> files = files.split(' '); path = files[0]; (for file in files.splice(1) then path+file).join(' ')
 
-client = folders_destClient
-
-# remove twoside temporalily. add them when distributing.
-#destLib = folders_dest+'lib/'
-#destLibClient = destLib+'client/'
-#files_taijiview = merge('nodes/ nodes index')+' '+'parser lex taijiview'
-#files_taijiview = for item in files_taijiview.split(' ') then destLib+item+'.js'
-#task 'transform:taijiview', (cb) ->
-#  if not distributing then return src(files_taijiview).pipelog(twoside(destLib, 'taijiview')).to(destLib)
-#  src(files_taijiview)
-#  .pipelog(twoside(folders_dest, 'taijiview', {only_wrap_for_browser:true})).to(destLibClient)
-#  .pipe(concat("taijiview-package.js")).pipe(size()).to(destLibClient)
-#  #minify
-#  .pipe(closureCompiler()).pipe(rename(suffix: "-min")).pipe(size()).to(destLibClient)
-
-task 'make:samples', (cb) -> # twoside, concat
-  # twoside and concat for samples
-  files = 'some .js examples filename for taijiview'
-  files = for name in files.split(' ') then folders_dest+'examples/'+name+'.js'
-#  console.log files.join(' ')
-  stream = src(files).pipelog(twoside(folders_dest+'examples', 'taijiview/examples')) #, {only_wrap_for_browser:true}
-  if not distributing then return stream.to(folders_dest+'examples')
-  stream.pipe(concat('examples-concat.js')).pipe(size()) # when debuggin, dont concat
-  stream.to(folders_dest+'examples')
-
-task 'make:test', (cb) -> # twoside, concat, minify
-  # twoside and concat for test/karma
-  stream = src(folders_dest+'test/karma/**/*.js')
-  .pipelog(twoside(folders_dest+'test/karma', 'peasy/karma', {only_wrap_for_browser:true}))
-  if not distributing then return  stream.to(folders_dest+'test/karma')
-  stream.pipe(concat('karma-concat.js')) # when debugging, dont concat
-  .to(folders_dest+'test/karma')
-
-build = (callback) ->
-  runSequence('clean', ['copy', 'coffee'], ['transform:taijiview', 'make:samples', 'make:test'], callback)
+build = (callback) -> runSequence('clean', ['copy', 'coffee'], callback)
 # make is for debugging and test, dont concat and minify
 task 'make', (callback) -> distributing = false; build(callback)
 # dist is for release, so concat and minify packages

task 'watch/all', -> ['watch/copy', 'watch/coffee', 'watch/mocha'] #  , 'watch/reload'

task 'mocha/auto', ['watch/copy', 'watch/coffee', 'watch/mocha']
task 'test', (callback) -> runSequence('make', ['mocha', 'karma1'], callback)
task 'test/dist', (callback) -> runSequence('dist', ['mocha'], callback)   #, 'karma1/dist'
task 'default',['test']



onErrorContinue = (err) -> console.log(err.stack); @emit 'end'
task 'mocha', ->  src(files_mocha).pipe(mocha({reporter: 'dot'})).on("error", onErrorContinue)

task 'runapp', shell.task ['node dist/examples/sockio/app.js']
task 'express',  ->
