All Projects → xsc → Panoptic

xsc / Panoptic

[DEPRECATED] Monitor your Files and Directories for Changes!

Programming Languages

clojure
4091 projects

panoptic

panoptic monitors single files or whole directories for changes.

panoptic is now deprecated since there are cleaner and better ways - most notably Java NIO's Watcher API - to watch the filesystem. If you want to take over, contact me; otherwise, future development will be limited to handling issues with the existing implementation.

Build Status endorse

Usage

Leiningen (via Clojars)

[panoptic "0.2.1"]

REPL

Thanks to potemkin panoptic's core functionality can be accessed via only one namespace:

(use 'panoptic.core)

Observables

  • file creation, deletion and modification
  • directory creation and deletion
  • child directory creation and deletion
  • child file creation and deletion
  • creation and deletion of all nodes in a directory hierarchy
  • clipboard modifications

Roadmap

  • observing file modifications based on directories
  • observing web service data

Quick Examples

Watching Files


(def w 
  (-> (file-watcher :checksum :crc32)
    (on-file-modify #(println (:path %3) "changed"))
    (on-file-create #(println (:path %3) "created"))
    (on-file-delete #(println (:path %3) "deleted"))))
(run-blocking! w ["error.log" "access.log"])

;; -- or:
(def r (run! w))
(watch-entities! r ["error.log" "access.log"])
@r

Watching Directories

(def w
  (-> (directory-watcher :recursive true :extensions [:log])
    (on-directory-create #(println "Directory" (:path %3) "created"))
    (on-directory-delete #(println "Directory" (:path %3) "deleted"))
    (on-file-create #(println "File" (:path %3) "created"))
    (on-file-delete #(println "File" (:path %3) "deleted"))))
(run-blocking! w ["/var/log/my-logs"] :threads 4)

Running Examples

To run an example (see "examples" directory) issue the following command:

lein run-example <Example> <Parameters>

License

Copyright © 2013 Yannick Scherer

Distributed under the Eclipse Public License, the same as Clojure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].