filewatcher / filewatcher Goto Github PK
View Code? Open in Web Editor NEWRuby gem to perform actions when files are changed. No config files. Pure Ruby implementation and minimalistic Ruby API.
License: MIT License
Ruby gem to perform actions when files are changed. No config files. Pure Ruby implementation and minimalistic Ruby API.
License: MIT License
If $FiLENAME is "hello.js" or "hello.ts", then $BASENAME should be "hello".
This should be useful when running compiled code. Example
$ filewatcher "*.ts" "tsc $FILENAME;node $BASENAME.js"
Hello, I've met this problem when using CLI:
filewatcher -l "here.txt" "echo $FILENAME was edited"
Watching:
here.txt
was edited
was edited
was edited
Any ideas of what can be wrong?
Hello.
The same story as in #90: I can't connect GitHub applications for foreign repositories.
Reasons for switch:
Another alternative: Circle CI (many Ruby projects switched to this, as RuboCop and something else about which I forgot).
But Circle CI:
If you connect this application — I'll write config file and everything else.
(There is example of switching: AlexWayfer/flame#60)
Hello!
I saw that the syntax highlight for Markdown files is broken in Atom Editor, and would like to correct the syntax without changing the appearance.
Also saw lots of warnings from Rubocop, and would like to fix this (without adding functionality, bug fixing or replacing spaces with tabs).
What do you think about this?
Why; because it makes it easier to do things like clearing the shell window, play sounds or other things.
Hi thomas!
Thank you for such a great tool.
Wanted to let you know, I think something is happening with rubygems where the classname Filewatcher
is getting changed to FileWatcher
.
When I tried the API examples I kept getting the following error:
$ bundle exec ruby example.rb
example.rb:3:in `<main>': uninitialized constant Filewatcher (NameError)
I wasn't sure why but then I looked at the gem:
$ grep FileWatcher ~/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/filewatcher-0.5.4/lib/filewatcher.rb
class FileWatcher
See how the name got changed to camel case?
Thought you might want to know because it breaks the copy and pastable examples in your README.
As soon as api is stable you should be on a major version.
Hi!
I have found a strange behaviour in the ``FileWatcher` class. Let's suppose I want to watch the /tmp directory
FileWatcher.new('/tmp/', debug: true)
What I get - irb session - seems legit:
Watching:
/tmp/KSOutOfProcessFetcher.502.OlaJUhhgKAnFsX7fZ0FyXTFxIgg=
/tmp/launchd-1829.bHB047
/tmp/launchd-365.vTFqBt
/tmp/mysql.sock
=> #<FileWatcher:0x007fe4b40150e0 @unexpanded_filenames="/tmp/", @last_mtimes={"/tmp/KSOutOfProcessFetcher.502.OlaJUhhgKAnFsX7fZ0FyXTFxIgg="=>2014-12-23 16:41:53 -0300, "/tmp/launchd-1829.bHB047"=>2014-12-23 14:45:26 -0300, "/tmp/launchd-365.vTFqBt"=>2014-12-23 14:44:25 -0300, "/tmp/mysql.sock"=>2014-12-23 14:08:22 -0300}, @filenames=["/tmp/KSOutOfProcessFetcher.502.OlaJUhhgKAnFsX7fZ0FyXTFxIgg=", "/tmp/launchd-1829.bHB047", "/tmp/launchd-365.vTFqBt", "/tmp/mysql.sock"]>
However, lets suppose that - for some reason - I would like to use globs for the directory
FileWatcher.new('/tmp/*', debug: true)
or the directory and subdirectories:
FileWatcher.new('/tmp/**', debug: true)
In both cases, results are similar:
Watching:
./tmp/sync
=> #<FileWatcher:0x007fe4b4005aa0 @unexpanded_filenames="/tmp/*", @last_mtimes={"./tmp/sync"=>2014-12-22 17:01:20 -0300}, @filenames=["./tmp/sync"]>
Watching:
./tmp/sync
=> #<FileWatcher:0x007fe4b3843998 @unexpanded_filenames="/tmp/**", @last_mtimes={"./tmp/sync"=>2014-12-22 17:01:20 -0300}, @filenames=["./tmp/sync"]
As you can see, the directory watched changed from the root tmp directory /tmp
, to the tmp directory relative to this path ./tmp
- which existed by coincidence.
Is this a bug or am I just missing something?
Thanks!
Hi. I'm trying to write a small directory watcher using your utility through the Ruby API, using OS X 10.11.
Something as simple as...
FileWatcher.new("lib/").watch(1) do |filename, event|
puts event.to_s
end
...reports file moves, like dragging and dropping a file between directories within "lib" first as "new" and then later as "delete" consistently, regardless of changing the watch interval. This is causing me problems with watching files for the sake of creating symbolic links.
In the docs, you mentioned: "When a file is renamed it is detected as a deletion followed by a file addition."--is that rule supposed to extend to file moves as well?
I have a procfile:
---
statics: ./tools/watch_static.rb
And the file:
#!/usr/bin/env ruby
require 'set'
require 'filewatcher'
require 'fileutils'
puts 'starting...'
FileWatcher.new(['src/example.com/css/*', 'src/example.com/*'], true).watch do |file_path, evt|
if File.directory? file_path
puts "dir: #{file_path}"
else
rel = file_path.gsub 'src/example.com', ''
targ = File.join('build/example.com', rel)
puts "copying #{file_path} to #{targ}"
begin
FileUtils.cp file_path, targ
rescue => e
puts e
end
end
end
And a Gemfile:
source 'https://rubygems.org'
group :dev do
gem 'foreman'
gem 'filewatcher'
end
gem 'albacore', '~> 2'
This is the output:
✗ bundle exec foreman start
10:18:18 statics.1 | started with pid 3232
(nothing at the end, that is)
If I start it manually:
➜ example.com git:(feature/app-design) ✗ ./tools/watch_static.rb
starting...
Watching:
src/example.com/css/app.css
src/example.com/css/grid.css
src/example.com/css/main.css
src/example.com/css/normalize.css
src/example.com/css/splash.css
src/example.com/api
src/example.com/app.html
src/example.com/css
src/example.com/fonts
src/example.com/img
src/example.com/index.html
src/example.com/js
src/example.com/node_modules
src/example.com/package.json
src/example.com/README.md
src/example.com/webpack.config.js
With appropriate output if I change a file...
I've tried running foreman with bundler. Foreman without bundler. Both act the same. From within foreman I've tried statics: sh -c './tools/watch_static.rb'
, bundle exec ruby tools/watch_static.rb
and any other combo I can think of. If I print PATH from before the running of the file on the 'statics' row, it prints a valid RBENV-based path which has FileWatcher in its downloaded set of gems. Any other program I run with Procfile works.
I'm on OS X, ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0], and this lockfile:
GEM
remote: https://rubygems.org/
specs:
albacore (2.3.22)
map (~> 6.5)
nokogiri (~> 1.5)
rake (~> 10)
semver2 (~> 3.4)
filewatcher (0.5.0)
trollop (~> 2.0)
foreman (0.78.0)
thor (~> 0.19.1)
map (6.5.5)
mini_portile (0.6.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
rake (10.4.2)
semver2 (3.4.2)
thor (0.19.1)
trollop (2.1.2)
So I'm running out of ideas now. Do you have any pointers?
Hello,
I'm trying to write 1 script that can watch for my Jade, SCSS and CoffeeScript files and compile them on save.
Your filewatcher has got me there except for 1 obstacle, I can't tell which file was saved so I can re-compile it.
I don't use ruby, so I'm using this script from the command line. I run the following code:
filewatcher -r . "*.jade *.scss" "echo [X] updated"
All I need is for [x] to be replaced with the filename. Is that possible through your plugin?
I've tried a few different variable names (thought I might get lucky) but had no luck.
When I create a new Filewatcher with an array of paths it does not properly assign the block vars. Instead I get a Hash assigned to the first variable.
Filewatcher.new(watch_dirs).watch do |fn, ev|
fn will now contain
{"/path/to/index.md"=>:deleted}
ev is empty.
Notice also, that the event is also :deleted and is not :changed like it should be.
I have validated that this does work properly using the gem version of filewatcher, albeit you now have to use FileWatcher.new, not Filewatcher.new
Seems like one of the key features of the filewatch gem, is the ability to tail files. This feature could be implemented as a separate gem that monkeypatches or extends filewatcher.
Hello!
Do we need JRuby builds?
The only that fails: https://travis-ci.org/thomasfl/filewatcher
Anybody using filewatcher
on JRuby?
None of the following work
filewatcher ./src/*.js 'echo $FILENAME'
filewatcher ./src/*.* 'echo $FILENAME'
Seems like having the glob in the filename while also having a directory path is making it break.
All of the following work, but don't let me specify which type of file within the directory I want to watch:
filewatcher ./src 'echo $FILENAME'
filewatcher ./ 'echo $FILENAME'
Thoughts?
Hi, I saw on shell command section, that there's an ability to exclude nodes from patterns, but I do not really see how is it implemented in library.. Can you please point me to code for me to understand in how to use it via library, e.g. requiring gem from my script and creating an instance. thx.
Hello!
filewatcher
has an --interval
option.
But it's only for files check.
I have a problem: massive files changes by git (for example), when many-many files are changed, or added, or anything else, and in the same time filewatcher
is working — it's begin triggering shell command
many-many times.
Using with --restart
.
--interval
doesn't help.
We need for a code (or option) about trigger delay: for example, if any (watched) file has been changed — trigger shell command
and wait 100–300 ms (for example) before next triggering.
Or, may be, don't collect collection of changed files, and trigger only by first.
Hi, I saw this example in the readme:
filewatcher --restart --dontwait "**/*.html" "python -m SimpleHTTPServer"
and when I tried this, I got "Address already in use" error.
$ filewatcher --restart --dontwait "**/*.html" "python -m SimpleHTTPServer"
Serving HTTP on 0.0.0.0 port 8000 ...
Serving HTTP on 0.0.0.0 port 8000 ...
127.0.0.1 - - [14/Dec/2016 16:48:19] "GET / HTTP/1.1" 200 -
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/SimpleHTTPServer.py", line 230, in <module>
test()
File "/usr/lib/python2.7/SimpleHTTPServer.py", line 226, in test
BaseHTTPServer.test(HandlerClass, ServerClass)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 595, in test
httpd = ServerClass(server_address, HandlerClass)
File "/usr/lib/python2.7/SocketServer.py", line 420, in __init__
self.server_bind()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.7/SocketServer.py", line 434, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
Is there any way to fix this?
It works great whin main thread.
But when I try watch files from another thread, it not work.
Here my code:
Thread.new do
FileWatcher.new(["lib/", "Rakefile"]).watch do |filename|
puts "Updated " + filename
end
end
The callback only triggered at the first time I updated files, and when I try again it no crash, no error message, just not work.
Hi, I struggling with getting file events showing pid (and process name) who invoked change to file. For example, set filewatchet to display vim if I changed watched file via vim. Is it even possible? thx.
I'm trying to invoke filewatcher using kk
alias kk="filewatcher '~/app.rb' 'app'"
alias app="clear; ruby ~/app.rb"
RVM has 2.3.2 chosen to use
and as --default
. Ruby -v
indicates just that. Upon kk
, Ruby 2.0.0 crashes for some reason. I'm not sure why. app.rb
is a very simple file and runs in the terminal just fine.
HQ:~ rich$ filewatcher "~/app.rb" "app"
/Users/rich/.rvm/gems/ruby-2.3.2/gems/psych-2.2.0/lib/psych.bundle: [BUG] Segmentation fault
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
the more detail of.
-- Control frame information -----------------------------------------------
c:0038 p:-17579991633118 s:0182 e:000181 TOP [FINISH]
c:0037 p:---- s:0180 e:000179 CFUNC :require
c:0036 p:0115 s:0176 e:000175 METHOD /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55
c:0035 p:0028 s:0166 e:000165 TOP /Users/rich/.rvm/gems/ruby-2.3.2/gems/psych-2.2.0/lib/psych.rb:7 [FINISH]
c:0034 p:---- s:0164 e:000163 CFUNC :require
c:0033 p:0115 s:0160 e:000159 METHOD /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55
c:0032 p:0078 s:0150 e:000149 METHOD /Library/Ruby/Site/2.0.0/rubygems.rb:601
c:0031 p:0013 s:0146 e:000145 METHOD /Library/Ruby/Site/2.0.0/rubygems/config_file.rb:327
c:0030 p:0145 s:0140 e:000139 METHOD /Library/Ruby/Site/2.0.0/rubygems/config_file.rb:196 [FINISH]
c:0029 p:---- s:0129 e:000128 CFUNC :new
c:0028 p:0031 s:0125 e:000124 METHOD /Library/Ruby/Site/2.0.0/rubygems.rb:289
c:0027 p:0016 s:0122 e:000121 METHOD /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:63
c:0026 p:0181 s:0113 e:000112 BLOCK /Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:37
c:0025 p:0026 s:0105 e:000104 METHOD /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tempfile.rb:324
c:0024 p:0050 s:0100 e:000099 METHOD /Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:17
c:0023 p:0027 s:0089 e:000088 BLOCK /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:161 [FINISH]
c:0022 p:---- s:0087 e:000086 CFUNC :chdir
c:0021 p:0015 s:0083 e:000082 BLOCK /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160 [FINISH]
c:0020 p:---- s:0081 e:000080 CFUNC :synchronize
c:0019 p:0123 s:0078 e:000077 METHOD /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159
c:0018 p:0022 s:0068 e:000067 BLOCK /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198 [FINISH]
c:0017 p:---- s:0065 e:000064 CFUNC :each
c:0016 p:0108 s:0062 e:000061 METHOD /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195
c:0015 p:0026 s:0058 e:000057 BLOCK /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436
c:0014 p:0020 s:0055 e:000054 METHOD /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45
c:0013 p:0216 s:0050 e:000049 METHOD /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434
c:0012 p:0037 s:0046 e:000045 METHOD /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60
c:0011 p:0007 s:0043 e:000042 METHOD /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56
c:0010 p:0019 s:0038 e:000037 BLOCK /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925 [FINISH]
c:0009 p:---- s:0035 e:000034 IFUNC
c:0008 p:---- s:0033 e:000032 CFUNC :each
c:0007 p:---- s:0031 e:000030 CFUNC :find
c:0006 p:0009 s:0028 e:000027 METHOD /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924
c:0005 p:0017 s:0023 e:000022 METHOD /Library/Ruby/Site/2.0.0/rubygems.rb:185
c:0004 p:0050 s:0018 e:000017 RESCUE /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:132
c:0003 p:0444 s:0015 e:000014 METHOD /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144
c:0002 p:0079 s:0005 E:001940 EVAL /Users/rich/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:9 [FINISH]
c:0001 p:0000 s:0002 E:002218 TOP [FINISH]
Hello, first off I'm a new developer and this is my first time opening an issue on an OS project so please be gentle!
The Ruby API examples show Filewatcher.new instead of FileWatcher.new:
require 'filewatcher'
Filewatcher.new(['lib/', 'Rakefile']).watch do |filename|
puts "Changed #{filename}"
end
Should be:
require 'filewatcher'
FileWatcher.new(['lib/', 'Rakefile']).watch do |filename|
puts "Changed #{filename}"
end
As in the gem file the class is defined as FileWatcher:
class FileWatcher
attr_accessor :filenames
def self.VERSION
return '0.5.4'
end
I wouldn't make a comment if it was just one example, but all of the API examples are incorrect and it really threw me off for a while.
Thanks for this awesome gem!
Hi again :)
Another cool enhancement would be to support interruptions. Currently, you queue a new process when any file has been edited, meanwhile command is running. Do you think it would be possible to add an option to force command interruption if any notification is incoming?
I want to watch C:/Git/MyProject
for changes to *.cshtml files. I do not want to be notified about directory changes. I tried this in powershell
filewatcher *.cshtml "C:/Git/MyProject" "rake myCommand %FILENAME%"
I'm getting 2 seperate hits. One for the file that changed and another for the file's directory.
Hey, I'm looking for a way to monitor file access not modification.
Is there a way to monitor when a file is being read?
Thanks.
Error:
/Users/rich/app.rb:79:in `require': cannot load such file -- geokit (LoadError)
from /Users/rich/app.rb:79:in `<main>'
Running ruby app.rb
works fine. filewatcher doesn't seem to like this file for some reason. Here it is:
require 'geokit'
A couple of changes recently but nothing that should break this. I've logged out and back in (Mac OS) and I'm using RVM with 2.3.3p222. I'm not sure what else to report, nor where to look.
Absolutely love this tool - have run into an issue with my workflow that I suspect might be common to others as well.
Example usage:
filewatcher -r '**/*.rb' 'rubocop $FILENAME'
# in another terminal...
git checkout some-branch-with-multiple-changes
This will spawn a large number of rubocop instances (or whatever the dispatched process happens to be), which can end up causing CPU/memory issues if there are a lot of observed changes. Would be great to support a throttle value (perhaps only on the restart flag?), such that subsequent triggers within a small margin do not trigger a restart?
Unless the extra processes are potentially a bug? Just unclear as to whether or not it's intended behavior.
I need to get just the last file added if there is an event, but if i add 6 files it will just get all of those and fire the event on each of the files.
Hello!
How can I run filewatcher
in background?
My case:
#!/usr/bin/env ruby
def bash(command)
system "bash -c \"#{command}\""
end
bash "filewatcher 'some_files' 'some_command' &"
bash "tail -f some_log_file"
When I press Ctrl+C in tail
— filewatcher
is also stopping.
I want to stop tail
, but not filewatcher
.
Thanks!
Despite the planned major changes in the future, we should release a new version of the gem, which includes all the current changes. This is an increase of minor (the second) version, but by a large number (roughly equal to the number of changes made).
I think the project already has more than 350 lines of code now 🤔
Sent from my Sony E5823 using FastHub
Sometimes I've got something like this:
/home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/lib/filewatcher/env.rb:13:in `realpath': No such file or directory @ realpath_rec - /home/alex/Projects/some_project/some_file (Errno::ENOENT)
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/lib/filewatcher/env.rb:13:in `realpath'
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/lib/filewatcher/env.rb:13:in `initialize'
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/bin/filewatcher:91:in `new'
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/bin/filewatcher:91:in `block in <top (required)>'
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/lib/filewatcher/cycles.rb:40:in `block (2 levels) in trigger_changes'
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/lib/filewatcher/cycles.rb:39:in `each'
from /home/alex/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/filewatcher-1.0.0/lib/filewatcher/cycles.rb:39:in `block in trigger_changes'
Also I saw this in some Travis CI jobs:
sleep
pauses for faster local running/filewatcher.rb:45:in `stat': No such file or directory - _views/home-intro.erb (Errno::ENOENT)
I get the above error after deleting. In this specific example I deleted: _views/home-intro.erb
I'm trying to watch https://github.com/mrdoob/three.js, tried the following
https://github.com/mrdoob/three.js
mrdoob/three.js
github.com/mrdoob/three.js
But each come back with the error "invalid repo name"
Hi there,
I would like to know if it is possible to add an option to your program. This option would run provided command when starting filewatcher
.
Thanks :)
Hi,
I think version 0.5.0 broke the nice (without stack trace) Ctrl+C interrupt.
In my code I have my own trap for SIGINT, that simply says a nice "Goodbye".
Up until now (with 0.4.0) it worked very nicely, with 0.5.0 it does not.
I should mention that I am forking several filewatcher processes.
(Also I wish the spinner was disabled by default).
If a repro case is required, I can try and make one.
EDIT:
I have created the smallest repro case I could make.
Available in this gist
The --restart option should also be available as --background and --fork to make it sort of easier to remember.
Not totally sure about this.
ENOENT: No such file or directory @ rb_file_s_stat
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:56:in `stat'
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:56:in `block in filesystem_updated?'
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:55:in `each'
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:55:in `filesystem_updated?'
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:26:in `block in watch'
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:24:in `loop'
/home/bmorris/.rvm/gems/ruby-2.1.0/gems/filewatcher-0.3.1/lib/filewatcher.rb:24:in `watch'
Hi, @thomasfl!
Now we have dangerous badge in the README:
Let's switch to Depfu.
How it works: AlexWayfer/flame#49
Sorry, but I can't switch, you should do it: https://twitter.com/depfu/status/1004746482380099584
Thank you.
Is it possible to watch a whole folder and execute a command every time when add a file in that folder. Thanks
How to replicate:
filewatcher '**/*.t' 'echo got file: $FILENAME'
mkdir test
touch test/haha.t
rm -R test
Then exception would be thrown:
gems/filewatcher-0.5.1/bin/filewatcher:108:in `realpath': No such file or directory @ realpath_rec - /home/songyy/fswatch (Errno::ENOENT)
After the latest update, I'm running into an error:
NotImplementedError: Unknown event -- updated -- templates/product.liquid
This is occuring in the watch method below:
action = if [:changed, :new].include?(event) :send_asset elsif event == :delete :delete_asset else raise NotImplementedError, "Unknown event -- #{event} -- #{filename}" end
I also ran into a case sensitivity issue calling FileWatcher.new() rather than Filewatcher.new() for those who may run into the same.
Hello, I wasn't sure if this was the place to ask, or if I should email you. I'm trying to use wildcards in the ruby api, something like:
FileWatcher.new(["README_v*.rdoc"]).watch() do |filename|
puts "Updated " + filename
end
where it would watch README_v1.rdoc or README_v2.rdoc etc...
Is this possible?
Thanks
When installing filewatcher with bundler, trollop shows this message:
Post-install message from trollop:
! The 'trollop' gem has been deprecated and has been replaced by 'optimist'.
! See: https://rubygems.org/gems/optimist
! And: https://github.com/ManageIQ/optimist
I'm trying to sniff the latest log file for postgresql and tail that file. Since it changes, I want to grab the last file and output tail:
filewatcher "$(ls -t /var/db/postgres/data96/pg_log | head -1)" "tail -n 20 /var/db/postgres/data96/pg_log/$(ls -t /var/db/postgres/data96/pg_log | head -1)"
It resolves properly on its own, but not after filewatcher tries to use it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.