0
@@ -7,6 +7,7 @@ require 'railties_path'
0
require 'rails/version'
0
require 'rails/plugin/locator'
0
require 'rails/plugin/loader'
0
+require 'rails/gem_dependency'
0
RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
0
@@ -77,6 +78,7 @@ module Rails
0
@@ -98,8 +100,8 @@ module Rails
0
load_application_initializers
0
# the framework is now fully initialized
0
@@ -185,6 +187,17 @@ module Rails
0
plugin_loader.add_plugin_load_paths
0
+ def add_gem_load_paths
0
+ unless @configuration.gems.empty?
0
+ @configuration.gems.each &:add_load_paths
0
+ @configuration.gems.each &:load
0
# Loads all plugins in <tt>config.plugin_paths</tt>. <tt>plugin_paths</tt>
0
# defaults to <tt>vendor/plugins</tt> but may also be set to a list of
0
@@ -229,7 +242,11 @@ module Rails
0
if configuration.frameworks.include?(:active_record)
0
- ActiveRecord::Base.instantiate_observers
0
+ if @configuration.gems.any? { |g| !g.loaded? }
0
+ puts "Unable to instantiate observers, some gems that this application depends on are missing. Run 'rake gems:install'"
0
+ ActiveRecord::Base.instantiate_observers
0
@@ -494,6 +511,25 @@ module Rails
0
# a sub class would have access to fine grained modification of the loading behavior. See
0
# the implementation of Rails::Plugin::Loader for more details.
0
attr_accessor :plugin_loader
0
+ # An array of gems that this rails application depends on. Rails will automatically load
0
+ # these gems during installation, and allow you to install any missing gems with:
0
+ # You can add with the #gem method.
0
+ # Adds a single Gem dependency to the rails application.
0
+ # # gem 'aws-s3', '>= 0.4.0'
0
+ # config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0', \
0
+ # :source => "http://code.whytheluckystiff.net"
0
+ def gem(name, options = {})
0
+ @gems << Rails::GemDependency.new(name, options)
0
def breakpoint_server(_ = nil)
0
@@ -529,6 +565,7 @@ module Rails
0
self.plugin_locators = default_plugin_locators
0
self.plugin_loader = default_plugin_loader
0
self.database_configuration_file = default_database_configuration_file
0
+ self.gems = default_gems
0
for framework in default_frameworks
0
self.send("#{framework}=", Rails::OrderedOptions.new)
0
@@ -712,6 +749,10 @@ module Rails