Commit Graph

130 Commits

Author SHA1 Message Date
Andrew White
c9c5788a52 Add compatibility for Ruby 2.4 to_time changes
In Ruby 2.4 the `to_time` method for both `DateTime` and `Time` will
preserve the timezone of the receiver when converting to an instance
of `Time`. Since Rails 5.0 will support Ruby 2.2, 2.3 and later we
need to introduce a compatibility layer so that apps that upgrade do
not break. New apps will have a config initializer file that defaults
to match the new Ruby 2.4 behavior going forward.

For information about the changes to Ruby see:
https://bugs.ruby-lang.org/issues/12189
https://bugs.ruby-lang.org/issues/12271

Fixes #24617.
2016-04-23 15:03:50 +01:00
Matthew Draper
d3c9d808e3 Publish AS::Executor and AS::Reloader APIs
These should allow external code to run blocks of user code to do
"work", at a similar unit size to a web request, without needing to get
intimate with ActionDipatch.
2016-03-02 02:14:20 +10:30
Rashmi Yadav
1b608a695c Update copyright notices to 2016 [ci skip] 2015-12-31 18:27:19 +02:00
Xavier Noria
92a9744f81 renames AS::FileEventedUpdateChecker to AS::EventedFileUpdateChecker
Better English.
2015-12-09 03:07:49 +01:00
Xavier Noria
785adabc4b implements an evented file update checker [Puneet Agarwal]
This is the implementation of the file update checker written
by Puneet Agarwal for GSoC 2015 (except for the tiny version
of the listen gem, which was 3.0.2 in the original patch).

Puneet's branch became too out of sync with upstream. This is
the final work in one single clean commit.

