提交 7a854b53 编写于 作者: J Jamis Buck

Add experimental plugin support #2335


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2465 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 d3641647
*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 @@ def process
set_connection_adapters
require_frameworks
load_plugins
load_environment
initialize_database
......@@ -65,6 +66,26 @@ def require_frameworks
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 @@ def database_configuration
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 @@ def find_pair(key)
self.each { |i| return i if i.first == key }
return false
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册