Commit dfe9d61b59f9ab1210f94c4c8c0611e560dff4a4

Authored by Antonio Terceiro
1 parent 1cf42fc1

Remove unecessary Noosfero::Plugin::Context class

It was just a wrapper around controller, with no clear goal. In the end,
the context will the object which invokes the plugins. Rigth now it
means basically a controller, but wait a little bit and see. ;-)
config/initializers/plugins.rb
1 1 require 'noosfero/plugin'
2 2 require 'noosfero/plugin/manager'
3   -require 'noosfero/plugin/context'
4 3 require 'noosfero/plugin/active_record'
5 4 require 'noosfero/plugin/mailer_base'
6 5 Noosfero::Plugin.init_system if $NOOSFERO_LOAD_PLUGINS
... ...
lib/noosfero/plugin/context.rb
... ... @@ -1,15 +0,0 @@
1   -# This class defines the interface to important context information from the
2   -# controller that can be accessed by plugins
3   -class Noosfero::Plugin::Context
4   -
5   - def initialize(controller)
6   - @controller = controller
7   - end
8   -
9   - delegate :profile, :request, :response, :environment, :params, :session, :user, :logged_in?, :to => :controller
10   -
11   - protected
12   -
13   - attr_reader :controller
14   -
15   -end
lib/noosfero/plugin/manager.rb
... ... @@ -3,9 +3,9 @@ class Noosfero::Plugin::Manager
3 3 attr_reader :environment
4 4 attr_reader :context
5 5  
6   - def initialize(environment, controller)
  6 + def initialize(environment, context)
7 7 @environment = environment
8   - @context = Noosfero::Plugin::Context.new(controller)
  8 + @constantize = context
9 9 end
10 10  
11 11 delegate :each, :to => :enabled_plugins
... ...