Credit goes in the first line using a convention understood
by the contrib app.
2015-11-08 22:49:49 -08:00
Roque Pinel
e2b3ccd1aa Refactor AS::Callbacks halt config and fix the documentation
Move from `AS::Callbacks::CallbackChain.halt_and_display_warning_on_return_false`
to `AS::Callbacks.halt_and_display_warning_on_return_false` base on
[this
discussion](https://github.com/rails/rails/pull/21218#discussion_r39354580)

Fix the documentation broken by 0a120a818d413c64ff9867125f0b03788fc306f8
2015-10-01 13:04:20 -04:00
Rafael Mendonça França
0a120a818d Avoid to define an initializer after the load_config_initializers
This make the config/initializers run before the railties are loaded
what can break some configurations.
2015-04-07 17:20:57 -03:00
George Claghorn
c64b99ecc9 Add ActiveSupport::ArrayInquirer and Array#inquiry
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
string-like contents. For example, `request.variant` returns an `ArrayInquirer`
object. To check a request's variants, you can call:

    request.variant.phone?
    request.variant.any?(:phone, :tablet)

...instead of:

    request.variant.include?(:phone)
    request.variant.any? { |v| v.in?([:phone, :tablet]) }

`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`:

    pets = [:cat, :dog]
    pets.cat?    # => true
    pets.ferret? # => false
    pets.any?(:cat, :ferret} # => true
2015-03-24 13:33:01 -05:00
Rafael Mendonça França
5868307b74 Merge pull request #18090 from egilburg/patch-3
simplify ActiveSupport.test_order definition
2015-01-04 19:00:01 -03:00
Arun Agrawal
4de18d0ead Update copyright notices to 2015 [ci skip] 2014-12-31 08:34:14 +01:00
Eugene Gilburg
9f7ab82ad2 simplify ActiveSupport.test_order definition 2014-12-18 12:41:02 -08:00
claudiob
1d19a3a42a Add docs for AS::TestCase::test_order
Document `test_order` and `test_order=` from `ActiveSupport::TestCase`.

[ci skip]
2014-12-18 11:20:32 -08:00
Rafael Mendonça França
53e877f7d9 Define the configuration at Active Support 2014-09-11 00:54:43 -03:00
Vipul A M
98cb3e69af update copyright notices to 2014. [ci skip] 2014-01-01 23:59:49 +05:30
Rafael Mendonça França
d3b93e403b Make load of NumberHelper thread safe 2013-12-02 22:12:36 -02:00
Carlos Antonio da Silva
cad3a13086 Remove deprecated AS::BasicObject, use AS::ProxyObject instead 2013-07-01 22:26:54 -03:00
Andrew Nesbitt
d814284506 Updated copyright notices for 2013 2012-12-31 20:35:29 +00:00
Francesco Rodriguez
6ee03a40bb Rename ActiveSupport::BasicObject to ActiveSupport::ProxyObject
AS::BasicObject is used for proxy classes. Let's give it a less concerning
name. Also, it avoids the confusion with Ruby's Basic Object.
2012-12-07 14:13:56 -05:00
Michael Koziarski
def2ccb8e3 Add ActiveSupport::KeyGenerator as a simple wrapper around PBKDF2
This will be used to derive keys from the secret and a salt, in order to allow us to
do things like encrypted cookie stores without using the secret for multiple
purposes directly.
2012-10-01 14:22:19 +13:00
José Valim
a1687e48cb Make ActiveSupport::Autoload local
Previously, ActiveSupport::Autoload was global and reserved
for usage inside Rails. This pull request makes it local,
fixes its test (they were not being run because its file
was named wrongly) and make it part of Rails public API.
2012-08-21 14:46:12 -03:00
Santiago Pastorino
344ea04865 Fix the build 2012-05-22 12:10:35 -03:00
Santiago Pastorino
38293ea828 require active_support/lazy_load_hooks where is needed 2012-05-22 11:33:03 -03:00
Jan Xie
a807db9d19 refactor lazy_load_hooks load position 2012-05-22 21:50:16 +08:00
Pan Thomakos
0f8f99b989 Removed ActiveSupport#load_all!
This is no longer used and actually raises an error when trying to load
`ActiveSupport::Dependencies`. I removed the related code and added the
`Dependencies` module to the autoload list.
2012-03-18 11:24:04 -07:00
Sergey Nartimov
0f2f8003d2 remove ActiveSupport::Base64 in favor of ::Base64 2012-01-02 22:48:15 +03:00
Vijay Dev
f3e079e8b5 Merge pull request #4248 from andrew/2012
Updated copyright notices for 2012
2011-12-31 12:48:19 -08:00
Andrew Nesbitt
1b413510fe Updated copyright notices for 2012 2011-12-31 20:30:08 +00:00
José Valim
fa5adfb1e8 Update activesupport/lib/active_support.rb 2011-12-22 09:35:22 +01:00
José Valim
6a6fc4e1db Remove deprecations from Active Support. 2011-12-20 15:18:42 +01:00
Aaron Patterson
572c3d5178 * BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger
from Ruby stdlib.
2011-12-19 18:41:37 -08:00
David Heinemeier Hansson
afde6fdd5e Added X-Request-Id tracking and TaggedLogging to easily log that and other production concerns 2011-10-19 12:59:33 -05:00
Jon Leighton
1170cceaae Removed ActiveSupport::SecureRandom in favour of SecureRandom from the standard library. (It has been deprecated in the 3-1-stable branch.) 2011-05-23 20:25:44 +01:00
Jon Leighton
d411c85a65 Replace references to ActiveSupport::SecureRandom with just SecureRandom, and require 'securerandom' from the stdlib when active support is required. 2011-05-23 20:25:44 +01:00
Vijay Dev
3f36441e90 Update copyright year in Active Resource and Active Support
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-05-09 20:17:23 -03:00
José Valim
f7538808d4 File watcher won't make the cut for 3.1. Maybe on 3.2. 2011-04-23 00:00:30 +02:00
wycats
1fd9d978a7 Add initial FileWatcher implementation. The Backend is just an abstract implementation, which will be inherited by backends that do the heavy lifting. 2011-02-06 13:42:22 -08:00
wycats
cc8e386d08 Always pull in version for frameworks (standardize autoload / require / none) 2010-10-10 16:12:04 -07:00
Barry Sears
de05e1c33c Make ActiveSupport load own version.
[#5739 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-10 19:46:49 -02:00
José Valim
6788db824a Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing frameworks like ActiveRecord and ActiveResource to log outsude Rails::Application [#4816 state:resolved] 2010-06-24 13:23:43 +02:00
José Valim
71703c98ba Add ActiveSupport::FileUpdateChecker. 2010-06-20 13:26:42 +02:00
José Valim
8db8c6f4ce Add ActiveSupport::DescendantsTracker. 2010-06-19 16:44:35 +02:00
wycats
39d6f9e112 Make many parts of Rails lazy. In order to facilitate this,
add lazy_load_hooks.rb, which allows us to declare code that
should be run at some later time. For instance, this allows
us to defer requiring ActiveRecord::Base at boot time purely
to apply configuration. Instead, we register a hook that should
apply configuration once ActiveRecord::Base is loaded.

With these changes, brings down total boot time of a
new app to 300ms in production and 400ms in dev.

TODO: rename base_hook
2010-03-07 06:24:30 -08:00
Yehuda Katz
4cbb9db0a5 For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do
    safe_concat("</form>"), which will skip both the flag set, and the flag
    check.
  * For the first pass, I converted virtually all #html_safe!s to #html_safe,
    and the tests pass. A further optimization would be to try to use
    #safe_concat as much as possible, reducing the performance impact if
    we know up front that a String is safe.
2010-01-31 19:39:13 -08:00
Mikel Lindsaar
c1f308f8c6 Unvendor'd MemCache-Client. Now requires the MemCache Client gem as a dependency - Don't forget to gem bundle buys and girls 2010-01-28 11:56:47 +11:00
Joshua Peek
2601a16ede Autoload AS test case 2010-01-04 16:22:46 -06:00
José Valim
97a64b6b22 Get rid of DeprecatedCallbacks in ActiveRecord::Associations and finally remove it. 2009-12-30 11:43:34 +01:00
David Heinemeier Hansson
1cd949006a Fix the i18n dependency problem 2009-12-27 14:43:06 -08:00
Joshua Peek
ace20bd25e Flip deferrable autoload convention 2009-12-22 17:27:37 -06:00
Yehuda Katz
96e0638ce2 Should fix a few Sam Ruby fails. 2009-12-03 09:06:01 -08:00
Jeremy Kemper
0bd6e933c0 Restore split between require-time and runtime load path mungery. Simplifies vendor requires. 2009-09-24 18:38:18 -07:00