Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4778

Show
Ignore:
Timestamp:
08/16/06 20:33:31 (2 years ago)
Author:
ulysses
Message:

Update require_dependency to return true or false as require does.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/dependencies.rb

    r4774 r4778  
    7676         
    7777        if !warnings_on_first_load or history.include?(expanded) 
    78           load_file(*load_args) 
     78          result = load_file(*load_args) 
    7979        else 
    80           enable_warnings { load_file(*load_args) } 
     80          enable_warnings { result = load_file(*load_args) } 
    8181        end 
    8282      rescue 
     
    8686    else 
    8787      log "requiring #{file_name}" 
    88       require file_name 
     88      result = require file_name 
    8989    end 
    9090 
    9191    # Record history *after* loading so first load gets warnings. 
    9292    history << expanded 
     93    return result 
    9394  end 
    9495   
     
    158159    undefined_before = const_paths.reject(&method(:qualified_const_defined?)) 
    159160     
    160     load path 
     161    result = load path 
    161162     
    162163    newly_defined_paths = const_paths.select(&method(:qualified_const_defined?)) 
     
    164165    autoloaded_constants.uniq! 
    165166    log "loading #{path} defined #{newly_defined_paths * ', '}" unless newly_defined_paths.empty? 
     167    return result 
    166168  end 
    167169   
  • trunk/activesupport/test/dependencies_test.rb

    r4774 r4778  
    6262 
    6363  def test_warnings_should_be_enabled_on_first_load 
    64     with_loading do 
     64    with_loading 'dependencies' do 
    6565      old_warnings, Dependencies.warnings_on_first_load = Dependencies.warnings_on_first_load, true 
    6666 
    67       filename = "#{File.dirname(__FILE__)}/dependencies/check_warnings" 
    68       expanded = File.expand_path(filename
     67      filename = "check_warnings" 
     68      expanded = File.expand_path("test/dependencies/#{filename}"
    6969      $check_warnings_load_count = 0 
    7070