Skip to content

Commit

Permalink
added the watch functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
shavyg2 committed Apr 12, 2014
1 parent f05c196 commit 91372e5
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 125 deletions.
9 changes: 5 additions & 4 deletions aplication.coffee
Expand Up @@ -2,10 +2,10 @@ class Person
constructor:(@name)->

speak:->
console.log "hi my name is"
console.log "hi my name is #{@name}"

walk:->
"console.log walking"
run:->
"console.log fast running"



Expand All @@ -14,5 +14,6 @@ class Child extends Person
super(name)



cry:->
console.log "cry"

224 changes: 117 additions & 107 deletions bin/Main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions src/Main.coffee
Expand Up @@ -24,7 +24,7 @@ list= new List()
fileFinder=[]
added=[];
unadded=[]
recursive=(file)->
recursive=(file) =>
if program.verbose
console.log "parsing #{file}"
try
Expand All @@ -36,7 +36,7 @@ recursive=(file)->
if f.required isnt ""
arguments.callee(f.required)

bundle=->
process.bundle= =>
for bundle in fileFinder
for stack in bundle.includeStack
list.append stack
Expand All @@ -46,7 +46,7 @@ bundle=->
unless stack.caller in added
unadded.push stack.caller

output=->
output= =>
unless list.graph
console.log "Nothing to output?"
process.exit(0)
Expand Down Expand Up @@ -76,28 +76,29 @@ if file.length is 0
console.log "No Input"

watchMaster=null;
watcher=->
watcher= =>
if program.watch
if program.verbose
console.log "watch has been added"
for file in unadded
console.log unadded
for file in unadded when file isnt ""
unless watcthMaster?
watchMaster=chokidar.watch(file,{persistent:true})
watchMaster.on("change",(newfile)=>
recursive(newfile)
bundle()
process.bundle()
output()
)

watchMaster.add file
added.push file
else
watchMaster.add file
added.push file
unadded=[]
watchMaster.close()

try
for f in file
recursive(path.resolve(f))
bundle()
process.bundle()
output()
watcher()
catch e
Expand Down
3 changes: 2 additions & 1 deletion test/Child.coffee
Expand Up @@ -5,4 +5,5 @@ class Child extends Person
super(name)



cry:->
console.log "cry"
6 changes: 3 additions & 3 deletions test/Person.coffee
Expand Up @@ -2,7 +2,7 @@ class Person
constructor:(@name)->

speak:->
console.log "hi my name is"
console.log "hi my name is #{@name}"

walk:->
"console.log walking"
run:->
"console.log fast running"

0 comments on commit 91372e5

Please sign in to comment.