       await mkdirp @tmp,defer err
       await utils.rmdirDeep @tmp,defer err
       console.log "Cloning branch '#{branch}' into '#{@tmp}'"
-      await @_git "clone --branch #{branch} #{fetch} #{@tmp}",null,defer err,out
+      await @_git ['clone','--branch',branch,fetch,@tmp],null,defer err,out
 
       # make sure GithubPage branch exists
-      await @_git "status",@tmp,defer err,out
+      await @_git ["status"],@tmp,defer err,out
       if !out.match branch
         console.log "Branch '#{branch}' does not exists. creating..."
-        await @_git "branch #{branch}",@tmp,defer err
-      await @_git "checkout #{branch}",@tmp,defer err
+        await @_git ['branch',branch],@tmp,defer err
+      await @_git ['checkout',branch],@tmp,defer err
     else
       await mkdirp @tmp,defer err
 

  #     cb(err,stdout,stderr)
  @_git:(command,workTree,cb)->
    if workTree?
      command="git --work-tree #{workTree} --git-dir #{path.join workTree,'.git'} #{command}"
    else
      command="git #{command}"
    await childprocess.exec command,defer err,stdout,stderr
    if @options.verbose
      console.log "> #{command}"
      if stderr?&&stderr.trim().length
        console.error stderr
      if stdout?&&stdout.trim().length
        console.log stdout
    if err?&&stderr?&&stderr.trim().length
      console.error stderr
      utils.rmdirDeep 'markem.out',->
      process.exit 1
      return
    cb(err,stdout,stderr)
  @_generate: (layout,cb)->
    await fs.readdir @tmp,defer err, list
    for file in list
      continue if file.match /^\./
      await fs.stat path.join(@tmp,file),defer err, stat
      if stat.isDirectory()
        console.log "rm -Rf #{file}" if @options.verbose
        await utils.rmdirDeep file,defer err
      else
        console.log "rm -f #{file}" if @options.verbose
        await utils.unlink file,defer err

    console.log "cp -R markem.conf #{@tmp}" if @options.verbose
    await utils.cpdir 'markem.conf',@tmp,defer err

    console.log "rm -f #{path.join(@tmp,'layout.jade')}" if @options.verbose
    await utils.unlink path.join(@tmp,'layout.jade'),defer err
    utils.scandir
      path: @source
      readFiles: false
      ignoreHiddenFiles: true
      next: (err,list) ->
        globals={}
        documents={}

        # initialize some basic stuff
        for relative,type of list
          if type=='file'&&!relative.match /node_modules/
            target=null
            if relative.match /\.markdown$/
              target=path.join @tmp,relative.replace /\.markdown$/,'.html'
            if relative.match /\.md$/
              target=path.join @tmp,relative.replace /\.md$/,'.html'
            if relative.match new RegExp("readme\\.md$",'i')
              target=path.join @tmp,relative.replace new RegExp("[^#{path.sep}]*$"),'index.html'
            if target?
              document=
                dirs:[]
                files:[]
                pathSource:'/'+relative
                pathFile:'/'+path.relative(@tmp,target)
                target:target
                globals:globals
              document.path=document.pathFile.replace(/\/index\.html$/,'/')
              document.root=path.relative document.path.replace(/\/[^\/]*$/,'/'),'\/'
              if !document.root.length
                document.root='.'
              documents[document.path]=document
              await fs.readFile relative,'utf8',defer err,document.source


        # build relationships,content,title between documents
        for p,document of documents
          document.content=marked document.source
          document.title=(document.content.match(/<h1>([^<]*)<\/h1>/m)||[null,'untitled'])[1] 
          if p=='/'
            globals.root=document
          if p.match /\/$/
            document.parent=documents[p.replace(/[^\/]*\/$/,'')]
            document.type='dir'
          else
            document.parent=documents[p.replace(/[^\/]+$/,'')]
            document.type='file'
          if document.parent?
            if document.type=='dir'
              document.parent.dirs.push document
            else
              document.parent.files.push document

        try
          markemConf=require path.join process.cwd(),'markem.conf'
        catch e
        if markemConf? and markemConf.preRender?
          await markemConf.preRender globals,defer err

        # render each documents
        for p,document of documents
          
          console.log "rendering #{document.target}" if markem.options.verbose
          await mkdirp path.dirname(document.target),defer err
          try
            document.output=layout document
          catch e
            console.error e
            utils.rmdirDeep @tmp,->
            process.exit 1
            return
          await fs.writeFile document.target,document.output,'utf8',defer err
        cb()

    if !options.out?
      # detect Git remote
      await @_git ['remote','-v'],null,defer err,out
      fetch=out.match(/origin\s+([^\s]+)\s+\(fetch\)/)[1]
      console.log "git url: #{fetch}"

      # detect GithubPage branch
