 
 
   addOb: (ob) ->
-    @code.push
+    @code.push asCodeOb.call
       type: "object"
       object: ob
-      uid: @getUID()
 
 
   addExec: (fn) ->
-    @code.push
+    @code.push asCodeOb.call
       type: "exec"
       object: fn
-      uid: @getUID()
 
 
   wrapInTag: (uri, extra="") ->

        return

      if asset.dev
        codeOb = (codeOb for codeOb in pile.code when codeOb.uid is asset.dev.uid)[0]

        piler = pile.pilers[codeOb.type]
        piler.call pile, codeOb, (err, code) ->
          throw err if err
          res.end code
          return



    app.get @Type::urlRoot + "min/:filename", (req, res) =>
      pileName = req.params.filename.split(".")[0]


    app.get @Type::urlRoot + "dev/:name/:filename", (req, res) =>
      pile = @piles[req.params.name]
      pile.readDev req.params.filename, (err, code) =>
        if err
          res.send "error reading: #{ err }", 404
        else
          res.send code, 'Content-Type': @contentType

    app.get @Type::urlRoot + "dev/_object-:name-:uuid.:ext", (req, res) =>


class JSManager extends PileManager

wrapInScriptTagInline = (code) ->
  "<script type=\"text/javascript\" >\n#{ code }\n</script>\n"

getCompiler = (filePath) ->
  compiler = compilers[extension filePath]
  if not compiler
    throw new Error "Could not find compiler for #{ filePath }"
  compiler.render

#http://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/
asCodeOb = do ->
  getId = ->
    sum = crypto.createHash('sha1')
    if @type is "file"
      sum.update @filePath
    else
      sum.update OB.stringify @

    hash = sum.digest('hex').substring 10, 0

    if @type is "file"
      filename = _.last @filePath.split("/")
      filename = filename.replace ".", "_"
      hash = filename + "_" + hash

    return hash
  pilers =
    raw: (ob, cb) -> cb null, ob.raw
    object: (ob, cb) ->
      code = ""
