Comments (7)
That's a great idea. It would be natural to name such an option -r/--restart
This could be used to send a kill 9/SIGHUP to a webserver and then start the webserver again every time some change in the filesystem happens.
$ filewatcher "**/*.js" --restart "ruby sinatra"
from filewatcher.
@acadet I have released a new version of filewatcher with new --dontwait
and --restart
options. Now you should be able to use it to start a webserver and have it restarted on file updates.
$ filewatcher --restart --dontwait "**/*.html" "python -m SimpleHTTPServer"
Please let me know if you have any problems.
BTW! I think this is a real cool functionality.
from filewatcher.
@acadet @flbulgarelli @oldpatricka @noplay @kitofr I have pushed a new version of the filewwatcher gem today that can automatically restart long running processes, like web servers like this:
$ filewatcher --restart --dontwait "**/*.html" "python -m SimpleHTTPServer"
I was thinking about making automatic restart default behaviour in filewatcher. That means for instance that filewatcher as a default wouldn't wait for long running tests to finish if source files are updated. I don't know if this behaviour is desired. The advantage is that you don't have to remember any filewatcher switches to make it auto reload sinatra apps.
$ filewatcher "**/*.html" "ruby my_sinatra_app.rb"
Comments? :-)
from filewatcher.
Hey Thomas,
It works fine. You can upgrade filewatcher
to make this option as default. However, I definitively think you should allow user to change behaviour if s/he wish ;)
Besides, I have noticed that, from now on, you need to surround file pattern to watch with quotes, whereas, before, this was not required.
Anyway, keep going like that man. Your gem is fantastic and really useful :)
from filewatcher.
Hi Adrien,
I too think that the default behaviour of filewatcher should be to restart the running process started be filewatcher. This is convenient when running tests and off course when you are running a webserver.
Instead of having an option called --restart', instead there should be an option called '--wait-to-finish
, a hurry option that takes an argument --hurry false|true', or have an restart option that takes an argument
--restart true|false`.
from filewatcher.
You should keep it simple. If --restart
option has been provided, restart as soon as a watched file has been edited. Otherwise, run filewatcher
using your default behaviour ;)
Ditto for --hurry
(run command on start).
It could be the opposite, obviously, it's up to you. However, just spot if option has been provided or no. Investigating value is more complex, in my opinion.
from filewatcher.
Implemented. Thanks to @acadet for this great idea. I use it myself everyday.
from filewatcher.
Related Issues (20)
- The filewatch does not work if files are creating too fast HOT 5
- unexpected behavior on Windows and two callbacks on one DELETE on Linux HOT 3
- --restart flag support process kill with custom signal? HOT 3
- filewatcher loops infinitely when executing a script that invokes ssh HOT 9
- "Batching" all changes into one event HOT 3
- Sync to database example HOT 1
- Question regarding API HOT 3
- How do I know which directory has changed when there is a change HOT 1
- Stable release soon? HOT 2
- Filewatcher not found in Ruby 3.2.2 HOT 13
- When used with multiple watch paths block vars are improperly assigned HOT 5
- Speed up tests HOT 1
- `Filewatcher` vs `FileWatcher` case change from rubygems HOT 4
- 1.0 Release -- event 'updated' raises NotImplementedError HOT 4
- Crash on file deletion (via executable) HOT 1
- Doesn't seem to work if repos have a dot in the name HOT 2
- Replace Gemnasium with Depfu
- Trollop dependency is deprecated HOT 9
- Switch from Travis CI to Cirrus CI HOT 1
- Detect rename HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filewatcher.