I am trying to create a plugin that I am developing for automatic reloading, every time I change my code, emulating the same automatic reloading that usually happens in Rail development mode. My plugin is, first of all, the ActiveRecord mixing module. I tried all the suggestions that I could find in related Google searches. Nothing has been done yet.
In my init.rb plugin:
require 'activesupport' unless defined? ActiveSupport require 'activerecord' unless defined? ActiveRecord if RAILS_ENV == 'development' ActiveSupport::Dependencies.load_once_paths.delete lib_path ActiveSupport::Dependencies.load_once_paths.delete File.join(lib_path, 'crowd_compass', 'publisher.rb') ActiveSupport::Dependencies.load_paths << lib_path ActiveSupport::Dependencies.load_paths << File.join(lib_path, 'crowd_compass', 'publisher.rb') end ActiveRecord::Base.send(:include, CrowdCompass::Publisher)
Looking at the log of changes in rails, I noticed that the function automatically reloads all the plugins.
config.reload_plugins = true if RAILS_ENV == 'development'
This did not work as I expected when I added it to my conf / environment.rb
My plugin is structured, so all files are automatically uploaded to the namespace => directory. I did this, so I could avoid using "require" because, as I thought, this prevented my plugin from reloading automatically.
I do all my work in development mode through the rails console, and I don't know if this works differently than through mongrel (or as a web server).
The plugin works as expected, but I have to reload every time I make any changes to the code. Does anyone know a way to download plugins?
ruby-on-rails
Sean McCleary Oct 27 '09 at 21:45 2009-10-27 21:45
source share