Unfortunately, I ran into some problems. Details below... (Included is
a change request to the documentation. If you'd rather I use the
tracker, let me know.)
----------------------------------
First I tried the gem version, because gems seem the most convenient
to me...
I started a brand-new Rails application so that there could be no
other variables.
> ./script/about
About your application's environment
Ruby version 1.8.5 (i386-linux)
RubyGems version 0.9.2
Rails version 1.2.3
Active Record version 1.15.3
Action Pack version 1.13.3
Action Web Service version 1.2.3
Action Mailer version 1.3.3
Active Support version 1.4.2
Application root /home/tyler/code/applications/t
Environment development
Database adapter mysql
> gem list plugins_plus
plugins_plus (0.1.0)
Following the simple instructions at http://svn.pluginaweek.org/trunk/plugins/rails/plugins_plus/README
, I added this near the top of my environment.rb:
require 'plugins_plus'
This is what I got when I did ./script/server:
NameError: undefined method `initialize_schema_information' for module
`ActiveRecord::ConnectionAdapters::SchemaStatements'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
core_ext/module/aliasing.rb:28:in `alias_method'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
core_ext/module/aliasing.rb:28:in `alias_method_chain'
/usr/lib/ruby/gems/1.8/gems/plugin_migrations-0.1.0/lib/
plugin_migrations/extensions/schema_statements.rb:13
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:342:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/plugin_migrations-0.1.0/lib/
plugin_migrations.rb:3
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:342:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/plugins_plus-0.1.0/lib/plugins_plus.rb:2
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:342:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
/home/tyler/code/applications/t/config/environment.rb:13
As you know, initialize_schema_information is defined in:
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
connection_adapters/abstract/schema_statements.rb:235
So it looks like somehow it ended up trying to load the plugin before
active_record/connection_adapters/abstract/schema_statements.rb ever
got called, which is kind of curious...
Sure enough, I threw some debug output in /usr/lib/ruby/gems/1.8/gems/
activerecord-1.15.3/lib/active_record/connection_adapters/abstract/
schema_statements.rb and tried starting the server but DIDN'T SEE the
debug output.
Suspecting that perhaps the reason it wasn't loading active_record/
connection_adapters/abstract/schema_statements.rb was because I didn't
have any models that _used_ AR in my app, I tried to generate a
model... but got a DIFFERENT error:
> ./script/generate model whatever
/usr/lib/ruby/gems/1.8/gems/loaded_plugins-0.1.0/lib/loaded_plugins/
loaded_plugins.rb:4: undefined method `mattr_accessor' for
PluginAWeek::LoadedPlugins:Module (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require'
from /usr/lib/ruby/gems/1.8/gems/loaded_plugins-0.1.0/lib/
loaded_plugins.rb:3
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require'
from /usr/lib/ruby/gems/1.8/gems/plugins_plus-0.1.0/lib/
plugins_plus.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
33:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
33:in `require'
from ./script/../config/../config/environment.rb:13
* Stopped requiring 'plugins_plus'
* ./script/generate model whatever
* rake db:migrate
* * I DID see the output from active_record/connection_adapters/
abstract/schema_statements.rb during the migrate
* ./script/server
* * Did NOT see any output from active_record/connection_adapters/
abstract/schema_statements.rb
* requiring 'plugins_plus' again
* ./script/server
* * Did NOT see any output from active_record/connection_adapters/
abstract/schema_statements.rb
* * Still got same undefined method `initialize_schema_information'
error.
Any suggestions?
----------------------------------
Next I tried installing it as a non-gem plugin:
./script/plugin install http://svn.pluginaweek.org/trunk/plugins/rails/plugins_plus
+ ./plugins_plus/CHANGELOG
+ ./plugins_plus/MIT-LICENSE
+ ./plugins_plus/README
+ ./plugins_plus/Rakefile
+ ./plugins_plus/init.rb
+ ./plugins_plus/lib/plugins_plus.rb
+ ./plugins_plus/tasks/plugins_plus_tasks.rake
Weird! Why aren't there more files in lib??
Looking at http://dev.pluginaweek.org/browser/trunk/plugins/rails/plugins_plus/lib
, I see the reason:
Property svn:externals set to
appable_plugins http://svn.pluginaweek.org/trunk/plugins/rails/appable_plugins
loaded_plugins http://svn.pluginaweek.org/trunk/plugins/rails/loaded_plugins
partial_plugin_list http://svn.pluginaweek.org/trunk/plugins/rails/partial_plugin_list
plugin_assets http://svn.pluginaweek.org/trunk/plugins/action_pack/plugin_assets
plugin_dependencies http://svn.pluginaweek.org/trunk/plugins/rails/plugin_dependencies
plugin_migrations http://svn.pluginaweek.org/trunk/plugins/active_record/migrations/plugin_migrations
plugin_routing http://svn.pluginaweek.org/trunk/plugins/action_pack/plugin_routing
My app isn't _in_ a repository because it's just a throwaway app for
test purposes.
I suggest putting a note in your readme that your application MUST be
in a Subversion repository and you MUST install it using the -x option
if you want the dependee plugins to be installed automatically!
Further evidence that this plugin will only work if those externals
are in place: script/../config/../vendor/plugins/plugins_plus/init.rb:
base_path = File.dirname(__FILE__)
configuration.plugin_paths << "#{base_path}/lib"
load_plugin "#{base_path}/lib/partial_plugin_list"
load_plugin "#{base_path}/lib/loaded_plugins"
load_plugin "#{base_path}/lib/plugin_migrations"
load_plugin "#{base_path}/lib/plugin_assets"
load_plugin "#{base_path}/lib/appable_plugins"
load_plugin "#{base_path}/lib/plugin_routing"
load_plugin "#{base_path}/lib/plugin_dependencies"
By the way, I also noticed that it is depending on the
"partial_plugin_list" plugin but that is not listed as a dependency on
http://wiki.pluginaweek.org/Plugins_plus . In fact, I could find no
hits at all for "partial_plugin_list" on your wiki! And searching
Google for it, the only relevant hit I got was
http://dev.pluginaweek.org/browser/trunk/plugins/rails/partial_plugin_list/lib/partial_plugin_list
.
It appears to be for '*' support for config.plugin. I hope you will
release that plugin independently some day -- I think '*' support is a
great feature to have! :)
----------------------------------
Let's try that again...
~/code/applications/t > svn add ../t
> ./script/plugin remove plugins_plus
> ./script/plugin install -x http://svn.pluginaweek.org/trunk/plugins/rails/plugins_plus
...
Fetching external item into '/home/tyler/code/applications/t/vendor/
plugins/plugins_plus/lib/appable_plugins'
...
> ./script/server
...
Seems to work!
Incidentally, I'm still NOT seeing any output from active_record/
connection_adapters/abstract/schema_statements.rb , but that doesn't
seem to matter. SOMEHOW initialize_schema_information is getting
defined, as this test verifies...
./vendor/plugins/plugins_plus/lib/plugin_migrations/lib/
plugin_migrations/extensions/schema_statements.rb
require 'pp'
pp
ActiveRecord::ConnectionAdapters::SchemaStatements.instance_methods.grep(/
initialize_schema_information/)
alias_method_chain :initialize_schema_information, :plugins
=> ["initialize_schema_information",
"initialize_schema_information_with_plugins"]
The plugin install worked both with this line and without:
config.plugins = [
'plugins_plus',
'*'
]
-------------------------
One final error, which I just noticed...
I'd been using the plugin_dependencies gem before without problems (I
thought), and it seems like I'm still able to start the server when I
have a require 'plugin_dependencies' in environment.rb . HOWEVER, I
get these errors, respectively, when I try to run ./script/about and ./
script/console, and I'm not sure why...
> ./script/about
/usr/lib/ruby/gems/1.8/gems/plugin_dependencies-0.1.0/lib/
plugin_dependencies/plugin_dependencies.rb:3: undefined method
`mattr_accessor' for PluginAWeek::PluginDependencies:Module
(NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require'
from /usr/lib/ruby/gems/1.8/gems/plugin_dependencies-0.1.0/lib/
plugin_dependencies.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
33:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
33:in `require'
from ./script/../config/../config/environment.rb:14
> ./script/console
Loading development environment.
/usr/lib/ruby/gems/1.8/gems/plugin_dependencies-0.1.0/lib/
plugin_dependencies/plugin_dependencies.rb:3:NoMethodError: undefined
method `mattr_accessor' for PluginAWeek::PluginDependencies:Module
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
assertions/selector_assertions.rb:525:NoMethodError: undefined method
`camelize' for "top":String
./script/../config/../config/../app/controllers/application.rb:
4:NameError: uninitialized constant ActionController::Base
Welcome!
irb -> (Ctrl-D)Loaded suite irb
Started
Finished in 0.000663 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
Fortunately, I can just fall back to using the non-gem version with
plugins_plus and everything works fine, but I still thought I'd
mention that problem...
-------------------------
In summary,
* plugins_plus is a great idea (!)
* But I couldn't get it to work when installed as a gem (what am I
doing wrong??)
* I DID get it to work when installed via script/plugin -x
(svn:externals)
Thanks,
Tyler
Wow, thanks for the detailed description! I wish all my bug reports
were like this :)
re: loading via gems before initializing Rails
This is a known problem since the gem must be required AFTER the Rails
libraries have been loaded (which are done during the run of
Rails::Initializer). I've yet to decide whether this is a restriction
or if there is a good workaround. I hesitate at loading the libraries
myself (in the plugins_plus gem) since I haven't given much thought to
any possible consequences it could cause.
re: using svn:externals for plugins_plus
Great idea for noting it in the README. I apologize for not doing so :
( Documentation has unfortunately gotten a little bit out of date and
definitely needs an update.
re: partial_plugin_list
This is a relatively new plugin that isn't quite publicly supported
yet, which is why I haven't listed it as a dependency, although now
that I think about it, I probably should to keep everything consistent
and up-to-date. Again, this is a mistake on my part and is mostly due
to the fact that a lot of the things I've released over the past month
aren't yet publicly supported, so they're "use at your own risk" :)
However, being that plugins_plus IS fully supported, I should have
been more careful there.
I won't have time to make those changes for about a week, but please
feel free to submit patches if you'd like to contribute to the
project. Any and all help is always greatly appreciated :)
Thanks for letting me know about your issues! I hope that some
upcoming changesets will make this process easier on others in the
future.
-Aaron
> Following the simple instructions athttp://svn.pluginaweek.org/trunk/plugins/rails/plugins_plus/README
> ./script/plugin installhttp://svn.pluginaweek.org/trunk/plugins/rails/plugins_plus
> + ./plugins_plus/CHANGELOG
> + ./plugins_plus/MIT-LICENSE
> + ./plugins_plus/README
> + ./plugins_plus/Rakefile
> + ./plugins_plus/init.rb
> + ./plugins_plus/lib/plugins_plus.rb
> + ./plugins_plus/tasks/plugins_plus_tasks.rake
>
> Weird! Why aren't there more files in lib??
>
> Looking athttp://dev.pluginaweek.org/browser/trunk/plugins/rails/plugins_plus/lib
> , I see the reason:
>
> Property svn:externals set to
> appable_pluginshttp://svn.pluginaweek.org/trunk/plugins/rails/appable_plugins
> loaded_pluginshttp://svn.pluginaweek.org/trunk/plugins/rails/loaded_plugins
> partial_plugin_listhttp://svn.pluginaweek.org/trunk/plugins/rails/partial_plugin_list
> plugin_assetshttp://svn.pluginaweek.org/trunk/plugins/action_pack/plugin_assets
> plugin_dependencieshttp://svn.pluginaweek.org/trunk/plugins/rails/plugin_dependencies
> plugin_migrationshttp://svn.pluginaweek.org/trunk/plugins/active_record/migrations/plu...
> plugin_routinghttp://svn.pluginaweek.org/trunk/plugins/action_pack/plugin_routing
>
> My app isn't _in_ a repository because it's just a throwaway app for
> test purposes.
>
> I suggest putting a note in your readme that your application MUST be
> in a Subversion repository and you MUST install it using the -x option
> if you want the dependee plugins to be installed automatically!
>
> Further evidence that this plugin will only work if those externals
> are in place: script/../config/../vendor/plugins/plugins_plus/init.rb:
>
> base_path = File.dirname(__FILE__)
> configuration.plugin_paths << "#{base_path}/lib"
> load_plugin "#{base_path}/lib/partial_plugin_list"
> load_plugin "#{base_path}/lib/loaded_plugins"
> load_plugin "#{base_path}/lib/plugin_migrations"
> load_plugin "#{base_path}/lib/plugin_assets"
> load_plugin "#{base_path}/lib/appable_plugins"
> load_plugin "#{base_path}/lib/plugin_routing"
> load_plugin "#{base_path}/lib/plugin_dependencies"
>
> By the way, I also noticed that it is depending on the
> "partial_plugin_list" plugin but that is not listed as a dependency onhttp://wiki.pluginaweek.org/Plugins_plus. In fact, I could find no
> hits at all for "partial_plugin_list" on your wiki! And searching
> Google for it, the only relevant hit I got washttp://dev.pluginaweek.org/browser/trunk/plugins/rails/partial_plugin...
> .
>
> It appears to be for '*' support for config.plugin. I hope you will
> release that plugin independently some day -- I think '*' support is a
> great feature to have! :)
>
> ----------------------------------
> Let's try that again...
>
> ~/code/applications/t > svn add ../t> ./script/plugin remove plugins_plus
> > ./script/plugin install -xhttp://svn.pluginaweek.org/trunk/plugins/rails/plugins_plus