Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 16, 2023. It is now read-only.

skcript/watchman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watchman

A Watchdog that pings file changes to an API of your choice.

Dependencies

  • Python 2.7 (Developed and Tested)
  • Redis
  • RQ

Compiling & Configuring

  1. Clone this Repo
  2. Run python setup.py install
  3. Configure the app by running watchman configure. Or copy the default YAML file to ~.

Running Watchman

  1. From Terminal, run watchman sync
  2. From another Terminal, run watchman worker

Functions

YAML configuration

This YAML is automatically created in the ~ directory. It holds all the configuration attributes for Watchman.

Attributes

  • source: Array of all paths Watchman should monitor
  • regexes: Array of all regexes Watchman should abide by (These regexes are matched with the filepath)
  • endpoints: Hash of each file/folder action which should ping to an API endpoint

Default File

  source:
    - /home/users/skcript
  regexes:
    - "([a-zA-Z0-9_ -/]*)/home/(\\w+)/uploads/"
  endpoints:
    file_create: "http://localhost/api/v2/files/create"
    folder_create: "http://localhost/api/v2/folders/create"
    file_move: "http://localhost/api/v2/files/move"
    folder_move: "http://localhost/api/v2/folders/move"
    file_destroy: "http://localhost/api/v2/files/destroy"
    folder_destroy: "http://localhost/api/v2/folders/destroy"

Logs

All Watchman logs are maintained at /tmp/watchman.log

License

Copyright 2016 Skcript.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.