Skip to content

Commit 0bed93b

Browse files
spastorinojosevalim
authored andcommitted
Unforce tzinfo from AS
Signed-off-by: José Valim <[email protected]>
1 parent ea037ff commit 0bed93b

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

actionpack/actionpack.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ Gem::Specification.new do |s|
2525
s.add_dependency('rack', '~> 1.1.0')
2626
s.add_dependency('rack-test', '~> 0.5.4')
2727
s.add_dependency('rack-mount', '~> 0.6.3')
28+
s.add_dependency('tzinfo', '~> 0.3.16')
2829
s.add_dependency('erubis', '~> 2.6.5')
2930
end

activerecord/activerecord.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
2424
s.add_dependency('activesupport', version)
2525
s.add_dependency('activemodel', version)
2626
s.add_dependency('arel', '~> 0.3.3')
27+
s.add_dependency('tzinfo', '~> 0.3.16')
2728
end

activesupport/activesupport.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
1919

2020
s.has_rdoc = true
2121

22-
s.add_dependency('tzinfo', '~> 0.3.16')
2322
s.add_dependency('builder', '~> 2.1.2')
2423
s.add_dependency('memcache-client', '>= 1.7.5')
2524
end

activesupport/lib/active_support/values/time_zone.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
require 'active_support/core_ext/object/blank'
22
require 'active_support/core_ext/object/try'
3+
begin
4+
require 'tzinfo'
5+
rescue LoadError => e
6+
$stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install"
7+
raise e
8+
end
39

410
# The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following:
511
#
@@ -313,7 +319,7 @@ def period_for_local(time, dst=true)
313319

314320
# TODO: Preload instead of lazy load for thread safety
315321
def self.find_tzinfo(name)
316-
require 'tzinfo' unless defined?(::TZInfo)
322+
require 'active_support/tzinfo' unless defined?(::TZInfo)
317323
::TZInfo::TimezoneProxy.new(MAPPING[name] || name)
318324
end
319325

0 commit comments

Comments
 (0)