ticket #4245 - Fix rake/generators for symlinked plugins

Ticket #4245 has a small patch [1] fixes custom rake tasks and generators for plugins that are symlinked. It changes Dir.glob from using /**/ (which doesn't follow symlinks) to use /*/**/, which will follow one symlink without any adverse effects.

I would appreciate it if someone would apply this patch since Rails partially works with symlinked plugins (it loads them), but the plugins generators and rake tasks won't work.

Thanks,
Brandon

[1] http://dev.rubyonrails.org/attachment/ticket/4245/symlinked_plugins.patch

Brandon,

I am a Rails user in practice and do not presume to know enough to
touch the internal code, but I am concerned by your patch to allow for
symlinked plugins.

You are suggesting to change lines like this:
sources << PathSource.new(:plugins,
"#{::RAILS_ROOT}/vendor/plugins/**/generators")
To this:
sources << PathSource.new(:plugins,
"#{::RAILS_ROOT}/vendor/plugins/*/**/generators")

I could be wrong, but wouldn't allowing for symlinks to plugins keep
Windows users from accessing them? I have only seen symlinks used on
deployed servers (i.e. Capistrano), but what you are suggesting would
affect the windows developer environment directly.

Can someone please chime in and confirm or debunk my concerns.

Thank you,
Eric M.

Brandon Keepers wrote:

Nope, it shouldn't (could someone with windows test this). /*/**/ really has nothing to do with symlinks. The pattern /**/ for Dir.glob gets a recursive directory listing, but it doesn't follow symlinks (since doing so could send Ruby into a recursive spiral). However, the pattern /*/ will give you a (non-recursive) list of all the directories, including symlinks. So by combining them (/*/**/), it will follow one level of symlinks, and still look in all the directories recursively.

Hope that helps.

Brandon