diff options
author | Jamis Buck <jamis@37signals.com> | 2005-10-05 18:25:15 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-10-05 18:25:15 +0000 |
commit | 7a854b53792ae7eecae20078545ea1d06ed34552 (patch) | |
tree | 53f4a868936143266ce4128ad682117a7ecbeda9 | |
parent | d364164763cd4e8868e47f4093ec8e329a33dbc4 (diff) | |
download | rails-7a854b53792ae7eecae20078545ea1d06ed34552.tar.gz rails-7a854b53792ae7eecae20078545ea1d06ed34552.tar.bz2 rails-7a854b53792ae7eecae20078545ea1d06ed34552.zip |
Add experimental plugin support #2335
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2465 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index c0d0ce5ef9..39fb889f52 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add experimental plugin support #2335 + * Removed all the scripts in script/* and replaced it with one generic portal: script/run * Made Rakefile aware of new .js files in script.aculo.us [Thomas Fuchs] diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 5e1e38e33d..fedce9c5a7 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -33,6 +33,7 @@ module Rails set_connection_adapters require_frameworks + load_plugins load_environment initialize_database @@ -65,6 +66,26 @@ module Rails configuration.frameworks.each { |framework| require(framework.to_s) } end + def load_plugins + config = configuration + + Dir.glob("#{configuration.plugins_path}/*") do |directory| + next if File.basename(directory)[0] == ?. || !File.directory?(directory) + + if File.exist?("#{directory}/init.rb") + silence_warnings do + eval(IO.read("#{directory}/init.rb"), binding) + end + end + + if File.directory?("#{directory}/lib") + $LOAD_PATH.unshift "#{directory}/lib" + end + end + + $LOAD_PATH.uniq! + end + def load_environment silence_warnings do config = configuration @@ -177,6 +198,10 @@ module Rails def environment_path "#{RAILS_ROOT}/config/environments/#{environment}.rb" end + + def plugins_path + "#{RAILS_ROOT}/vendor/plugins" + end def environment ::RAILS_ENV @@ -286,4 +311,4 @@ class OrderedOptions < Array # :nodoc: self.each { |i| return i if i.first == key } return false end -end
\ No newline at end of file +end |