Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7358

Re: Ruby File Auto-Run

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.ruby
Subject Re: Ruby File Auto-Run
Date 2017-06-16 23:47 +0200
Message-ID <eqj1uoFsmsiU1@mid.individual.net> (permalink)
References <2752862f-0320-4075-9dea-34f7491ec756@googlegroups.com>

Show all headers | View raw


On 16.06.2017 21:54, BeeRich33 wrote:

> Looking for a reliable ruby file reloader.  I've tried `kicker` and `filewatcher` with the latter being mostly reliable, but it too has issues loading newly installed gems.
> 
>      /users/rich/app.rb:76:in `require': cannot load such file -- pdf-reader (LoadError)

Could be an environment issue.  Does filewatcher modify the environment?

> For those not familiar with this sort of approach, I have a file `~/app.rb` that gets watched by one of these gems.  When it gets saved, an instruction gets sent so that the terminal display re-runs the file.
> 
>      filewatcher "/users/rich/app.rb" "clear; ruby /users/rich/app.rb"
> 
> Essentially, "Filewatcher, when this file is changed, run this bash script".  For the most part, works like a charm.  For some reason it trips on a `require`.
> 
> Any other gems out there that qualify?

Why use a gem?  Why not use inotifywatch directly?

http://manpages.ubuntu.com/manpages/xenial/en/man1/inotifywatch.1.html

You can explicitly watch for "close_write" which should be the time when 
you want to reexecute the program.

Cheers

	robert

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar


Thread

Ruby File Auto-Run BeeRich33 <beerich@gmail.com> - 2017-06-16 12:54 -0700
  Re: Ruby File Auto-Run Robert Klemme <shortcutter@googlemail.com> - 2017-06-16 23:47 +0200

csiph-web