mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add experimental plugin support #2335
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2465 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
d364164763
commit
7a854b5379
2 changed files with 28 additions and 1 deletions
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
@ -178,6 +199,10 @@ module Rails
|
|||
"#{RAILS_ROOT}/config/environments/#{environment}.rb"
|
||||
end
|
||||
|
||||
def plugins_path
|
||||
"#{RAILS_ROOT}/vendor/plugins"
|
||||
end
|
||||
|
||||
def environment
|
||||
::RAILS_ENV
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue