Removing the Engines dependency from Cells

[Update, March 25, 2008: Engines is now optional in the trunk of Cells.]

It seems that the Engines dependency in Cells is unnecessary, so I have documented the steps to remove it. You may want to wait for Nick Sutterer to commit this change to the svn repository, but if you are anxious to do it right away, here is what you need to do.

In vendor/plugins/cells_plugin/lib/action_view_extensions.rb, line 87, remove this block:

# Otherwise, check in the plugins to see if the template can be found there.
# Load this in order so that more recently started plugins will take priority.
Rails.plugins.by_precedence do |plugin|
  plugin_specific_path = File.join(plugin.root, 'app', 'cells',
    template_path.to_s + '.' + extension.to_s)
  return plugin_specific_path if File.exist?(plugin_specific_path)
end

Next, in line 76, replace this:

if Engines.disable_application_view_loading
  path_in_app_directory = nil
else
  path_in_app_directory = File.join(RAILS_ROOT, 'app', 'cells',
    template_path.to_s + '.' + extension.to_s)
end

with this:

path_in_app_directory = File.join(RAILS_ROOT, 'app', 'cells',
  template_path.to_s + '.' + extension.to_s)

Also, remove line 40 of the Cells plugin’s init.rb, which reads:

Engines.mix_code_from :cells

Then, remove line 32 of init_engine.rb:

Engines.current.version = Cells::VERSION

That is it! No more Engines dependency. You can go ahead and delete the Engines plugin folder from your project.

Advertisements

4 thoughts on “Removing the Engines dependency from Cells

  1. @Ted: What a load of nonsense. Simply having Engines in your plugin dir will not break anything since it doesn’t *do* anything unless you explicitly make use of its features.

    @Mike: Thanks for the patch. I’ve applied it, but with a twist – if Engines is available, it is used, if not, it’s not required anymore.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s