When developing applications, Webrick will automatically reload controllers, models, etc. if the source changes. For obvious reasons, it doesn''t do this for plugins, which makes it a pain to develop said plugins. I was hoping Mongrel might have some facility to say "watch this directory too and reload any changes". Obviously, re-init''ing all plugins would be performance-killing, but simply reloading the lib dir of a given plugin should be no worse than reloading models and controllers - and, let''s face it, how often does init.rb change when you''re developing a plugin? So... is there some way to get Mongrel to automatically reload my plugin when it changes? Jay Levitt
On Mon, 2006-07-24 at 19:09 -0400, Jay Levitt wrote:> When developing applications, Webrick will automatically reload > controllers, models, etc. if the source changes. For obvious reasons, it > doesn''t do this for plugins, which makes it a pain to develop said plugins. > > I was hoping Mongrel might have some facility to say "watch this directory > too and reload any changes". Obviously, re-init''ing all plugins would be > performance-killing, but simply reloading the lib dir of a given plugin > should be no worse than reloading models and controllers - and, let''s face > it, how often does init.rb change when you''re developing a plugin? > > So... is there some way to get Mongrel to automatically reload my plugin > when it changes?Nope, not unless you write something to do it. I think best you could do would be to have something else watch your plugins and kick mongrel a restart signal. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?
On Mon, 24 Jul 2006 19:29:53 -0400, Zed Shaw wrote:>> So... is there some way to get Mongrel to automatically reload my plugin >> when it changes? > > Nope, not unless you write something to do it. I think best you could > do would be to have something else watch your plugins and kick mongrel a > restart signal.Fair enough. What makes Mongrel reload other files - is the "app" dir magic? I''m wondering if there''s a way to genericize that magic and make it configurable. Also, I''m not clear how to do restarting on Windows, since there are no signals. mongrel_rails restart complains about a missing pid file. Is this currently supported only via the Windows Services interface? Jay
AWDWR v2beta5 talks on page 106 about adding "include Reloadable" at the top of models that are not ActiveRecord sublasses. Also, try "putting a require_dependency ''my_module'' just before the include MyModule call." http://www.ruby-forum.com/topic/68613 http://weblog.techno-weenie.net/2006/2/21/unitialized-constant- technoweenie - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 25, 2006, at 12:20 AM, Jay Levitt wrote:> On Mon, 24 Jul 2006 19:29:53 -0400, Zed Shaw wrote: > >>> So... is there some way to get Mongrel to automatically reload my >>> plugin >>> when it changes? >> >> Nope, not unless you write something to do it. I think best you >> could >> do would be to have something else watch your plugins and kick >> mongrel a >> restart signal. > > Fair enough. What makes Mongrel reload other files - is the "app" dir > magic? I''m wondering if there''s a way to genericize that magic and > make it > configurable. > > Also, I''m not clear how to do restarting on Windows, since there > are no > signals. mongrel_rails restart complains about a missing pid > file. Is > this currently supported only via the Windows Services interface? > > Jay > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Dan Kohn wrote:> AWDWR v2beta5 talks on page 106 about adding "include Reloadable" at > the top of models that are not ActiveRecord sublasses.Is Reloadable only triggered in Development, and ignored in Production? -- Posted via http://www.ruby-forum.com/.
Production *never* reloads any code; to do so would slow down the server. - james On 7/25/06, Dr Nic <drnicwilliams@gmail.com> wrote:> Dan Kohn wrote: > > AWDWR v2beta5 talks on page 106 about adding "include Reloadable" at > > the top of models that are not ActiveRecord sublasses. > > Is Reloadable only triggered in Development, and ignored in Production? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- * J * ~
On Tue, 2006-07-25 at 03:20 -0400, Jay Levitt wrote:> On Mon, 24 Jul 2006 19:29:53 -0400, Zed Shaw wrote: > > >> So... is there some way to get Mongrel to automatically reload my plugin > >> when it changes? > > > > Nope, not unless you write something to do it. I think best you could > > do would be to have something else watch your plugins and kick mongrel a > > restart signal. > > Fair enough. What makes Mongrel reload other files - is the "app" dir > magic? I''m wondering if there''s a way to genericize that magic and make it > configurable. >Mongrel doesn''t do this, Rails does. Sorry.> Also, I''m not clear how to do restarting on Windows, since there are no > signals. mongrel_rails restart complains about a missing pid file. Is > this currently supported only via the Windows Services interface?Oh, yeah you''re double screwed there. Ruby on windows is just seriously lacking in a lot of things. You can get it running under cygwin, maybe you can send it signals that way. Give that a try if you really need it. The only other thing I can say is maybe it''s time to change your tactic. Instead of relying on refresh to test your libraries and plugins, rely more on heftier unit tests. That''s typically what I do. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?
But I believe you can force a reset with Dispatcher.reset_application! - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 25, 2006, at 1:51 AM, James Adam wrote:> Production *never* reloads any code; to do so would slow down the > server. > > - james > > On 7/25/06, Dr Nic <drnicwilliams@gmail.com> wrote: >> Dan Kohn wrote: >> > AWDWR v2beta5 talks on page 106 about adding "include >> Reloadable" at >> > the top of models that are not ActiveRecord sublasses. >> >> Is Reloadable only triggered in Development, and ignored in >> Production? >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > -- > * J * > ~ > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On Tue, 25 Jul 2006 00:54:59 -0700, Dan Kohn wrote:> AWDWR v2beta5 talks on page 106 about adding "include Reloadable" at > the top of models that are not ActiveRecord sublasses. > > Also, try "putting a require_dependency ''my_module'' just before the > include MyModule call."Hmm.. Reloadable doesn''t seem to help for a plugin class - and I''m developing a behavior for Radiant, not a module, so I can''t control how it''s loaded. Ah well. Restarting it is, I guess. Jay
On Tue, 25 Jul 2006 12:22:55 -0400, Zed Shaw wrote:> On Tue, 2006-07-25 at 03:20 -0400, Jay Levitt wrote: >> Fair enough. What makes Mongrel reload other files - is the "app" dir >> magic? I''m wondering if there''s a way to genericize that magic and make it >> configurable. >> > Mongrel doesn''t do this, Rails does. Sorry.Ah! That''ll give me some ideas where to poke.> Oh, yeah you''re double screwed there. Ruby on windows is just seriously > lacking in a lot of things. You can get it running under cygwin, maybe > you can send it signals that way. Give that a try if you really need > it.Triple screwed - I''m using Eclipse to debug, and running cygwin ruby from Eclipse (which is the same as running it from CMD.EXE) gives weird results with some native libs such as ImageMagick, for reasons I haven''t been able to figure out yet. So I have to use the mswin32 version for now.> The only other thing I can say is maybe it''s time to change your tactic. > Instead of relying on refresh to test your libraries and plugins, rely > more on heftier unit tests. That''s typically what I do.Usually I do, but I''m writing a graphical library, and some things you can check only by eye... actually, I''m sure someone could develop some nice recognition algorithms, but I think that''s beyond the scope of unit tests! Jay