Commit 4d983808 authored by Raju Devidas's avatar Raju Devidas 💻

New upstream version 1.1.6

parent 71c8c966
# et-orbi CHANGELOG.md
# CHANGELOG.md
## et-orbi 1.1.6 released 2018-09-05
- Ensure Olson timezone name regex covers all timezone names
https://github.com/floraison/fugit/issues/9
## et-orbi 1.1.5 released 2018-08-25
- Prevent encoding issue on Windows with "Mitteleuropaeische Sommerzeit", gh-15
## et-orbi 1.1.4 released 2018-07-25
- Silence 3 Ruby warnings (thanks Jamie Stackhouse, gh-13)
- Introduce EtOrbi::Eotime.reach(points)
## et-orbi 1.1.3 released 2018-07-14
- Introduce EtOrbi::EoTime#ambiguous?
- Introduce EtOrbi::EoTime#to_z for precise timezones (not offsets)
## et-orbi 1.1.2 released 2018-05-24
- Let EtOrbi.get_tzone understand "CST+0800"
- Introduce EtOrbi.to_windows_tz (Asia/Kolkata to IST-5:30)
## et-orbi 1.1.1 released 2018-05-04
- Stop caching the local tzone, cache the tools used for determining it
## et-orbi 1.1.0 released 2018-03-25
- Implement EoTime .utc and .local (based on Time .utc and .local)
- Add EoTime#translate(target_zone) as #localtime(target_zone) alias
- Correct EoTime#iso8601 (was always returning zulu iso8601 string)
## et-orbi 1.0.9 released 2018-01-19
- Silence EoTime#strfz warning
- Silence warnings reported by @mdave16, gh-10
- @philr added support for upcoming tzinfo 2.x, gh-9
## et-orbi 1.0.8 released 2017-10-24
- Ensure ::EoTime.new accepts ActiveSupport::TimeZone, closes gh-8
## et-orbi 1.0.7 released 2017-10-07
- Leverage ActiveSupport::TimeWithZone when present, gh-6
- Start error messages with a capital
## et-orbi 1.0.6 released 2017-10-05
- Introduce `make info`
- Alias EoTime#to_utc_time to #utc
- Alias EoTime#to_t to #to_local_time
- Implement EoTime#to_local_time (since #to_time returns a UTC Time instance)
## et-orbi 1.0.5 released 2017-06-23
......
# et-orbi credits
* Jeremy Strouse https://github.com/jstrouse help alleviate issue with older versions of TZInfo
* Marcel https://github.com/MTRNord "Mitteleuropaeische Sommerzeit", gh-15
* Stanisław Pitucha https://github.com/viraptor rubygems link to changelog, gh-14
* Jamie Stackhouse https://github.com/itsjamie reported warnings, gh-13
* mlotfi2005 https://github.com/mlotfi2005 reported infinite loop, gh-12
* Mayur Dave https://github.com/mdave16 reported trailing warning, gh-10
* Phil Ross https://github.com/philr added support for upcoming TZInfo 2.x, gh-9
* Miles Lane https://github.com/mileslane issue with ActiveSupport::TimeZone, gh-8
* Chris Arcand https://github.com/chrisarcand shew various issues around America/Chicago on OSX, gh-4
* Jeremy Strouse https://github.com/jstrouse helped alleviate issue with older versions of TZInfo
See also https://github.com/floraison/et-orbi/graphs/contributors
## since rufus-scheduler
......
Copyright (c) 2017-2017, John Mettraux, jmettraux+flor@gmail.com
Copyright (c) 2017-2018, John Mettraux, jmettraux+flor@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -19,3 +19,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Made in Japan
......@@ -8,16 +8,20 @@ VERSION = \
count_lines:
find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
find spec -name "*_spec.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
cl: count_lines
gemspec_validate:
@echo "---"
ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); s.validate"
ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); p s.validate"
@echo "---"
name: gemspec_validate
@echo "$(NAME) $(VERSION)"
cw:
find lib -name "*.rb" -exec ruby -cw {} \;
build: gemspec_validate
gem build $(NAME).gemspec
mkdir -p pkg
......@@ -26,6 +30,20 @@ build: gemspec_validate
push: build
gem push pkg/$(NAME)-$(VERSION).gem
spec:
bundle exec rspec
test: spec
## specific to project ##
info:
uname -a
bundle exec ruby -v
bundle exec ruby -Ilib -r et-orbi -e "EtOrbi._make_info"
## done ##
.PHONY: build push
.PHONY: count_lines gemspec_validate name cw build push spec info
......@@ -2,6 +2,7 @@
# et-orbi
[![Build Status](https://secure.travis-ci.org/floraison/et-orbi.svg)](http://travis-ci.org/floraison/et-orbi)
[![Build status](https://ci.appveyor.com/api/projects/status/6tbo9lk9qdor8ipl?svg=true)](https://ci.appveyor.com/project/jmettraux/et-orbi)
[![Gem Version](https://badge.fury.io/rb/et-orbi.svg)](http://badge.fury.io/rb/et-orbi)
Time zones for [fugit](https://github.com/floraison/fugit) and for [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler). Urbi et Orbi.
......@@ -26,6 +27,22 @@ EtOrbi::EoTime.new(0, 'UTC').to_s
# => "1970-01-01 00:00:00 +0000"
EtOrbi::EoTime.new(0, 'Europe/Moscow').to_s
# => "1970-01-01 03:00:00 +0300"
EtOrbi::EoTime.new(0, 'Europe/Moscow').to_zs
# => "1970-01-01 03:00:00 Europe/Moscow" # "be precise in your speech"
EtOrbi.parse('1970-01-01 03:00:00 Europe/Moscow')
# => #<EtOrbi::EoTime:0x00007fa4bc83fcd0
# @seconds=0.0, @zone=#<TZInfo::DataTimezone: Europe/Moscow>, @time=nil>
```
More about `EtOrbi::EoTime` instances:
```
eot = EtOrbi::EoTime.new(0, 'Europe/Moscow')
eot.to_local_time.class # => Time
eot.to_local_time.to_s # => "1970-01-01 09:00:00 +0900" (at least on my system)
# For the rest, EtOrbi::EoTime mimicks ::Time
```
Helper methods:
......@@ -63,7 +80,7 @@ Rails sets its timezone under `config/application.rb`.
### Sister projects
* [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) - a cron/at/in/every/interval in-process scheduler, in fact, it's the father project to this fugit project
* [fugit](https://github.com/floraison/fugit) - Time tools for flor and the floraison project. Cron parsing and occurence computing. Timestamps and more.
* [fugit](https://github.com/floraison/fugit) - Time tools for flor and the floraison project. Cron parsing and occurrence computing. Timestamps and more.
## LICENSE
......
......@@ -18,11 +18,23 @@ Gem::Specification.new do |s|
Time zones for fugit and rufus-scheduler. Urbi et Orbi.
}.strip
s.metadata = {
'changelog_uri' => s.homepage + '/blob/master/CHANGELOG.md',
'documentation_uri' => s.homepage,
'bug_tracker_uri' => s.homepage + '/issues',
#'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/floraison',
'homepage_uri' => s.homepage,
'source_code_uri' => s.homepage,
#'wiki_uri' => s.homepage + '/wiki',
}
#s.files = `git ls-files`.split("\n")
s.files = Dir[
'README.{md,txt}',
'CHANGELOG.{md,txt}', 'CREDITS.{md,txt}', 'LICENSE.{md,txt}',
'Makefile',
'lib/**/*.rb', #'spec/**/*.rb', 'test/**/*.rb',
'*.gemspec', '*.txt', '*.md'
"#{s.name}.gemspec",
]
s.add_runtime_dependency 'tzinfo'
......
This diff is collapsed.
module EtOrbi
def self.unalias(name)
return name unless (name.match(/./) rescue nil)
ZONE_ALIASES[name.sub(/ Daylight /, ' Standard ')] ||
unzz(name) ||
name
end
def self.unzz(name)
m = name.match(/\A([A-Z]{3,4})([+-])(\d{1,2}):?(\d{2})?\z/)
return nil unless m
abbs = [ m[1] ]; a = m[1]
abbs << "#{a}T" if a.size < 4
off = (m[2] == '+' ? 1 : -1) * (m[3].to_i * 3600 + (m[4] || '0').to_i * 60)
t = Time.now
twin = Time.utc(t.year, 1, 1) # winter
tsum = Time.utc(t.year, 7, 1) # summer
(@tz_all ||= ::TZInfo::Timezone.all)
.each { |tz|
abbs.each { |abb|
per = tz.period_for_utc(twin)
return tz.name \
if per.abbreviation.to_s == abb && per.utc_total_offset == off
per = tz.period_for_utc(tsum)
return tz.name \
if per.abbreviation.to_s == abb && per.utc_total_offset == off } }
nil
end
ZONE_ALIASES = {
'Coordinated Universal Time' => 'UTC',
'Afghanistan Standard Time' => 'Asia/Kabul',
'FLE Standard Time' => 'Europe/Helsinki',
'Central Europe Standard Time' => 'Europe/Prague',
'UTC-11' => 'Etc/GMT+11',
'W. Europe Standard Time' => 'Europe/Rome',
'W. Central Africa Standard Time' => 'Africa/Lagos',
'SA Western Standard Time' => 'America/La_Paz',
'Pacific SA Standard Time' => 'America/Santiago',
'Argentina Standard Time' => 'America/Argentina/Buenos_Aires',
'Caucasus Standard Time' => 'Asia/Yerevan',
'AUS Eastern Standard Time' => 'Australia/Sydney',
'Azerbaijan Standard Time' => 'Asia/Baku',
'Eastern Standard Time' => 'America/New_York',
'Arab Standard Time' => 'Asia/Riyadh',
'Bangladesh Standard Time' => 'Asia/Dhaka',
'Belarus Standard Time' => 'Europe/Minsk',
'Romance Standard Time' => 'Europe/Paris',
'Central America Standard Time' => 'America/Belize',
'Atlantic Standard Time' => 'Atlantic/Bermuda',
'Venezuela Standard Time' => 'America/Caracas',
'Central European Standard Time' => 'Europe/Warsaw',
'South Africa Standard Time' => 'Africa/Johannesburg',
#'UTC' => 'Etc/UTC', # 'UTC' is good as is
'E. South America Standard Time' => 'America/Sao_Paulo',
'Central Asia Standard Time' => 'Asia/Almaty',
'Singapore Standard Time' => 'Asia/Singapore',
'Greenwich Standard Time' => 'Africa/Monrovia',
'Cape Verde Standard Time' => 'Atlantic/Cape_Verde',
'SE Asia Standard Time' => 'Asia/Bangkok',
'SA Pacific Standard Time' => 'America/Bogota',
'China Standard Time' => 'Asia/Shanghai',
'Myanmar Standard Time' => 'Asia/Yangon',
'E. Africa Standard Time' => 'Africa/Nairobi',
'Hawaiian Standard Time' => 'Pacific/Honololu',
'E. Europe Standard Time' => 'Europe/Nicosia',
'Tokyo Standard Time' => 'Asia/Tokyo',
'Egypt Standard Time' => 'Africa/Cairo',
'SA Eastern Standard Time' => 'America/Cayenne',
'GMT Standard Time' => 'Europe/London',
'Fiji Standard Time' => 'Pacific/Fiji',
'West Asia Standard Time' => 'Asia/Tashkent',
'Georgian Standard Time' => 'Asia/Tbilisi',
'GTB Standard Time' => 'Europe/Athens',
'Greenland Standard Time' => 'America/Godthab',
'West Pacific Standard Time' => 'Pacific/Guam',
'Mauritius Standard Time' => 'Indian/Mauritius',
'India Standard Time' => 'Asia/Kolkata',
'Iran Standard Time' => 'Asia/Tehran',
'Arabic Standard Time' => 'Asia/Baghdad',
'Israel Standard Time' => 'Asia/Jerusalem',
'Jordan Standard Time' => 'Asia/Amman',
'UTC+12' => 'Etc/GMT-12',
'Korea Standard Time' => 'Asia/Seoul',
'Middle East Standard Time' => 'Asia/Beirut',
'Central Standard Time (Mexico)' => 'America/Mexico_City',
'Ulaanbaatar Standard Time' => 'Asia/Ulaanbaatar',
'Morocco Standard Time' => 'Africa/Casablanca',
'Namibia Standard Time' => 'Africa/Windhoek',
'Nepal Standard Time' => 'Asia/Kathmandu',
'Central Pacific Standard Time' => 'Etc/GMT-11',
'New Zealand Standard Time' => 'Pacific/Auckland',
'Arabian Standard Time' => 'Asia/Dubai',
'Pakistan Standard Time' => 'Asia/Karachi',
'Paraguay Standard Time' => 'America/Asuncion',
'Pacific Standard Time' => 'America/Los_Angeles',
'Russian Standard Time' => 'Europe/Moscow',
'Samoa Standard Time' => 'Pacific/Pago_Pago',
'UTC-02' => 'Etc/GMT+2',
'Sri Lanka Standard Time' => 'Asia/Kolkata',
'Syria Standard Time' => 'Asia/Damascus',
'Taipei Standard Time' => 'Asia/Taipei',
'Tonga Standard Time' => 'Pacific/Tongatapu',
'Turkey Standard Time' => 'Asia/Istanbul',
'Montevideo Standard Time' => 'America/Montevideo' }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment