1. Paul Masurel
  2. tumbler

Commits

"Pau...@exalead.com>"  committed 748f333

Fixed 2 ugly bugs that cancelled each other but prevented lazy compilation.

  • Participants
  • Parent commits 6ca6eb9
  • Branches default

Comments (0)

Files changed (1)

File tumbler/src/tumbler.coffee

View file
  • Ignore whitespace
     flags: 'w'
     encoding: 'utf-8'
 
+head = (l)-> l[0]
+tail = (l)-> l[1..]
+headtail = (l)-> [ head(l) , tail(l) ]
+
 extract_extension = (filepath)->
     ext_match = filepath.match /(.*)\.([^\.]+)/
     if ext_match 
         if dests.length == 0
             success()
         else
-            dest = dests.pop()
-            @build dest, (=>@buildAll dests,success,failure), failure
+            [dest, remaining] = headtail dests
+            @build dest, (=>@buildAll remaining,success,failure), failure
            
     
     _build_with_compiler: (compiler, dest, success, failure)->
         sources = compiler.get_source_list dest
         sources_are_ready = ->
-            older_than_dest = (src)->is_fresher dest,src
-            if (not path.existsSync dest) or all older_than_dest,sources
+            older_than_dest = (src)->
+                is_fresher dest,src
+            if (not path.existsSync dest) or not all older_than_dest,sources
                 compiler.build dest,success,failure
             else
                 # no need to compile anyway.
                 success()
-        @buildAll sources,sources_are_ready,failure
+        @buildAll sources.slice(),sources_are_ready,failure
     
     build: (dest, success, failure)->
         ###