Permalink
Browse files

Prevent gem extensions from attempting to load more than once. Also, …

…depending on load order, Array#tap may not be defined yet. (closes gh-109)
  • Loading branch information...
1 parent 300c553 commit d4b48bf0ac8e6bb2fbe0a06e468df1572542883c @joshfrench joshfrench committed Jun 14, 2010
Showing with 4 additions and 3 deletions.
  1. +1 −1 lib/radiant/extension_loader.rb
  2. +3 −2 lib/radiant/initializer.rb
@@ -132,7 +132,7 @@ def load_extension_roots
def select_extension_roots
all_roots = all_extension_roots.dup
- roots = configuration.extensions.map do |ext_name|
+ roots = configuration.extensions.uniq.map do |ext_name|
if :all === ext_name
:all
else
@@ -41,8 +41,9 @@ def all_available_extensions
end
# load any gem that follows extension rules
gems.inject(all) do |available,gem|
- available.tap { |a| a << gem.specification.full_gem_path if gem.specification and
- gem.specification.full_gem_path[/radiant-.*-extension-[\d\.]+$/] }
+ available << gem.specification.full_gem_path if gem.specification and
+ gem.specification.full_gem_path[/radiant-.*-extension-[\d\.]+$/]
+ available
end
# strip version info to glean proper extension names
all.flatten.map {|f| File.basename(f).gsub(/^radiant-|-extension-[\d\.]+$/, '') }.sort.map {|e| e.to_sym }

0 comments on commit d4b48bf

Please sign in to comment.