https://github.com/daddye/loop
A tiny Ruby program used to periodically execute a command.
https://github.com/daddye/loop
Last synced: about 1 year ago
JSON representation
A tiny Ruby program used to periodically execute a command.
- Host: GitHub
- URL: https://github.com/daddye/loop
- Owner: DAddYE
- Created: 2011-12-13T18:28:08.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-13T18:51:37.000Z (over 14 years ago)
- Last Synced: 2025-01-25T21:32:55.976Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 93.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Loop
A tiny Ruby program used to periodically execute a command.
## Usage
```
Usage: loop [options]
Options:
-i, --interval=val Interval in seconds default to 0.5
-v, --version Display the version number
-h, --help Show this help message
```
## Installation
```
$ (sudo) gem install loop
```
## About
This project is a port of [watch(2)](https://github.com/visionmedia/watch) implemented by VisionMedia.
## Milliseconds resolution
We support millisecond resolution i.e.:
```
$ loop -i 0.3 echo hey
```
## Examples
Here a simple script that compile `stylus` and `coffee` in `public` folder:
Create a folder in your `sinatra`/`padrino` app:
```sh
mkdir -p app/assets/js
mkdir -p app/assets/css
```
In js put your `coffee` script files and under css `stylus` stylesheets.
Be sure to install both:
```sh
npm -g install stylus coffee-script
```
In the root of your project create a `Makefile` with this content:
```make
COFFEE=$(shell find app/assets/js -name '*.coffee' -type f)
JS=$(patsubst app/assets/js/%.coffee, public/javascripts/%.js, $(COFFEE))
STYLUS=$(shell find app/assets/css -name '*.styl' -type f)
all: $(JS) public/stylesheets/app.css
@echo -n
public/javascripts/%.js: app/assets/js/%.coffee
coffee -b -o public/javascripts -c $<
public/stylesheets/app.css: $(STYLUS)
stylus -o public/stylesheets -c $<
```
Create some `*.styl` files and `*.coffee` files under `app/assets`
Test it:
```sh
make
```
Now run loop:
```sh
loop make
```
More details are available here: https://github.com/visionmedia/watch/blob/master/Readme.md