diff options
author | Matthew Rudy Jacobs <matthewrudyjacobs@gmail.com> | 2009-02-22 19:23:04 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2009-02-27 14:37:11 +0100 |
commit | 319106d09c0ec2daf8b5345f525f1c97b6368ce2 (patch) | |
tree | 55bbda458e3428bffcad2fa591f02c2ba961fbff /railties/lib/rails/rack | |
parent | 6de83562f91028629bd24447aa521bc72ef8277a (diff) | |
download | rails-319106d09c0ec2daf8b5345f525f1c97b6368ce2.tar.gz rails-319106d09c0ec2daf8b5345f525f1c97b6368ce2.tar.bz2 rails-319106d09c0ec2daf8b5345f525f1c97b6368ce2.zip |
Metal can now line in plugins under app/metal [#2045 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'railties/lib/rails/rack')
-rw-r--r-- | railties/lib/rails/rack/metal.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index b185227234..8dac992ef2 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -6,14 +6,17 @@ module Rails NotFoundResponse = [404, {}, []].freeze NotFound = lambda { NotFoundResponse } + cattr_accessor :metal_paths + self.metal_paths = ["#{Rails.root}/app/metal"] + def self.metals - base = "#{Rails.root}/app/metal" - matcher = /\A#{Regexp.escape(base)}\/(.*)\.rb\Z/ + matcher = /#{Regexp.escape('/app/metal/')}(.*)\.rb\Z/ + metal_glob = metal_paths.map{ |base| "#{base}/**/*.rb" } - Dir["#{base}/**/*.rb"].sort.map do |file| - file.sub!(matcher, '\1') - require file - file.classify.constantize + Dir[*metal_glob].sort.map do |file| + path = file.match(matcher)[1] + require path + path.classify.constantize end end |