Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
[yast-devel] WebYaST - automatic plugin reloading!
  • From: Ladislav Slezak <lslezak@xxxxxxx>
  • Date: Fri, 14 Aug 2009 15:40:44 +0200
  • Message-id: <4A85695C.4030509@xxxxxxx>
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@xxxxxxx
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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups