0
@@ -48,16 +48,16 @@ uses_mocha "Plugin Loader Tests" do
0
def test_should_find_all_availble_plugins_and_return_as_all_plugins
0
- assert_plugins [
:stubby, :plugin_with_no_lib_dir, :gemlike, :acts_as_chunky_bacon, :a], @loader.all_plugins.reverse, @failure_tip
0
+ assert_plugins [
:engine, :stubby, :plugin_with_no_lib_dir, :gemlike, :acts_as_chunky_bacon, :a], @loader.all_plugins.reverse, @failure_tip
0
def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_untouched
0
- assert_plugins [:a, :acts_as_chunky_bacon, :
gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
+ assert_plugins [:a, :acts_as_chunky_bacon, :
engine, :gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_nil
0
@configuration.plugins = nil
0
- assert_plugins [:a, :acts_as_chunky_bacon, :
gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
+ assert_plugins [:a, :acts_as_chunky_bacon, :
engine, :gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
def test_should_return_specific_plugins_named_in_config_plugins_array_if_set
0
@@ -74,17 +74,17 @@ uses_mocha "Plugin Loader Tests" do
0
def test_should_load_all_plugins_in_natural_order_when_all_is_used
0
only_load_the_following_plugins! [:all]
0
- assert_plugins [:a, :acts_as_chunky_bacon, :
gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
+ assert_plugins [:a, :acts_as_chunky_bacon, :
engine, :gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
def test_should_load_specified_plugins_in_order_and_then_all_remaining_plugins_when_all_is_used
0
only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon, :all]
0
- assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :
gemlike, :plugin_with_no_lib_dir], @loader.plugins, @failure_tip
0
+ assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :
engine, :gemlike, :plugin_with_no_lib_dir], @loader.plugins, @failure_tip
0
def test_should_be_able_to_specify_loading_of_plugins_loaded_after_all
0
only_load_the_following_plugins! [:stubby, :all, :acts_as_chunky_bacon]
0
- assert_plugins [:stubby, :a, :
gemlike, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], @loader.plugins, @failure_tip
0
+ assert_plugins [:stubby, :a, :
engine, :gemlike, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], @loader.plugins, @failure_tip
0
def test_should_accept_plugin_names_given_as_strings
0
@@ -112,6 +112,19 @@ uses_mocha "Plugin Loader Tests" do
0
assert ActiveSupport::Dependencies.load_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib'))
0
+ def test_should_add_engine_load_paths_to_Dependencies_load_paths
0
+ only_load_the_following_plugins! [:engine]
0
+ @loader.add_plugin_load_paths
0
+ %w( models controllers helpers ).each do |app_part|
0
+ assert ActiveSupport::Dependencies.load_paths.include?(
0
+ File.join(plugin_fixture_path('engines/engine'), 'app', app_part)
0
+ ), "Couldn't find #{app_part} in load path"
0
def test_should_add_plugin_load_paths_to_Dependencies_load_once_paths
0
only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon]
wohoooooo :)
Nice ;)
Great. I wonder if/how an engine plugin can add routes.
Good to see this making it into core, nice stuff!
hallelujah!
@zargony 16:28 :: DHH:: It gets better shortly ;) 16:28 :: DHH:: almost have config/routes.rb working for plugins too
yay!
Cool!!! Waiting for Django-like apps!
I’m happy to see this change, but I am curious—what made you change your mind?
need to find a good way to extend routing from a plugin.
@matthewrudy: it’s being taken care of.
how would migrations work for models like this? they’d probably still have to be written through a generator, right?
If I knew exactly what this did, I’d be excited.
DHH: How does this integrate into GEM plugins? GEMs have a directory called “rails” so shouldn’t “app” and so on be in that directory to keep things in the correct namespace? How about rake tasks? You might want to check out my fork of engines which solves these problems and others: http://github.com/ioquatix/engines/tree/master
How about views in a plugin?
+1 for
<plugin-root>/rails/appinstead of<plugin-root>/app(following ioquatix’s comment above).you’re on top of everything @lazyatom.
I thought rails was starting to move away from plugins and more towards gems. That seems to make the most sense, since gems have a versioning / update system, can require dependencies, etc. Plugins seem somewhat redundant to the gems system. That being said, it would be nice to do something like this for gems and encourage people to write gems instead of plugins. Now that github makes creating a gem so easy, it seems like it would actually be easier to do it this way.
+1 on engines-like gems support, still supporting rails plugins, but discouraging them.
-1 for
/rails/appinstead of/app+1 for bringing engines backI love having all of the above and the gem dependency options open. I love where rails is headed. Keep it up core.
m3talsmith: can you clarify your -1 comment? Since everything else for rails is in a subdirectory, why not put app there as well. Its much cleaner overall.
@ioquatix:
I’m more concerned about keeping a pure directory structure in the vendor/plugins/your_plugin_or_engine_name area. When I made the minus comment I hadn’t was in a rush on my way out the door. I overlooked the GEM’s part of the comment. Given that I take my -1 back because it does make sense to keep it in the same namespace. So ….
+1for/rails/appfor the GEMS directory-2for m3talsmith firing off a comment on the run.Will this be like extensions in Radiant or Spree? Both of these projects already support views, controllers, routes, migrations, etc. in your extensions.
Is there an easy way to run migrations from plugins? Maybe being able to set the schema migrations table name from within the migrations would be enough. I’ve been doing it with monkeypatching and a custom rake task so far.
xtoddx, we’re working on getting a good story for both migrations and files in public in before this is released.