Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- puts "what file should I watch?"
- watch = gets
- puts "ok, if anything changes in that file I'll put it in changelog.txt"
- oldlog = nil
- newlog = nil
- ##loop forever
- loop do
- ##if the file has changed
- if oldlog != (newlog = File.read(watch))
- ## write in the change log
- File::open('changelog.txt','w') do |f|
- f << Diffy::Diff.new(oldlog,newlog)
- end
- end
- ##make a copy of the file for next time around
- oldlog = newlog
- ##sleep for a moment
- sleep(1)
- end
Add Comment
Please, Sign In to add comment