et-orbi 1.2.10 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CREDITS.md +2 -1
- data/LICENSE.txt +1 -1
- data/Makefile +4 -4
- data/README.md +9 -1
- data/et-orbi.gemspec +9 -6
- data/lib/et-orbi/info.rb +1 -0
- data/lib/et-orbi/time.rb +37 -24
- data/lib/et-orbi/version.rb +6 -0
- data/lib/et-orbi/zones.rb +13 -1
- data/lib/et-orbi.rb +1 -6
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bff6c08f6ece712b2058c0e91120b4bc4fff8925a377fdd8079ec4bbe151a44
|
4
|
+
data.tar.gz: 01ff0b2c74e2a62bb7b895fc83a2a993b2a5a2e1e6088fc4301848076b83a2f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d6da83141821bb9f8afe331b8a24caeb88ef8723ea1b34e8c3ce34c8028e0f50a6b254e16fb4501d1cee092cec716e82cac970d1fdef130206fbcc38004d2a5
|
7
|
+
data.tar.gz: aa234212a99fb2c4991ee1cf081a34247f73bd01170d4cd3db2769c6c5d1d003543db0d08a887e4c544310e0da01f593d77d86f71c5b73e59cf029c5210fc075
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## et-orbi 1.3.0 released 2025-08-08
|
6
|
+
|
7
|
+
- Use probatio for testing
|
8
|
+
- Drop unnecessary touch in EoTime#inc
|
9
|
+
- Let EtOrbi #+ and #- accept instances with #to_i or #to_f (not strs), gh-40
|
10
|
+
- Introduce EtOrbi.zone_abbreviation(zone_name, time)
|
11
|
+
|
12
|
+
|
13
|
+
## et-orbi 1.2.11 released 2024-03-23
|
14
|
+
|
15
|
+
- Cache @rweek and @rday, not @ref, gh-38
|
16
|
+
|
17
|
+
|
5
18
|
## et-orbi 1.2.10 released 2024-03-22
|
6
19
|
|
7
20
|
- Refine #rweek computation, aim more at noon instead of midnight, gh-38
|
data/CREDITS.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
# et-orbi credits
|
3
3
|
|
4
|
+
* Keenan Brock https://github.com/kbrock version parsing and ostruct dep
|
4
5
|
* Benjami Darcet https://github.com/bdarcet https://github.com/floraison/fugit/issues/67 gh-38
|
5
6
|
* https://github.com/franckduche https://github.com/floraison/fugit/issues/67 gh-38
|
6
7
|
* Igor Viktor https://github.com/gogainda gh-34
|
@@ -8,7 +9,7 @@
|
|
8
9
|
* Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-32
|
9
10
|
* harsha-flipp https://github.com/harsha-flipp https://github.com/floraison/fugit/issues/63
|
10
11
|
* adank92 https://github.com/adank92 https://github.com/ondrejbartas/sidekiq-cron/issues/276 gh-28
|
11
|
-
* Stan Hu https://github.com/stanhu Chronic
|
12
|
+
* Stan Hu https://github.com/stanhu Chronic troubles, gh-24, gh-26, etc
|
12
13
|
* d-m-u https://github.com/d-m-u EoTime#==(Time), gh-20, gh-7
|
13
14
|
* Vais Salikhov (https://github.com/vais) missing US timezone aliases, gh-18 gh-19
|
14
15
|
* Wenhui Wang https://github.com/w11th .parse vs Chronic+ActiveSupport, fugit 11
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2017-
|
2
|
+
Copyright (c) 2017-2025, John Mettraux, jmettraux+flor@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/Makefile
CHANGED
@@ -33,9 +33,9 @@ build: gemspec_validate
|
|
33
33
|
push: build
|
34
34
|
gem push --otp "$(OTP)" pkg/$(NAME)-$(VERSION).gem
|
35
35
|
|
36
|
-
|
37
|
-
bundle exec
|
38
|
-
|
36
|
+
test:
|
37
|
+
bundle exec proba
|
38
|
+
spec: test
|
39
39
|
|
40
40
|
|
41
41
|
## specific to project ##
|
@@ -48,5 +48,5 @@ info:
|
|
48
48
|
|
49
49
|
## done ##
|
50
50
|
|
51
|
-
.PHONY: count_lines scan gemspec_validate name cw build push
|
51
|
+
.PHONY: count_lines scan gemspec_validate name cw build push test info
|
52
52
|
|
data/README.md
CHANGED
@@ -43,7 +43,7 @@ eot = EtOrbi::EoTime.new(0, 'Europe/Moscow')
|
|
43
43
|
eot.to_local_time.class # => Time
|
44
44
|
eot.to_local_time.to_s # => "1970-01-01 09:00:00 +0900" (at least on my system)
|
45
45
|
|
46
|
-
# For the rest, EtOrbi::EoTime
|
46
|
+
# For the rest, EtOrbi::EoTime mimics ::Time
|
47
47
|
```
|
48
48
|
|
49
49
|
Helper methods:
|
@@ -115,6 +115,14 @@ EtOrbi.parse('tomorrow')
|
|
115
115
|
# from /home/jmettraux/w/et-orbi/lib/et-orbi/make.rb:31:in `rescue in parse'
|
116
116
|
```
|
117
117
|
|
118
|
+
### Testing
|
119
|
+
|
120
|
+
To run tests, use `proba`:
|
121
|
+
|
122
|
+
```
|
123
|
+
bundle exec proba
|
124
|
+
```
|
125
|
+
|
118
126
|
### Rails?
|
119
127
|
|
120
128
|
If Rails is present, `Time.zone` is provided and EtOrbi will use it, unless `ENV['TZ']` is set to a valid timezone name. Setting `ENV['TZ']` to nil can give back precedence to `Time.zone`.
|
data/et-orbi.gemspec
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
require File.expand_path('../lib/et-orbi/version.rb', __FILE__)
|
3
3
|
|
4
|
-
s.name = 'et-orbi'
|
5
4
|
|
6
|
-
|
7
|
-
File.expand_path('../lib/et-orbi.rb', __FILE__)
|
8
|
-
).match(/ VERSION *= *['"]([^'"]+)/)[1]
|
5
|
+
Gem::Specification.new do |s|
|
9
6
|
|
7
|
+
s.name = 'et-orbi'
|
8
|
+
s.version = EtOrbi::VERSION
|
10
9
|
s.platform = Gem::Platform::RUBY
|
11
10
|
s.authors = [ 'John Mettraux' ]
|
12
11
|
s.email = [ 'jmettraux+flor@gmail.com' ]
|
@@ -26,6 +25,7 @@ Time zones for fugit and rufus-scheduler. Urbi et Orbi.
|
|
26
25
|
'homepage_uri' => s.homepage,
|
27
26
|
'source_code_uri' => s.homepage,
|
28
27
|
#'wiki_uri' => s.homepage + '/wiki',
|
28
|
+
'rubygems_mfa_required' => 'true',
|
29
29
|
}
|
30
30
|
|
31
31
|
#s.files = `git ls-files`.split("\n")
|
@@ -48,8 +48,11 @@ Time zones for fugit and rufus-scheduler. Urbi et Orbi.
|
|
48
48
|
|
49
49
|
#s.add_runtime_dependency 'raabro', '>= 1.1.3'
|
50
50
|
|
51
|
-
s.add_development_dependency 'rspec', '~> 3.8'
|
51
|
+
#s.add_development_dependency 'rspec', '~> 3.8'
|
52
|
+
s.add_development_dependency 'ostruct'
|
53
|
+
s.add_development_dependency 'probatio', '~> 1.3'
|
52
54
|
s.add_development_dependency 'chronic', '~> 0.10'
|
55
|
+
#s.add_development_dependency 'activesupport', '~> 8.0'
|
53
56
|
|
54
57
|
s.require_path = 'lib'
|
55
58
|
end
|
data/lib/et-orbi/info.rb
CHANGED
@@ -17,6 +17,7 @@ module EtOrbi
|
|
17
17
|
'win' => Gem.win_platform?,
|
18
18
|
'rorv' => (Rails::VERSION::STRING rescue nil),
|
19
19
|
'astz' => ([ Time.zone.class, Time.zone.tzinfo.name ] rescue nil),
|
20
|
+
'chronic' => (Chronic::VERSION rescue nil),
|
20
21
|
'eov' => EtOrbi::VERSION,
|
21
22
|
'eotnz' => '???',
|
22
23
|
'eotnfz' => '???',
|
data/lib/et-orbi/time.rb
CHANGED
@@ -96,7 +96,8 @@ module EtOrbi
|
|
96
96
|
def touch
|
97
97
|
|
98
98
|
@time = nil
|
99
|
-
@
|
99
|
+
@rday = nil
|
100
|
+
@rweek = nil
|
100
101
|
end
|
101
102
|
|
102
103
|
def seconds=(f)
|
@@ -315,24 +316,32 @@ module EtOrbi
|
|
315
316
|
|
316
317
|
def inc(t, dir=1)
|
317
318
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
319
|
+
case t
|
320
|
+
when ::Time, ::EtOrbi::EoTime
|
321
|
+
|
322
|
+
fail(
|
323
|
+
ArgumentError.new("Cannot add #{t.class} to EoTime instance")
|
324
|
+
) if dir > 0
|
325
|
+
|
326
|
+
@seconds + dir * t.to_f
|
327
|
+
|
328
|
+
when String
|
329
|
+
|
330
|
+
false
|
331
|
+
|
332
|
+
else
|
333
|
+
|
334
|
+
if t.respond_to?(:to_f)
|
335
|
+
nt = self.dup; nt.seconds += dir * t.to_f; nt
|
336
|
+
elsif t.respond_to?(:to_i)
|
337
|
+
nt = self.dup; nt.seconds += dir * t.to_i; nt
|
328
338
|
else
|
329
|
-
|
330
|
-
"Cannot call add or subtract #{t.class} to EoTime instance")
|
339
|
+
false
|
331
340
|
end
|
332
341
|
|
333
|
-
|
334
|
-
|
335
|
-
|
342
|
+
end || fail(
|
343
|
+
ArgumentError.new(
|
344
|
+
"Cannot call add or subtract #{t.class} on EoTime instance"))
|
336
345
|
end
|
337
346
|
|
338
347
|
def localtime(zone=nil)
|
@@ -353,20 +362,24 @@ module EtOrbi
|
|
353
362
|
#
|
354
363
|
def rweek
|
355
364
|
|
356
|
-
@
|
357
|
-
|
358
|
-
|
359
|
-
|
365
|
+
@rweek ||=
|
366
|
+
begin
|
367
|
+
ref = EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
368
|
+
noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
|
369
|
+
((noon - ref) / WEEK_S).floor + 1
|
370
|
+
end
|
360
371
|
end
|
361
372
|
|
362
373
|
# "reference week", used in fugit for cron modulo notation
|
363
374
|
#
|
364
375
|
def rday
|
365
376
|
|
366
|
-
@
|
367
|
-
|
368
|
-
|
369
|
-
|
377
|
+
@rday ||=
|
378
|
+
begin
|
379
|
+
ref = EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
380
|
+
noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
|
381
|
+
((noon - ref) / DAY_S).floor + 1
|
382
|
+
end
|
370
383
|
end
|
371
384
|
|
372
385
|
def reach(points)
|
data/lib/et-orbi/zones.rb
CHANGED
@@ -77,7 +77,7 @@ module EtOrbi
|
|
77
77
|
tz = (etz && tzs.find { |z| z.name == etz }) || tzs.first
|
78
78
|
return tz if tz
|
79
79
|
|
80
|
-
# then, fall back to GMT
|
80
|
+
# then, fall back to GMT offset :-(
|
81
81
|
|
82
82
|
n = Time.now
|
83
83
|
|
@@ -161,6 +161,18 @@ module EtOrbi
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
def zone_abbreviation(zone_name, time)
|
165
|
+
|
166
|
+
tz = ::TZInfo::Timezone.get(zone_name)
|
167
|
+
|
168
|
+
ts = tz.period_for_local(time, true) rescue -1
|
169
|
+
tw = tz.period_for_local(time, false) rescue -2
|
170
|
+
|
171
|
+
return ts.abbreviation.to_s if ts == tw
|
172
|
+
|
173
|
+
tz.period_for_local(time + 2 * 3600).abbreviation.to_s
|
174
|
+
end
|
175
|
+
|
164
176
|
def tweak_zone_name(name)
|
165
177
|
|
166
178
|
return name unless (name.match(/./) rescue nil)
|
data/lib/et-orbi.rb
CHANGED
@@ -4,15 +4,10 @@ require 'time'
|
|
4
4
|
|
5
5
|
require 'tzinfo'
|
6
6
|
|
7
|
+
require 'et-orbi/version'
|
7
8
|
require 'et-orbi/info'
|
8
9
|
require 'et-orbi/make'
|
9
10
|
require 'et-orbi/time'
|
10
11
|
require 'et-orbi/zones'
|
11
12
|
require 'et-orbi/zone'
|
12
13
|
|
13
|
-
|
14
|
-
module EtOrbi
|
15
|
-
|
16
|
-
VERSION = '1.2.10'
|
17
|
-
end
|
18
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: et-orbi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -25,19 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: ostruct
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: probatio
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3
|
47
|
+
version: '1.3'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3
|
54
|
+
version: '1.3'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: chronic
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,6 +83,7 @@ files:
|
|
69
83
|
- lib/et-orbi/info.rb
|
70
84
|
- lib/et-orbi/make.rb
|
71
85
|
- lib/et-orbi/time.rb
|
86
|
+
- lib/et-orbi/version.rb
|
72
87
|
- lib/et-orbi/zone.rb
|
73
88
|
- lib/et-orbi/zones.rb
|
74
89
|
- lib/et_orbi.rb
|
@@ -82,6 +97,7 @@ metadata:
|
|
82
97
|
bug_tracker_uri: https://github.com/floraison/et-orbi/issues
|
83
98
|
homepage_uri: https://github.com/floraison/et-orbi
|
84
99
|
source_code_uri: https://github.com/floraison/et-orbi
|
100
|
+
rubygems_mfa_required: 'true'
|
85
101
|
post_install_message:
|
86
102
|
rdoc_options: []
|
87
103
|
require_paths:
|
@@ -97,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
113
|
- !ruby/object:Gem::Version
|
98
114
|
version: '0'
|
99
115
|
requirements: []
|
100
|
-
rubygems_version: 3.4.
|
116
|
+
rubygems_version: 3.4.19
|
101
117
|
signing_key:
|
102
118
|
specification_version: 4
|
103
119
|
summary: time with zones
|