Reloads web pages when files in local directories change.
Python Shell
Pull request Compare This branch is 13 commits ahead, 1 commit behind workmajj:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
slurpee
.gitignore
MANIFEST.in
README.md
setup.py

README.md

SlurpeeCarton

Reloads web pages when files in local directories change.

Contact


Kyle Wanamaker (@kylewpppd)

Description


  • slurpeecarton watches a specified directory and runs a script or command when a file is modified. By default, the modified file is passed as an argument to the command.

  • Runs only under Mac OS X, since it uses OS X's FSEvents API to determine when changes are made to files. .

Usage


$ cat >> echo.sh
> #!/bin/bash
> rm $1 ^D
$ chmod a+x echo.sh

$ slurpee.py './echo.sh' /tmp/ & $ touch /tmp/random_file

SlurpeeCarton will then delete the file as it passed to the script as the first argument. The remove creates an addional event which will return a non-0 exit status. Slurpee can be extended to work with those exit statuses.

Running on OS X 10.7 Lion


SlurpeeCarton relies on the MacFSEvents library, which will be installed automatically if you use pip. Parts of MacFSEvents are written in C and will not compile under XCode 4.2. If you want to install SlurpeeCarton on Lion, first tell OS X to use gcc instead of llvm-gcc (which is the new default on XCode 4.2):

$ CC=/usr/bin/gcc-4.2

This will ensure that MacFSEvents compiles correctly when SlurpeeCarton installs it.

If you don't have the gcc-4.2 binary on your system, you can get it by installing Xcode 4.1 or by using osx-gcc-installer.

Acknowledgements


Many thanks to John Workman for Slushbox, on which this depends heavily. Slushbox is a tool to refresh a webpage in Chrome when changes are made to a source directory. Check it out.

Slushbox was relased under a BSD 3-Clause license.

John J. Workman (@workmajj)

Copyright (c) 2011, John J. Workman. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License


Copyright (c) 2011, Kyle Wanamaker. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.