guard / guard-spork

Guard::Spork automatically manage Spork DRb servers
https://rubygems.org/gems/guard-spork
MIT License
296 stars 58 forks source link

Fix jruby support #86

Closed meredrica closed 11 years ago

meredrica commented 11 years ago

pull request for #85

thibaudgg commented 11 years ago

sys-proctable dependencies has been added by @jarmo 2 weeks ago to add Windows compatibility, so I'm not sure that removing it will work for the Windows crew....

Maybe we should add a notice in the README to tell to add sys-proctable to Gemfile for windows users...

@meredrica could you also add jruby in .travis.yml Thanks!

meredrica commented 11 years ago

couldn't we include the sys-proctable as a platform dependent gem?

thibaudgg commented 11 years ago

Having platform dependent gem is really a pain in the a**... I really want to avoid that as much as possible.

meredrica commented 11 years ago

well the sys-proctable one is platform dependent since it does not support jruby. however, i now finally saw the code parts that have been using sys-proctable and think that this matter is actually quite complicated. I don't really know the exact inner workings of the gem but could we not use the PID from ChildProcess instead of getting all spork instances via commandline? another way would be to fork the whole guard-spork and create a guard-spork-jruby, but i'd rather not do that since fragmentation is a pain

thibaudgg commented 11 years ago

Getting all spork instances via commandline is needed to remove all Spork instance at start (even them not launched by guard-spork with the aggressive_kill options).

But the easier way would be to check if all dependencies are installed & listed on the Gemfile and warned if not, so we can safely remove sys-proctable from gemspec. We are already doing that in Listen: https://github.com/guard/listen/blob/master/lib/listen/dependency_manager.rb

meredrica commented 11 years ago

do you want me to implement that or will you do it yourself?

thibaudgg commented 11 years ago

It would be great if you could implement it, thanks!

afazio commented 11 years ago

+1 for this pull request!

edrex-janrain commented 11 years ago

it looks like the needed process info could be obtained in windows by shelling out to the wmic command, eliminating the need for a sys-proctable dependency.

See http://unserializableone.blogspot.com/2011/10/ruby-script-to-list-process-info-in.html

thibaudgg commented 11 years ago

@edrex-janrain interesting thanks! @jarmo could you try to replace sys-proctable by that? It would be awesome!

jarmo commented 11 years ago

Done with #94. Not proud of the outcome, but it seems to work.

thibaudgg commented 11 years ago

Please can you try master branch with the patch #94 Thanks!

thibaudgg commented 11 years ago

@meredrica @afazio is it ok for you?

meredrica commented 11 years ago

did not get around to try it yet but i will do asap (this week). if it works i'll rebase my feature branch and you can merge it in

thibaudgg commented 11 years ago

@meredrica perfect thanks!

mindscratch commented 11 years ago

@meredrica @thibaudgg I'm also interested in this being resolved, thanks.

afazio commented 11 years ago

Also want to mention the following method for getting windows process list:

def get_process_info()
  procs = WIN32OLE.connect("winmgmts:\\\\.")
  procs.InstancesOf("win32_process").each do |p|
    puts p.name.to_s.downcase
  end
end

Can get much more than process names. Check out the WMI documentation here for a list of fields accessible: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394372(v=vs.85).aspx

edrex-janrain commented 11 years ago

@afazio neat, that's much better than shelling out and parsing. I see that the WIN32OLE interface is available in JRuby 1.6+ as well.

jarmo commented 11 years ago

@afazio cool! If anyone is willing to implement it, then this is the method to change: https://github.com/guard/guard-spork/blob/master/lib/guard/spork/spork_windows_instance.rb#L49-L55

jarmo commented 11 years ago

I did it myself with #97.

meredrica commented 11 years ago

there you go. i also fixed the whitespace changes

thibaudgg commented 11 years ago

@meredrica nice, I let others give it a try and I'll merge it soon. Thanks!

thibaudgg commented 11 years ago

@afazio @edrex-janrain @mindscratch @jarmo have you been able to give it a try before I merge & release it?

afazio commented 11 years ago

@thibaudgg Unfortunately I don't have a Windows environment suitable for dev or testing.

thibaudgg commented 11 years ago

@afazio thanks, sadly me neither.

edrex-janrain commented 11 years ago

I don't either, sorry. My interest was just to get guard-spork running on JRuby.

jarmo commented 11 years ago

Works with 1.9.3 MRI on Windows. I'm not using JRuby.

thibaudgg commented 11 years ago

Ok 1.3.0 released, thanks to all!

afazio commented 11 years ago

@jarmo @meredrica Thanks for your work on this!

meredrica commented 11 years ago

you're welcome

mindscratch commented 11 years ago

this is working for me using JRuby 1.6.7 (which doesn't support 'fork') on linux, thanks