[yast-devel] WebYaST - automatic plugin reloading!
Hi all, Karel (the RoR consultant) pointed out yesterday that it should be possible to enable reloading of plugins. It's annoying to restart the rails server after each change and then relogin again... Google found some solutions but they didn't work for me, one of them works after a small modification. So, how to achive the automatic reloading? Just put --------------8<------------- # always reload all files in development mode if ENV['RAILS_ENV'] == 'development' # get all subdirectories in app/ dirs = Dir[File.join(directory, 'app', '*')].reject{|x| not File.directory?(x)} dirs.each do |dir| $LOAD_PATH << dir ActiveSupport::Dependencies.load_paths << dir ActiveSupport::Dependencies.load_once_paths.delete(dir) end end --------------8<------------- into your 'init.rb' file in the plugin directory. Then you can just save your changes and hit [Reload] in the web browser, no need to restart/relogin! Enjoy!! Please test it, it works for me, but I don't wont to break something. If it's OK we should add it to _all_ plugins. (BTW I'm not sure if the ENV['RAILS_ENV'] test is really needed, I have added it there to be sure that production server won't be slowed down by reloading files for each request...) -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Ladislav Slezak
Hi all,
Karel (the RoR consultant) pointed out yesterday that it should be possible to enable reloading of plugins.
It's annoying to restart the rails server after each change and then relogin again...
Google found some solutions but they didn't work for me, one of them works after a small modification.
Cool, thanks !
So, how to achive the automatic reloading? Just put
--------------8<------------- # always reload all files in development mode if ENV['RAILS_ENV'] == 'development' # get all subdirectories in app/ dirs = Dir[File.join(directory, 'app', '*')].reject{|x| not File.directory?(x)}
dirs.each do |dir| $LOAD_PATH << dir ActiveSupport::Dependencies.load_paths << dir ActiveSupport::Dependencies.load_once_paths.delete(dir) end end --------------8<-------------
into your 'init.rb' file in the plugin directory.
Can we put it into the 'global' init.rb of the rest-service ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Dne 17.8.2009 13:37, Klaus Kaempf napsal(a):
Can we put it into the 'global' init.rb of the rest-service ?
I found init.rb files only in plugins. Tomorrow I'll ask the consultant how to achieve this... -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Dne 17.8.2009 14:58, Ladislav Slezak napsal(a):
Dne 17.8.2009 13:37, Klaus Kaempf napsal(a):
Can we put it into the 'global' init.rb of the rest-service ?
I found init.rb files only in plugins. Tomorrow I'll ask the consultant how to achieve this...
Actually, it was much easier: config.reload_plugins = true in environment.rb file. I have fixed that in both REST service and Web client repositories. All your changes in plugins should now take effect immediately, no need to restart the server and relogin. -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Klaus Kaempf
-
Ladislav Slezak