Class: Rails::Initializer

Inherits:
Object show all
Defined in:
lib/desert/rails/1.2.0/initializer.rb

Instance Method Summary collapse

Instance Method Details

#load_plugin_with_desert(directory) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/desert/rails/1.2.0/initializer.rb', line 3

def load_plugin_with_desert(directory)
  return if Desert::Manager.plugin_exists?(directory)
  plugin = Desert::Manager.register_plugin(directory) do
    load_plugin_without_desert(directory)
  end
  # TODO: Can we use Initializer::Configuration#default_load_paths to do this?
  configuration.controller_paths << plugin.controllers_path
end

#require_plugin(plugin_name) ⇒ Object



13
14
15
16
17
18
# File 'lib/desert/rails/1.2.0/initializer.rb', line 13

def require_plugin(plugin_name)
  find_plugins(configuration.plugin_paths).sort.each do |path|
    return load_plugin(path) if File.basename(path) == plugin_name
  end
  raise "Plugin '#{plugin_name}' does not exist"
end