Closed ESWAT closed 1 year ago
osx/foundation is rubycocoa thing
need to rewrite xrefresh-server, because it just stopped working for me last week too
Any progress here?
XRefresh works again for me, so I'm not working on this issue, because on my machine all works well. Unfortunately I don't remember what I did to fix it.
You are here on your own guys.
or you may try this (quite old fix): http://gist.github.com/158851
I've tried it (found this link on http://xrefresh.binaryage.com/#osx). Nothing changed. Exactly same problem.
I've solved the problem by compiling the binaries. Comes out that when you install RubyCocao from .dmg file, the foundation library is not included. So just compile RubyCocao, and everything should be fine :)
Ohh, I can't compile it.
NV: for some strange reason jruby got onto your path during installation.
hint: look at shebang in the /Users/nikitavasilev/Downloads/RubyCocoa-1.0.1/ext/rubycocoa/extconf.rb
it is probably pointing jruby for some unknown reason
darwin, thanks for the tip, but can't see shebang here
➤ cat /Users/nikitavasilev/Downloads/RubyCocoa-1.0.1/ext/rubycocoa/extconf.rb
require 'rbconfig'
# Xcode 2.2 moved ruby.h
unless File.exist? File.join(Config::CONFIG['archdir'], 'ruby.h')
Config::CONFIG['archdir'] = Config::CONFIG['archdir'].sub(/powerpc/, 'universal')
end
require 'mkmf'
def command(cmd)
$stderr.puts "execute '#{cmd}' ..."
raise(RuntimeError, cmd) unless system(cmd)
$stderr.puts "execute '#{cmd}' done"
end
$CFLAGS = '-F../../framework/build/Default'
$LDFLAGS = '-F../../framework/build/Default -framework RubyCocoa'
$CFLAGS << ' -fno-common -g -fobjc-exceptions -Wall -I/usr/include/libxml2 -DHAS_LIBXML2 -I/usr/include/ffi -DMACOSX '
$LDFLAGS << ' -undefined suppress -flat_namespace -lxml2 -lffi '
create_makefile('rubycocoa')
command "mv -f Makefile Makefile.bak"
command "sed -e 's/-no-cpp-precomp//' -e 's/-no-precomp//' Makefile.bak > Makefile"
open that file and add these lines on the beginning:
puts RUBY_VERSION
puts $:
run again
It does not show me anything because ruby install.rb config
overriding extconf.rb
every time I call it.
I've added these lines and run ➤ /usr/local/bin/ruby "/Users/nikitavasilev/Downloads/RubyCocoa-1.0.1/ext/rubycocoa/extconf.rb"
instead of ruby install.rb config
1.8.7
/usr/local/lib/ruby/gems/1.8/gems/gemcutter-0.3.0/lib
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin9.7.0
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/vendor_ruby/1.8
/usr/local/lib/ruby/vendor_ruby/1.8/i686-darwin9.7.0
/usr/local/lib/ruby/vendor_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-darwin9.7.0
.
WARNING: JRuby does not support native extensions or the `mkmf' library.
Check wiki.jruby.org for alternatives.
/Users/nikitavasilev/Downloads/RubyCocoa-1.0.1/ext/rubycocoa/extconf.rb:24: undefined method `create_makefile' for main:Object (NoMethodError)
Hm bummer :( I'm sorry I'm not a ruby pro, so I don't know how to solve this. Good luck!
1.8.7 is fine, paths look good
Just follow setup instructions for Sources Releases on: http://rubycocoa.sourceforge.net/GettingStarted
I re-installed ruby, then successfully built RubyCocoa from sources and now xrefresh-server works.
Same problem here, same solution. :)
OK well I've reinstalled Ruby (EE 1.8.6), rebuilt RubyCocoa from source, and xrefresh-server still refuses to work.
Maybe you could bundle the required RubyCocoa framework with the gem, as Passenger prefPane has? http://github.com/alloy/passengerpane/commit/de41b4e66253599f860f1bf5fdffd383f82f6a99
Or maybe we should use directory_watcher instead? Seems like it started using native fsevent (but I haven't tested it yet).
Even better. I just would be really happy to be able to start using this awesome utility...
You may want to give python xrefresh-server a spin: http://github.com/YouWoTMA/xrefresh-server/tree/master/linux/
I'm going to rewrite xrefresh to websockets + nodejs some day. But it will be xrefresh2
darwin, I haven't seen something like directory_watcher for Node. There is a fs.watchFile(), but I don't think it can handle many files without puking.
NV: you are right, but don't worry, until I get to it, there will be a much better API in node.js :-) or maybe I will just use directory_watcher ... we will see
darwin, the python version requires pyinotify, which relies upon the os-level inotify, which is unavailable on OSX.
A colleague of mine told me he was pm'ing you about kicker, a ruby project that puts a nice API around fsevent. How hard would it be to rip out the RubyCocoa stuff and replace it with kicker? Is RubyCocoa only used to monitor the filesystem for changed files?
It would probably take few hours to replace this implementation with directory_watcher or similar library, I guess: http://github.com/darwin/xrefresh-server/blob/master/lib/xrefresh-server/monitor.rb
But I'm not going to do it right now, because xrefresh-server works for me without issues.
Marc did here yet-another-inotify implementation for linux: http://github.com/MarcWeber/xrefresh-server/compare/master...linux
I agree it would be nice to have one version working cross-platform. Directory_watcher is ideal candidate for it.
I just ripped out monitor.rb and replaced it with an implementation based on directory_watcher. Next I'll be ripping out the server and replacing it with something built on eventmachine. I guess I'll fork your project and put a link up in this thread.
thumbs up
OK well I just pushed my commits. I see you guys are already watching :)
But just for anyone else who stumbles on this thread: http://github.com/sdhull/xrefresh-server
I'd love to hear how it's working for you folks. I can honestly repeat the developer's mantra: "It works fine on my box." :D
Looks great. Good job Steve. I'm going to merge it as "an official" next version of xrefresh-server. I'm also tempted to drop windows traybar monitor support (.NET).
I have two notes (maybe I'm wrong, I did just brief review):
sdhull/xrefresh-server@1453d29fbbe3efc8214a16d6d16715ef4888e668
darwin/xrefresh-server
I think it's too early to merge it to the main repo.
@darwin --
@NV -- haha... when I was testing, I added a single directory with like 3 sub-directories... it performed quite well. But (after your post here), I tried it again with the default configuration (my entire home directory), and performance is much more like your screenshot. FWIW, it's entirely fine as long as you're not monitoring too many directories.
To fix this, I'm thinking maybe using the "fsevent" branch of directory_watcher might work, but I've been unable to get bundler to use that branch... anyway, it works great for me now! (YMMV). :)
Ugh. Well I finally got it working with an EM-based file scanner (thanks to help from NV), but it wasn't really any easier on system resources, presumably due to the 0.5-second ruby loop looking for new files that match the given glob.
I think that getting it working with FSEvent-based directory_watcher would provide better performance, but I'm not sure it's worth the effort. Currently (pending some cross-platform testing), this solution should work fine on any system. Adding platform-specific junk to make it easier on system resources, just so you can watch your entire home directory... well, it seems pointless to me. Maybe as directory_watcher matures, it will add platform-specific enhancements transparently, and xrefresh-server won't have to be any wiser.
Frankly, the performance is perfectly acceptable to me, it just means you should only be watching the directory you're currently working on. No problem.
Just a note to everyone interested here. For LiveReload, we did http://github.com/mockko/em-dir-watcher gem which is already a lot smarter than fssm and directory_watcher, and it has a 90%-baked non-RubyCocoa (FFI-based) FSEvents backend. We're looking for contributions to finish that backend, so that guys without RubyCocoa can finally get some peace.
You can also try guard & guard-livereload http://github.com/guard/guard. RubyCocoa is not needed (work on 1.8.7 & 1.9.2)
Heya,
After installing the Firefox addon, RubyCocoa and the required gems, I've run into this while trying to start the server:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require': no such file to load -- osx/foundation (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /usr/local/lib/ruby/gems/1.8/gems/xrefresh-server-0.3.0/lib/xrefresh-server/monitor.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /usr/local/lib/ruby/gems/1.8/gems/xrefresh-server-0.3.0/bin/../lib/xrefresh-server.rb:66 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /usr/local/lib/ruby/gems/1.8/gems/xrefresh-server-0.3.0/bin/xrefresh-server:15 from /usr/local/bin/xrefresh-server:19:in `load' from /usr/local/bin/xrefresh-server:19OSX 10.6.2 Firefox 3.5.5 Firebug 1.4.5 XRefresh 1.3 Ruby 1.8.7 (instead of Apple's, built with the --enabled-shared flag on) rubygems 1.3.5 RubyCocoa 1.0.1
Any ideas on what's happening? :)