watcher
Version, currently 0.3.014 versions
- 0.3.0latestJun 17, 2018
- 0.2.3not indexedJun 18, 2018
- 0.2.2not indexedJun 18, 2018
- 0.2.1not indexedJun 18, 2018
- 0.2.0not indexedJun 18, 2018
- 0.1.9not indexedJun 18, 2018
- 0.1.8not indexedJun 18, 2018
- 0.1.7not indexedJun 18, 2018
- 0.1.6not indexedJun 18, 2018
- 0.1.5not indexedJun 18, 2018
- 0.1.4not indexedJun 18, 2018
- 0.1.3not indexedJun 18, 2018
- 0.1.1not indexedJun 18, 2018
- 0.1.0not indexedJun 18, 2018
github.com/faustinoaq/watcher
Crystal shard to watch file changes using File.stat
Installation
# Add this to your shard.yml
dependencies:
watcher:
github: faustinoaq/watcher
version: ~> 0.3.0Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Faustino Aguilar
Dependencies
This version declares no dependencies.
README
watcher
Crystal shard to watch file changes. This shard use the same code implemented here (Guardian) and here (Sentry).
Installation
Add this to your application's shard.yml:
dependencies:
watcher:
github: faustinoaq/watcher
Usage
Use the keyword watch to watch files or file groups, for example:
require "watcher"
watch "src/assets/js/*.js" do |event|
event.on_change do |files|
files.each do |file, {first, timestamp}|
puts "File #{file} has changed at #{timestamp}"
end
# ...
end
end
Also you can have more than one watcher, just use spawn
spawn do
watch ["src/assets/*.css", "src/views/*.html"] do |event|
event.on_change do
# ...
end
end
end
# Other watcher
watch ... do |event|
#...
end
And you can change time interval for a watcher.
watch "public/*.json", interval: 0.5 do |event|
event.on_change do
# ...
end
end
Also you can use Watcher.watch instead of watch.
How does it work?
Watcher uses timestamps to check file changes every second, if you want some more advanced then you can use Watchbird that uses libnotify to check events like modify, access and delete but just work in Linux for now.
Contributing
- Fork it ( https://github.com/faustinoaq/watcher/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- faustinoaq Faustino Aguilar - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.3.0- Tagged
- Jun 17, 2018
- Commit
a0f6a02fcdd9- Indexed
- yes
Dependents
Repository
github.com/faustinoaq/watcher
Metadata
- Created
- Aug 12, 2026
- Updated
- Nov 29, 2026
- Synced
- Nov 29, 2026
- Versions
- 14