 path = require "path"
 glob = require 'glob'
-sh = require "execSync"
 
 class BuildProject extends require("./base")
   name: "build-project"

    inPath = @ensureTrailingSlash(inPath)
    # with the trailing slash in inPath, rsync copies the content of inPath to
    # outPath without creating a subdirectory in outPath.
    code = @sh("rsync -Pa #{inPath} #{outPath}")

  sh: (cmd) ->
    console.log cmd
    code = sh.run(cmd)
    if code != 0
      throw "Abnormal exit: #{cmd}"


module.exports = new BuildProject()
    inPath = args._[0]
    outPath = args._[1]

    if !inPath
      @help()
      return

    if !outPath
      outPath = path.join inPath, ".workspace"

    # TODO check if input path is valid
    inPath = @ensureTrailingSlash(inPath)
