Commit Graph

20 Commits

Author SHA1 Message Date
Xavier Noria
ae07806858 fixes circularity check in dependencies
The check for circular loading should depend on a stack of files being
loaded at the moment, rather than the collection of loaded files.

This showed up indirectly in #16468, where a misspelled helper would
incorrectly result in a circularity error message.

References #16468
2014-10-25 14:06:33 +02:00
Simon Coffey
b4a9668626 Ensure all-caps nested consts marked as autoloaded
Previously, an autoloaded constant `HTML::SomeClass` would not be marked
as autoloaded by AS::Dependencies. This is because the
`#loadable_constants_for_path` method uses `String#camelize` on the
inferred file path, which in turn means that, unless otherwise directed,
AS::Dependencies watches for loaded constants in the `Html` namespace.

By passing the original qualified constant name to `#load_or_require`,
this inference step is avoided, and the new constant is picked up in the
correct namespace.
2013-08-27 08:20:33 +01:00
Xavier Noria
bff4d8d165 dependencies no longer trigger Kernel#autoload in remove_const [fixes #8213] 2012-11-15 04:36:36 +01:00
Xavier Noria
b33700f558 detect circular constant autoloading
Nowadays circular autoloads do not work, but the user gets a NameError
that says some constant is undefined. That's puzzling, because he is
normally trying to autoload a constant he knows can be autoloaded.
With this check we can give a better error message.
2012-08-28 20:34:39 +02:00
Francesco Rodriguez
cc14a3b2c1 Fix ActiveSupport tests that depend on run order 2012-08-23 16:00:58 -05:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Santiago Pastorino
4ea1753fc2 This is for making sure const_missing is triggered without warnings 2010-07-26 12:51:52 -03:00
wycats
1b97701e51 Fix a bug where requires inside of autoloads were being added to the autoloaded_constants list, causing mayhem. [#5165 state:resolved] 2010-07-26 00:59:54 -07:00
Nicholas Seckar
1e170da30d Checkin failing test case related to load once paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-24 14:41:29 +00:00
Jeremy Kemper
615d05f5de Test autoloading nested subclass of parent.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5541 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-16 22:50:46 +00:00
Nicholas Seckar
a7d0e0e011 Fix warning and incorrect test trigger
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5444 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-06 23:45:39 +00:00
Jeremy Kemper
07c51829ab Failing test for autoloading shadowed exceptions.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5440 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-06 19:23:30 +00:00
Nicholas Seckar
5cc682da07 Update dependencies to allow constants to be defined alongside their siblings.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5386 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-01 23:21:13 +00:00
Nicholas Seckar
6fcc81b7f9 Add forgotten file
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4928 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-03 19:39:08 +00:00
Jeremy Kemper
80f1597942 Dependencies can autoload directories of nested classes.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4769 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-16 09:18:17 +00:00
Nicholas Seckar
9bd007c7c7 Add forgotten files; Fix double loading errors.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4730 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-08 22:08:09 +00:00
Nicholas Seckar
74165eb6ac New dependencies implementation
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4728 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-08 21:21:04 +00:00
Nicholas Seckar
9efca53908 Dependencies cleanup. Fixes #4221.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4060 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-27 05:13:46 +00:00
Tobias Lütke
6fa5b7b304 added some (pointless) test cases to dependency loading, the more the merrier
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3537 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-02-04 21:24:40 +00:00
David Heinemeier Hansson
01b1a87729 Added reusable reloading support through the inclusion of the Relodable module that all subclasses of ActiveRecord::Base, ActiveRecord::Observer, ActiveController::Base, and ActionMailer::Base automatically gets [DHH]. Added auto-loading support for classes in modules, so Conductor::Migration will look for conductor/migration.rb and Conductor::Database::Settings will look for conductor/database/settings.rb [Nicholas Seckar]. Refactored extensions to module, class, and object in active support [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3493 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-01-29 00:37:39 +00:00