Changeset 9140
- Timestamp:
- 03/30/08 02:17:28 (2 months ago)
- Files:
-
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/initializer.rb (modified) (8 diffs)
- trunk/railties/lib/rails/gem_dependency.rb (added)
- trunk/railties/lib/tasks/gems.rake (added)
- trunk/railties/test/gem_dependency_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/railties/CHANGELOG
r9134 r9140 1 1 *SVN* 2 3 * Added config.gem for specifying which gems are required by the application, as well as rake tasks for installing and freezing gems. [rick] 4 5 Rails::Initializer.run do |config| 6 config.gems "bj" 7 config.gems "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" 8 config.gems "aws-s3", :lib => "aws/s3" 9 end 10 11 # List required gems. 12 rake gems 13 14 # Install all required gems: 15 rake gems:install 16 17 # Unpack specified gem to vendor/gems/gem_name-x.x.x 18 rake gems:unpack GEM=bj 2 19 3 20 * Removed the default .htaccess configuration as there are so many good deployment options now (kept it as an example in README) [DHH] trunk/railties/lib/initializer.rb
r9108 r9140 8 8 require 'rails/plugin/locator' 9 9 require 'rails/plugin/loader' 10 require 'rails/gem_dependency' 10 11 11 12 … … 78 79 require_frameworks 79 80 set_autoload_paths 81 add_gem_load_paths 80 82 add_plugin_load_paths 81 83 load_environment … … 99 101 add_support_load_paths 100 102 103 load_gems 101 104 load_plugins 102 103 105 load_application_initializers 104 106 … … 184 186 def add_plugin_load_paths 185 187 plugin_loader.add_plugin_load_paths 188 end 189 190 def add_gem_load_paths 191 unless @configuration.gems.empty? 192 require "rubygems" 193 @configuration.gems.each &:add_load_paths 194 end 195 end 196 197 def load_gems 198 @configuration.gems.each &:load 186 199 end 187 200 … … 230 243 def load_observers 231 244 if configuration.frameworks.include?(:active_record) 232 ActiveRecord::Base.instantiate_observers 245 if @configuration.gems.any? { |g| !g.loaded? } 246 puts "Unable to instantiate observers, some gems that this application depends on are missing. Run 'rake gems:install'" 247 else 248 ActiveRecord::Base.instantiate_observers 249 end 233 250 end 234 251 end … … 495 512 # the implementation of Rails::Plugin::Loader for more details. 496 513 attr_accessor :plugin_loader 514 515 # An array of gems that this rails application depends on. Rails will automatically load 516 # these gems during installation, and allow you to install any missing gems with: 517 # 518 # rake gems:install 519 # 520 # You can add with the #gem method. 521 attr_accessor :gems 522 523 # Adds a single Gem dependency to the rails application. 524 # 525 # # gem 'aws-s3', '>= 0.4.0' 526 # # require 'aws/s3' 527 # config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0', \ 528 # :source => "http://code.whytheluckystiff.net" 529 # 530 def gem(name, options = {}) 531 @gems << Rails::GemDependency.new(name, options) 532 end 497 533 498 534 # Deprecated options: … … 530 566 self.plugin_loader = default_plugin_loader 531 567 self.database_configuration_file = default_database_configuration_file 568 self.gems = default_gems 532 569 533 570 for framework in default_frameworks … … 713 750 end 714 751 end 752 753 def default_gems 754 [] 755 end 715 756 end 716 757 end