activerecord-time 0.18.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +69 -0
- data/.rubocop_todo.yml +2 -2
- data/lib/activerecord-time/version.rb +1 -1
- data/lib/time_of_day/core_ext.rb +6 -0
- data/lib/time_of_day.rb +3 -2
- data/test/database.yml +1 -1
- data/test/test_helper.rb +1 -1
- data/test/time_of_day_test.rb +10 -8
- metadata +4 -6
- data/gemfiles/ar51.gemfile.lock +0 -75
- data/gemfiles/ar52.gemfile.lock +0 -75
- data/gemfiles/ar60.gemfile.lock +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e31e5791113c1c15833344fc7a243a87bacc1f35cc6fdbeb15cbe7edf7daf4
|
4
|
+
data.tar.gz: 58990d314938ba0786cf4733c1616c50757d5e21cb6e37153b207fff4d5d5b42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bfd12648f4877017b8296a35dfebca5ae1ac9157bc6d63f35354450b3953a950d6a99fa38d477ffe01bf363b459b3010fe6d0f17589ee744e0b8b4b542c1210
|
7
|
+
data.tar.gz: fa6e24e7993c666265de8e82dee024f66e18878141d31c5862c0602ba4096854601f81af6253875cf7f81505ceac2de1e932d36dde97423db825ba6943517a29
|
@@ -0,0 +1,69 @@
|
|
1
|
+
name: Test
|
2
|
+
on:
|
3
|
+
workflow_dispatch:
|
4
|
+
inputs:
|
5
|
+
logLevel:
|
6
|
+
description: 'Log level'
|
7
|
+
required: true
|
8
|
+
default: 'warning'
|
9
|
+
tags:
|
10
|
+
description: 'Test scenario tags'
|
11
|
+
required: false
|
12
|
+
push:
|
13
|
+
branches: [ master ]
|
14
|
+
pull_request:
|
15
|
+
branches: [ master ]
|
16
|
+
|
17
|
+
env:
|
18
|
+
LANGUAGE: nb
|
19
|
+
PGUSER: postgres
|
20
|
+
PGPASSWORD: password
|
21
|
+
RAILS_ENV: test
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
Rubocop:
|
25
|
+
runs-on: ubuntu-20.04
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v2
|
28
|
+
- uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: '3.0'
|
31
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
32
|
+
- name: Rubocop
|
33
|
+
run: bundle exec rubocop --auto-correct-all
|
34
|
+
Test:
|
35
|
+
runs-on: ubuntu-20.04
|
36
|
+
services:
|
37
|
+
postgres:
|
38
|
+
image: postgres
|
39
|
+
env:
|
40
|
+
POSTGRES_PASSWORD: password
|
41
|
+
ports:
|
42
|
+
- 5432:5432
|
43
|
+
# needed because the postgres container does not provide a healthcheck
|
44
|
+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
45
|
+
strategy:
|
46
|
+
fail-fast: false
|
47
|
+
matrix:
|
48
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
49
|
+
ruby: [ 2.6, 2.7, '3.0', jruby, truffleruby ]
|
50
|
+
gemfile: [ ar61, ar60, ar52, ar51 ]
|
51
|
+
adapter: [ postgresql, sqlite3 ]
|
52
|
+
exclude:
|
53
|
+
- ruby: '3.0'
|
54
|
+
gemfile: ar52
|
55
|
+
- ruby: '3.0'
|
56
|
+
gemfile: ar51
|
57
|
+
- ruby: jruby
|
58
|
+
adapter: sqlite3
|
59
|
+
env:
|
60
|
+
ADAPTER: ${{ matrix.adapter }}
|
61
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
62
|
+
steps:
|
63
|
+
- uses: actions/checkout@v2
|
64
|
+
- uses: ruby/setup-ruby@v1
|
65
|
+
with:
|
66
|
+
ruby-version: ${{ matrix.ruby }}
|
67
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
68
|
+
- name: Rake test
|
69
|
+
run: bundle exec rake test
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-11-25
|
3
|
+
# on 2021-11-25 11:12:32 UTC using RuboCop version 1.23.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -31,7 +31,7 @@ Metrics/BlockLength:
|
|
31
31
|
# Offense count: 2
|
32
32
|
# Configuration parameters: CountComments, CountAsOne.
|
33
33
|
Metrics/ClassLength:
|
34
|
-
Max:
|
34
|
+
Max: 184
|
35
35
|
|
36
36
|
# Offense count: 1
|
37
37
|
# Configuration parameters: IgnoredMethods.
|
data/lib/time_of_day/core_ext.rb
CHANGED
data/lib/time_of_day.rb
CHANGED
@@ -87,11 +87,12 @@ class TimeOfDay
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def -(other)
|
90
|
-
|
90
|
+
case other
|
91
|
+
when TimeOfDay
|
91
92
|
t1 = Time.local(0, 1, 1, hour, minute, second) # rubocop: disable Rails/TimeZone
|
92
93
|
t2 = Time.local(0, 1, 1, other.hour, other.minute, other.second) # rubocop: disable Rails/TimeZone
|
93
94
|
(t1 - t2).seconds
|
94
|
-
|
95
|
+
when Numeric
|
95
96
|
self.+(-other)
|
96
97
|
else
|
97
98
|
raise "Illegal argument: #{other.inspect}"
|
data/test/database.yml
CHANGED
data/test/test_helper.rb
CHANGED
@@ -19,7 +19,7 @@ if defined?(Rake) && (RUBY_ENGINE != 'jruby' || org.jruby.RubyInstanceConfig.FUL
|
|
19
19
|
end
|
20
20
|
|
21
21
|
FileUtils.rm_rf File.expand_path(':memory:', File.dirname(__FILE__))
|
22
|
-
config = YAML.load(
|
22
|
+
config = YAML.load(File.read(File.dirname(__FILE__) + '/database.yml'))
|
23
23
|
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/test.log')
|
24
24
|
adapter = ENV['ADAPTER'] || 'sqlite3'
|
25
25
|
if adapter != 'sqlite3'
|
data/test/time_of_day_test.rb
CHANGED
@@ -142,14 +142,16 @@ class TimeOfDayTest < Minitest::Test
|
|
142
142
|
assert_equal 59, tod.second
|
143
143
|
end
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
145
|
+
if ActiveRecord.gem_version >= Gem::Version.new('6.1')
|
146
|
+
def test_minus_tod
|
147
|
+
tod1 = TimeOfDay.new(12, 0, 29)
|
148
|
+
tod2 = TimeOfDay.new(13, 30, 59)
|
149
|
+
duration = tod2 - tod1
|
150
|
+
|
151
|
+
assert_equal 1, duration.in_hours.to_i
|
152
|
+
assert_equal 30, duration.in_minutes.to_i % 60
|
153
|
+
assert_equal 30, duration.in_seconds % 60
|
154
|
+
end
|
153
155
|
end
|
154
156
|
|
155
157
|
def test_equality
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -150,6 +150,7 @@ executables: []
|
|
150
150
|
extensions: []
|
151
151
|
extra_rdoc_files: []
|
152
152
|
files:
|
153
|
+
- ".github/workflows/test.yml"
|
153
154
|
- ".gitignore"
|
154
155
|
- ".rubocop.yml"
|
155
156
|
- ".rubocop_todo.yml"
|
@@ -161,11 +162,8 @@ files:
|
|
161
162
|
- Rakefile
|
162
163
|
- activerecord-time.gemspec
|
163
164
|
- gemfiles/ar51.gemfile
|
164
|
-
- gemfiles/ar51.gemfile.lock
|
165
165
|
- gemfiles/ar52.gemfile
|
166
|
-
- gemfiles/ar52.gemfile.lock
|
167
166
|
- gemfiles/ar60.gemfile
|
168
|
-
- gemfiles/ar60.gemfile.lock
|
169
167
|
- gemfiles/ar61.gemfile
|
170
168
|
- gemfiles/common.gemfile
|
171
169
|
- lib/activerecord-time.rb
|
@@ -197,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
195
|
- !ruby/object:Gem::Version
|
198
196
|
version: '0'
|
199
197
|
requirements: []
|
200
|
-
rubygems_version: 3.2.
|
198
|
+
rubygems_version: 3.2.32
|
201
199
|
signing_key:
|
202
200
|
specification_version: 4
|
203
201
|
summary: A handler for storing TimeOfDay objects in ActiveRecord objects as sql time
|
data/gemfiles/ar51.gemfile.lock
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activemodel (5.1.7)
|
5
|
-
activesupport (= 5.1.7)
|
6
|
-
activerecord (5.1.7)
|
7
|
-
activemodel (= 5.1.7)
|
8
|
-
activesupport (= 5.1.7)
|
9
|
-
arel (~> 8.0)
|
10
|
-
activerecord-jdbc-adapter (51.4-java)
|
11
|
-
activerecord (~> 5.1.0)
|
12
|
-
activerecord-jdbcderby-adapter (0.8.2)
|
13
|
-
activerecord-jdbc-adapter (>= 0.8.2)
|
14
|
-
jdbc-derby (>= 10.3.2.1)
|
15
|
-
activerecord-jdbcpostgresql-adapter (51.4-java)
|
16
|
-
activerecord-jdbc-adapter (= 51.4)
|
17
|
-
jdbc-postgres (>= 9.4, < 43)
|
18
|
-
activerecord-jdbcsqlite3-adapter (51.4-java)
|
19
|
-
activerecord-jdbc-adapter (= 51.4)
|
20
|
-
jdbc-sqlite3 (~> 3.8, < 3.30)
|
21
|
-
activesupport (5.1.7)
|
22
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
|
-
i18n (>= 0.7, < 2)
|
24
|
-
minitest (~> 5.1)
|
25
|
-
tzinfo (~> 1.1)
|
26
|
-
ansi (1.5.0)
|
27
|
-
arel (8.0.0)
|
28
|
-
builder (3.2.3)
|
29
|
-
concurrent-ruby (1.1.5)
|
30
|
-
docile (1.3.2)
|
31
|
-
i18n (1.7.0)
|
32
|
-
concurrent-ruby (~> 1.0)
|
33
|
-
jdbc-derby (10.12.1.1)
|
34
|
-
jdbc-postgres (42.2.6)
|
35
|
-
jdbc-sqlite3 (3.28.0)
|
36
|
-
json (2.2.0)
|
37
|
-
json (2.2.0-java)
|
38
|
-
minitest (5.12.2)
|
39
|
-
minitest-reporters (1.4.1)
|
40
|
-
ansi
|
41
|
-
builder
|
42
|
-
minitest (>= 5.0)
|
43
|
-
ruby-progressbar
|
44
|
-
pg (0.21.0)
|
45
|
-
rake (13.0.0)
|
46
|
-
ruby-progressbar (1.10.1)
|
47
|
-
simplecov (0.17.1)
|
48
|
-
docile (~> 1.1)
|
49
|
-
json (>= 1.8, < 3)
|
50
|
-
simplecov-html (~> 0.10.0)
|
51
|
-
simplecov-html (0.10.2)
|
52
|
-
sqlite3 (1.4.1)
|
53
|
-
thread_safe (0.3.6)
|
54
|
-
thread_safe (0.3.6-java)
|
55
|
-
tzinfo (1.2.5)
|
56
|
-
thread_safe (~> 0.1)
|
57
|
-
|
58
|
-
PLATFORMS
|
59
|
-
java
|
60
|
-
ruby
|
61
|
-
|
62
|
-
DEPENDENCIES
|
63
|
-
activerecord (~> 5.1.1)
|
64
|
-
activerecord-jdbc-adapter
|
65
|
-
activerecord-jdbcderby-adapter
|
66
|
-
activerecord-jdbcpostgresql-adapter
|
67
|
-
activerecord-jdbcsqlite3-adapter
|
68
|
-
minitest-reporters
|
69
|
-
pg (< 1)
|
70
|
-
rake
|
71
|
-
simplecov
|
72
|
-
sqlite3
|
73
|
-
|
74
|
-
BUNDLED WITH
|
75
|
-
1.17.2
|
data/gemfiles/ar52.gemfile.lock
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activemodel (5.2.3)
|
5
|
-
activesupport (= 5.2.3)
|
6
|
-
activerecord (5.2.3)
|
7
|
-
activemodel (= 5.2.3)
|
8
|
-
activesupport (= 5.2.3)
|
9
|
-
arel (>= 9.0)
|
10
|
-
activerecord-jdbc-adapter (52.3-java)
|
11
|
-
activerecord (~> 5.2.0)
|
12
|
-
activerecord-jdbcderby-adapter (0.8.2)
|
13
|
-
activerecord-jdbc-adapter (>= 0.8.2)
|
14
|
-
jdbc-derby (>= 10.3.2.1)
|
15
|
-
activerecord-jdbcpostgresql-adapter (52.3-java)
|
16
|
-
activerecord-jdbc-adapter (= 52.3)
|
17
|
-
jdbc-postgres (>= 9.4, < 43)
|
18
|
-
activerecord-jdbcsqlite3-adapter (52.3-java)
|
19
|
-
activerecord-jdbc-adapter (= 52.3)
|
20
|
-
jdbc-sqlite3 (~> 3.8, < 3.30)
|
21
|
-
activesupport (5.2.3)
|
22
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
|
-
i18n (>= 0.7, < 2)
|
24
|
-
minitest (~> 5.1)
|
25
|
-
tzinfo (~> 1.1)
|
26
|
-
ansi (1.5.0)
|
27
|
-
arel (9.0.0)
|
28
|
-
builder (3.2.3)
|
29
|
-
concurrent-ruby (1.1.5)
|
30
|
-
docile (1.3.2)
|
31
|
-
i18n (1.7.0)
|
32
|
-
concurrent-ruby (~> 1.0)
|
33
|
-
jdbc-derby (10.12.1.1)
|
34
|
-
jdbc-postgres (42.2.6)
|
35
|
-
jdbc-sqlite3 (3.28.0)
|
36
|
-
json (2.2.0)
|
37
|
-
json (2.2.0-java)
|
38
|
-
minitest (5.12.2)
|
39
|
-
minitest-reporters (1.4.1)
|
40
|
-
ansi
|
41
|
-
builder
|
42
|
-
minitest (>= 5.0)
|
43
|
-
ruby-progressbar
|
44
|
-
pg (0.21.0)
|
45
|
-
rake (13.0.0)
|
46
|
-
ruby-progressbar (1.10.1)
|
47
|
-
simplecov (0.17.1)
|
48
|
-
docile (~> 1.1)
|
49
|
-
json (>= 1.8, < 3)
|
50
|
-
simplecov-html (~> 0.10.0)
|
51
|
-
simplecov-html (0.10.2)
|
52
|
-
sqlite3 (1.4.1)
|
53
|
-
thread_safe (0.3.6)
|
54
|
-
thread_safe (0.3.6-java)
|
55
|
-
tzinfo (1.2.5)
|
56
|
-
thread_safe (~> 0.1)
|
57
|
-
|
58
|
-
PLATFORMS
|
59
|
-
java
|
60
|
-
ruby
|
61
|
-
|
62
|
-
DEPENDENCIES
|
63
|
-
activerecord (~> 5.2.0)
|
64
|
-
activerecord-jdbc-adapter
|
65
|
-
activerecord-jdbcderby-adapter
|
66
|
-
activerecord-jdbcpostgresql-adapter
|
67
|
-
activerecord-jdbcsqlite3-adapter
|
68
|
-
minitest-reporters
|
69
|
-
pg (< 1)
|
70
|
-
rake
|
71
|
-
simplecov
|
72
|
-
sqlite3
|
73
|
-
|
74
|
-
BUNDLED WITH
|
75
|
-
1.17.2
|
data/gemfiles/ar60.gemfile.lock
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activemodel (6.0.2.1)
|
5
|
-
activesupport (= 6.0.2.1)
|
6
|
-
activerecord (6.0.2.1)
|
7
|
-
activemodel (= 6.0.2.1)
|
8
|
-
activesupport (= 6.0.2.1)
|
9
|
-
activerecord-jdbc-adapter (60.1-java)
|
10
|
-
activerecord (~> 6.0.0)
|
11
|
-
activerecord-jdbcderby-adapter (0.8.2)
|
12
|
-
activerecord-jdbc-adapter (>= 0.8.2)
|
13
|
-
jdbc-derby (>= 10.3.2.1)
|
14
|
-
activerecord-jdbcpostgresql-adapter (60.1-java)
|
15
|
-
activerecord-jdbc-adapter (= 60.1)
|
16
|
-
jdbc-postgres (>= 9.4, < 43)
|
17
|
-
activerecord-jdbcsqlite3-adapter (60.1-java)
|
18
|
-
activerecord-jdbc-adapter (= 60.1)
|
19
|
-
jdbc-sqlite3 (~> 3.8, < 3.30)
|
20
|
-
activesupport (6.0.2.1)
|
21
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
-
i18n (>= 0.7, < 2)
|
23
|
-
minitest (~> 5.1)
|
24
|
-
tzinfo (~> 1.1)
|
25
|
-
zeitwerk (~> 2.2)
|
26
|
-
ansi (1.5.0)
|
27
|
-
builder (3.2.4)
|
28
|
-
concurrent-ruby (1.1.5)
|
29
|
-
docile (1.3.2)
|
30
|
-
i18n (1.7.0)
|
31
|
-
concurrent-ruby (~> 1.0)
|
32
|
-
jdbc-derby (10.12.1.1)
|
33
|
-
jdbc-postgres (42.2.6)
|
34
|
-
jdbc-sqlite3 (3.28.0)
|
35
|
-
json (2.3.0)
|
36
|
-
json (2.3.0-java)
|
37
|
-
minitest (5.13.0)
|
38
|
-
minitest-reporters (1.4.2)
|
39
|
-
ansi
|
40
|
-
builder
|
41
|
-
minitest (>= 5.0)
|
42
|
-
ruby-progressbar
|
43
|
-
pg (0.21.0)
|
44
|
-
rake (13.0.1)
|
45
|
-
ruby-progressbar (1.10.1)
|
46
|
-
simplecov (0.17.1)
|
47
|
-
docile (~> 1.1)
|
48
|
-
json (>= 1.8, < 3)
|
49
|
-
simplecov-html (~> 0.10.0)
|
50
|
-
simplecov-html (0.10.2)
|
51
|
-
sqlite3 (1.4.2)
|
52
|
-
thread_safe (0.3.6)
|
53
|
-
thread_safe (0.3.6-java)
|
54
|
-
tzinfo (1.2.6)
|
55
|
-
thread_safe (~> 0.1)
|
56
|
-
zeitwerk (2.2.2)
|
57
|
-
|
58
|
-
PLATFORMS
|
59
|
-
java
|
60
|
-
ruby
|
61
|
-
|
62
|
-
DEPENDENCIES
|
63
|
-
activerecord (~> 6.0.0)
|
64
|
-
activerecord-jdbc-adapter
|
65
|
-
activerecord-jdbcderby-adapter
|
66
|
-
activerecord-jdbcpostgresql-adapter
|
67
|
-
activerecord-jdbcsqlite3-adapter
|
68
|
-
minitest-reporters
|
69
|
-
pg (< 1)
|
70
|
-
rake
|
71
|
-
simplecov
|
72
|
-
sqlite3
|
73
|
-
|
74
|
-
BUNDLED WITH
|
75
|
-
1.17.2
|