1. Paul Masurel
  2. tumbler

Commits

"Pau...@exalead.com>"  committed dc195d6

files are recompiled when server is restarted

  • Participants
  • Parent commits 748f333
  • Branches default

Comments (0)

Files changed (1)

File tumbler/src/tumbler.coffee

View file
  • Ignore whitespace
         success()
     else
         try
-            head = sources[0]
-            tail = sources[1..]
-            f = fs.createReadStream head
+            [h,t] = headtail sources
+            f = fs.createReadStream h
             f.on "end",->
-                concatenate tail, dest_file, success, failure
+                concatenate t, dest_file, success, failure
             f.pipe dest_file,
         catch err
             failure "Bundle failure!"
         dest_file = fs.openSync dest,'w', W_FILE
 
         dest_file = fs.createWriteStream dest,W_FILE
-        child = spawn 'uglifyjs' , [ "--reserved-names", "arguments" ]
+        child = spawn 'uglifyjs' , [ "-b" , "--reserved-names", "arguments" ]
         concatenate targets,child.stdin,((m)->console.log "concat success"),((m)->console.log "error")
         child.stdout.pipe dest_file
         error_msg = ""
 class Builder
 
     constructor: ->
+        @history = {}
         @compilers = []
     
     register_compiler: (compiler)->
     
     _build_with_compiler: (compiler, dest, success, failure)->
         sources = compiler.get_source_list dest
-        sources_are_ready = ->
-            older_than_dest = (src)->
+        sources_are_ready = =>
+            older_than_dest = (src)=>
                 is_fresher dest,src
-            if (not path.existsSync dest) or not all older_than_dest,sources
+            if (not @history[dest]?) or (not path.existsSync dest) or not all older_than_dest,sources
+                @history[dest] = true
                 compiler.build dest,success,failure
             else
                 # no need to compile anyway.