   #    else
   #      log.error stderr
   #      callback stderr
-  createVhost : (options,callback)->
-    {username,uid,domainName} = options
-
-    domainName ?= "#{username}.#{config.defaultDomain}"
-    targetPath = "/Users/#{username}/Sites/#{domainName}"
-
-    createDirs = ['-v','-p',targetPath]
-    copyFiles  = ['-v','-r',"#{config.defaultVhostFiles}/website",targetPath]
-    changeOwner = ['-v','-R',"#{uid}:#{uid}","#{targetPath}/website"]
+  createVhost :do->
 
     spawnWrapper = (command, args , callback)->
       wrapper = spawn command,args

          log.info info = "createVhost: #{command} done!"
          callback null, info


    spawnWrapper '/bin/mkdir',createDirs, (err,res)=>
      if err?
        callback "[ERROR] couldn't create vhost #{err}"
      else
        spawnWrapper '/bin/cp',copyFiles,(err,res)=>
          if err?
            callback "[ERROR] Culdn't create vhost: #{err}"
          else
            spawnWrapper '/bin/chown',changeOwner,(err,res)->
              if err?
                callback "[ERROR] Culdn't create vhost: #{err}"
              else
                log.info info = "[OK] vhost #{domainName} has been created"
                callback null, info

 # suspendUser : (options,callback)->
 #   #

 #                 else
 #                   log.debug "[OK] func:unSuspendUser: /usr/sbin/cagefsctl -w #{userToSuspend}"
 #                   res = "[OK] user #{userToSuspend} was successfully unsuspended"
<<<<<<< HEAD

=======
 #                   log.info res; callback? null, res
>>>>>>> parent of f582e60... fix createVhost
