activerecord-time 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ae9554b5154d27b89d69c1b24773eb9335be354
4
- data.tar.gz: 42ec02e4d00f79d45b23770149b7fd7df583e980
3
+ metadata.gz: f3377582c4b69bbaffdfb4b2147c4c9fedd6bd87
4
+ data.tar.gz: e871b6b116bd17436c0b1f27e1ead868ccafb692
5
5
  SHA512:
6
- metadata.gz: 57819c0256a549da0c0f790efef7a83b69c628f24f1157733fe38026d50476bde7b30490b6fc9d818fb785883c9ddd1e70aad381cb981e1c25d3ec123ab30562
7
- data.tar.gz: 2ecae0563de41830cc400adb4935a95309c6b233904286bf11dd1d51b3b0e80bf00ecb5d1a71e0af45f76b02bd0c689c3fed68db2f0fbb4706d8a7ed29fcf5d8
6
+ metadata.gz: 672aa67786ca42da38a78fd79f036c0954c43aedc186c767321e42ad9d56dddc931d557d709f8879a39d5311c66594937117da99a4bdfad27460f12bee0ce367
7
+ data.tar.gz: ec625e4fd2eb0ef826a0304a71de12177a39fac32ec71fc6f948e20fa110cd3820dc93a32812c0f0f37e4215ac050a8c05d54cf861e65cdc5e505899c3137509
data/.rubocop.yml ADDED
@@ -0,0 +1,36 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.1
5
+ DisplayCopNames: true
6
+ DisplayStyleGuide: true
7
+ Include:
8
+ - '**/Gemfile'
9
+ - '**/Rakefile'
10
+ Exclude:
11
+ - 'gemfiles/vendor/**/*'
12
+
13
+ Rails:
14
+ Enabled: true
15
+
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ Style/Encoding:
20
+ Enabled: true
21
+
22
+ Style/FileName:
23
+ Exclude:
24
+ - 'lib/activerecord-time.rb'
25
+
26
+ Style/FormatString:
27
+ EnforcedStyle: percent
28
+
29
+ Style/NumericPredicate:
30
+ Enabled: false
31
+
32
+ Style/ParallelAssignment:
33
+ Enabled: false
34
+
35
+ Style/SafeNavigation:
36
+ ConvertCodeThatCanStartToReturnNil: true
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,36 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-12-23 10:29:47 +0100 using RuboCop version 0.46.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 4
10
+ Metrics/AbcSize:
11
+ Max: 34
12
+
13
+ # Offense count: 2
14
+ # Configuration parameters: CountComments.
15
+ Metrics/BlockLength:
16
+ Max: 39
17
+
18
+ # Offense count: 1
19
+ # Configuration parameters: CountComments.
20
+ Metrics/ClassLength:
21
+ Max: 169
22
+
23
+ # Offense count: 1
24
+ Metrics/CyclomaticComplexity:
25
+ Max: 7
26
+
27
+ # Offense count: 11
28
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
29
+ # URISchemes: http, https
30
+ Metrics/LineLength:
31
+ Max: 114
32
+
33
+ # Offense count: 1
34
+ # Configuration parameters: CountComments.
35
+ Metrics/MethodLength:
36
+ Max: 16
data/.travis.yml CHANGED
@@ -1,27 +1,32 @@
1
1
  language: ruby
2
2
  sudo: false
3
+ jdk:
4
+ - oraclejdk8
5
+ before_install: gem query -i -n ^bundler$ >/dev/null || gem install bundler
3
6
  rvm:
4
- - "2.3"
5
- - jruby-9.1.0.0
6
- - "2.2"
7
- - jruby-9.0.5.0
8
- - "2.1"
9
- - "2.0.0"
10
- - jruby-1.7.25
7
+ - ruby-2.3.3
8
+ - jruby-9.1.6.0
9
+ - ruby-2.2.6
10
+ - ruby-2.1.9
11
11
  - ruby-head
12
12
  - jruby-head
13
13
  gemfile:
14
+ - gemfiles/ar50.gemfile
14
15
  - gemfiles/ar42.gemfile
15
16
  - gemfiles/ar41.gemfile
16
17
  - gemfiles/ar40.gemfile
17
18
  - gemfiles/ar32.gemfile
18
19
  env:
19
- - ADAPTER="postgresql"
20
- - ADAPTER="derby"
21
- - ADAPTER="sqlite3"
20
+ - JRUBY_OPTS="--dev --debug" ADAPTER="postgresql"
21
+ - JRUBY_OPTS="--dev --debug" ADAPTER="derby"
22
+ - JRUBY_OPTS="--dev --debug" ADAPTER="sqlite3"
22
23
  matrix:
23
- allow_failures:
24
+ exclude:
24
25
  - rvm: ruby-head
25
- gemfile: gemfiles/ar40.gemfile
26
+ gemfile: gemfiles/ar42.gemfile
27
+ - rvm: ruby-head
28
+ gemfile: gemfiles/ar41.gemfile
26
29
  - rvm: ruby-head
27
30
  gemfile: gemfiles/ar32.gemfile
31
+ - rvm: ruby-2.1.9
32
+ gemfile: gemfiles/ar50.gemfile
data/Gemfile CHANGED
@@ -3,6 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in activerecord-time.gemspec
4
4
  gemspec
5
5
 
6
- if ENV['AR_VERSION']
7
- gem 'activerecord', ENV['AR_VERSION']
8
- end
6
+ gem 'activerecord', ENV['AR_VERSION'] if ENV['AR_VERSION']
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
20
  gem.require_paths = %w(lib)
21
21
 
22
- gem.add_runtime_dependency 'activerecord', '>=3.2.21', '<5.0.0'
22
+ gem.add_runtime_dependency 'activerecord', '>=3.2.21', '<5.1'
23
23
 
24
24
  if defined? JRUBY_VERSION
25
25
  gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
@@ -30,5 +30,6 @@ Gem::Specification.new do |gem|
30
30
  end
31
31
  gem.add_development_dependency 'minitest-reporters'
32
32
  gem.add_development_dependency 'rake'
33
+ gem.add_development_dependency 'rubocop'
33
34
  gem.add_development_dependency 'simplecov'
34
35
  end
@@ -1,23 +1,23 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activemodel (3.2.22)
5
- activesupport (= 3.2.22)
4
+ activemodel (3.2.22.5)
5
+ activesupport (= 3.2.22.5)
6
6
  builder (~> 3.0.0)
7
- activerecord (3.2.22)
8
- activemodel (= 3.2.22)
9
- activesupport (= 3.2.22)
7
+ activerecord (3.2.22.5)
8
+ activemodel (= 3.2.22.5)
9
+ activesupport (= 3.2.22.5)
10
10
  arel (~> 3.0.2)
11
11
  tzinfo (~> 0.3.29)
12
- activerecord-jdbc-adapter (1.3.18)
12
+ activerecord-jdbc-adapter (1.3.21)
13
13
  activerecord (>= 2.2)
14
- activerecord-jdbcpostgresql-adapter (1.3.18)
15
- activerecord-jdbc-adapter (~> 1.3.18)
14
+ activerecord-jdbcpostgresql-adapter (1.3.21)
15
+ activerecord-jdbc-adapter (~> 1.3.21)
16
16
  jdbc-postgres (>= 9.1)
17
- activerecord-jdbcsqlite3-adapter (1.3.18)
18
- activerecord-jdbc-adapter (~> 1.3.18)
17
+ activerecord-jdbcsqlite3-adapter (1.3.21)
18
+ activerecord-jdbc-adapter (~> 1.3.21)
19
19
  jdbc-sqlite3 (>= 3.7.2, < 3.9)
20
- activesupport (3.2.22)
20
+ activesupport (3.2.22.5)
21
21
  i18n (~> 0.6, >= 0.6.4)
22
22
  multi_json (~> 1.0)
23
23
  ansi (1.5.0)
@@ -25,26 +25,27 @@ GEM
25
25
  builder (3.0.4)
26
26
  docile (1.1.5)
27
27
  i18n (0.7.0)
28
- jdbc-postgres (9.4.1200)
29
- jdbc-sqlite3 (3.8.10.1)
30
- json (1.8.3-java)
31
- minitest (5.8.0)
32
- minitest-reporters (1.0.19)
28
+ jdbc-postgres (9.4.1206)
29
+ jdbc-sqlite3 (3.8.11.2)
30
+ json (2.0.2)
31
+ json (2.0.2-java)
32
+ minitest (5.10.1)
33
+ minitest-reporters (1.1.13)
33
34
  ansi
34
35
  builder
35
36
  minitest (>= 5.0)
36
37
  ruby-progressbar
37
- multi_json (1.11.2)
38
- pg (0.18.2)
39
- rake (10.4.2)
40
- ruby-progressbar (1.7.5)
41
- simplecov (0.10.0)
38
+ multi_json (1.12.1)
39
+ pg (0.19.0)
40
+ rake (12.0.0)
41
+ ruby-progressbar (1.8.1)
42
+ simplecov (0.12.0)
42
43
  docile (~> 1.1.0)
43
- json (~> 1.8)
44
+ json (>= 1.8, < 3)
44
45
  simplecov-html (~> 0.10.0)
45
46
  simplecov-html (0.10.0)
46
- sqlite3 (1.3.10)
47
- tzinfo (0.3.44)
47
+ sqlite3 (1.3.12)
48
+ tzinfo (0.3.52)
48
49
 
49
50
  PLATFORMS
50
51
  java
@@ -62,4 +63,4 @@ DEPENDENCIES
62
63
  sqlite3
63
64
 
64
65
  BUNDLED WITH
65
- 1.10.6
66
+ 1.13.6
@@ -10,13 +10,13 @@ GEM
10
10
  activesupport (= 4.0.13)
11
11
  arel (~> 4.0.0)
12
12
  activerecord-deprecated_finders (1.0.4)
13
- activerecord-jdbc-adapter (1.3.18)
13
+ activerecord-jdbc-adapter (1.3.21)
14
14
  activerecord (>= 2.2)
15
- activerecord-jdbcpostgresql-adapter (1.3.18)
16
- activerecord-jdbc-adapter (~> 1.3.18)
15
+ activerecord-jdbcpostgresql-adapter (1.3.21)
16
+ activerecord-jdbc-adapter (~> 1.3.21)
17
17
  jdbc-postgres (>= 9.1)
18
- activerecord-jdbcsqlite3-adapter (1.3.18)
19
- activerecord-jdbc-adapter (~> 1.3.18)
18
+ activerecord-jdbcsqlite3-adapter (1.3.21)
19
+ activerecord-jdbc-adapter (~> 1.3.21)
20
20
  jdbc-sqlite3 (>= 3.7.2, < 3.9)
21
21
  activesupport (4.0.13)
22
22
  i18n (~> 0.6, >= 0.6.9)
@@ -28,32 +28,32 @@ GEM
28
28
  arel (4.0.2)
29
29
  builder (3.1.4)
30
30
  docile (1.1.5)
31
- hashie (3.4.2)
31
+ hashie (3.4.6)
32
32
  i18n (0.7.0)
33
- jdbc-postgres (9.4.1200)
34
- jdbc-sqlite3 (3.8.10.1)
35
- json (1.8.3-java)
33
+ jdbc-postgres (9.4.1206)
34
+ jdbc-sqlite3 (3.8.11.2)
35
+ json (2.0.2)
36
+ json (2.0.2-java)
36
37
  minitest (4.7.5)
37
38
  minitest-reporters (0.14.24)
38
39
  ansi
39
40
  builder
40
41
  minitest (>= 2.12, < 5.0)
41
42
  powerbar
42
- multi_json (1.11.2)
43
- pg (0.18.2)
44
- powerbar (1.0.12)
45
- ansi (~> 1.5.0)
43
+ multi_json (1.12.1)
44
+ pg (0.19.0)
45
+ powerbar (1.0.17)
46
46
  hashie (>= 1.1.0)
47
- rake (10.4.2)
48
- simplecov (0.10.0)
47
+ rake (12.0.0)
48
+ simplecov (0.12.0)
49
49
  docile (~> 1.1.0)
50
- json (~> 1.8)
50
+ json (>= 1.8, < 3)
51
51
  simplecov-html (~> 0.10.0)
52
52
  simplecov-html (0.10.0)
53
- sqlite3 (1.3.10)
53
+ sqlite3 (1.3.12)
54
54
  thread_safe (0.3.5)
55
55
  thread_safe (0.3.5-java)
56
- tzinfo (0.3.44)
56
+ tzinfo (0.3.52)
57
57
 
58
58
  PLATFORMS
59
59
  java
@@ -71,4 +71,4 @@ DEPENDENCIES
71
71
  sqlite3
72
72
 
73
73
  BUNDLED WITH
74
- 1.10.6
74
+ 1.13.6
@@ -1,22 +1,22 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activemodel (4.1.12)
5
- activesupport (= 4.1.12)
4
+ activemodel (4.1.16)
5
+ activesupport (= 4.1.16)
6
6
  builder (~> 3.1)
7
- activerecord (4.1.12)
8
- activemodel (= 4.1.12)
9
- activesupport (= 4.1.12)
7
+ activerecord (4.1.16)
8
+ activemodel (= 4.1.16)
9
+ activesupport (= 4.1.16)
10
10
  arel (~> 5.0.0)
11
- activerecord-jdbc-adapter (1.3.18)
11
+ activerecord-jdbc-adapter (1.3.21)
12
12
  activerecord (>= 2.2)
13
- activerecord-jdbcpostgresql-adapter (1.3.18)
14
- activerecord-jdbc-adapter (~> 1.3.18)
13
+ activerecord-jdbcpostgresql-adapter (1.3.21)
14
+ activerecord-jdbc-adapter (~> 1.3.21)
15
15
  jdbc-postgres (>= 9.1)
16
- activerecord-jdbcsqlite3-adapter (1.3.18)
17
- activerecord-jdbc-adapter (~> 1.3.18)
16
+ activerecord-jdbcsqlite3-adapter (1.3.21)
17
+ activerecord-jdbc-adapter (~> 1.3.21)
18
18
  jdbc-sqlite3 (>= 3.7.2, < 3.9)
19
- activesupport (4.1.12)
19
+ activesupport (4.1.16)
20
20
  i18n (~> 0.6, >= 0.6.9)
21
21
  json (~> 1.7, >= 1.7.7)
22
22
  minitest (~> 5.1)
@@ -27,25 +27,25 @@ GEM
27
27
  builder (3.2.2)
28
28
  docile (1.1.5)
29
29
  i18n (0.7.0)
30
- jdbc-postgres (9.4.1200)
31
- jdbc-sqlite3 (3.8.10.1)
30
+ jdbc-postgres (9.4.1206)
31
+ jdbc-sqlite3 (3.8.11.2)
32
32
  json (1.8.3)
33
33
  json (1.8.3-java)
34
- minitest (5.8.0)
35
- minitest-reporters (1.0.19)
34
+ minitest (5.10.1)
35
+ minitest-reporters (1.1.13)
36
36
  ansi
37
37
  builder
38
38
  minitest (>= 5.0)
39
39
  ruby-progressbar
40
- pg (0.18.2)
41
- rake (10.4.2)
42
- ruby-progressbar (1.7.5)
43
- simplecov (0.10.0)
40
+ pg (0.19.0)
41
+ rake (12.0.0)
42
+ ruby-progressbar (1.8.1)
43
+ simplecov (0.12.0)
44
44
  docile (~> 1.1.0)
45
- json (~> 1.8)
45
+ json (>= 1.8, < 3)
46
46
  simplecov-html (~> 0.10.0)
47
47
  simplecov-html (0.10.0)
48
- sqlite3 (1.3.10)
48
+ sqlite3 (1.3.12)
49
49
  thread_safe (0.3.5)
50
50
  thread_safe (0.3.5-java)
51
51
  tzinfo (1.2.2)
@@ -67,4 +67,4 @@ DEPENDENCIES
67
67
  sqlite3
68
68
 
69
69
  BUNDLED WITH
70
- 1.10.6
70
+ 1.13.6
@@ -1,22 +1,22 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activemodel (4.2.3)
5
- activesupport (= 4.2.3)
4
+ activemodel (4.2.7.1)
5
+ activesupport (= 4.2.7.1)
6
6
  builder (~> 3.1)
7
- activerecord (4.2.3)
8
- activemodel (= 4.2.3)
9
- activesupport (= 4.2.3)
7
+ activerecord (4.2.7.1)
8
+ activemodel (= 4.2.7.1)
9
+ activesupport (= 4.2.7.1)
10
10
  arel (~> 6.0)
11
- activerecord-jdbc-adapter (1.3.18)
11
+ activerecord-jdbc-adapter (1.3.21)
12
12
  activerecord (>= 2.2)
13
- activerecord-jdbcpostgresql-adapter (1.3.18)
14
- activerecord-jdbc-adapter (~> 1.3.18)
13
+ activerecord-jdbcpostgresql-adapter (1.3.21)
14
+ activerecord-jdbc-adapter (~> 1.3.21)
15
15
  jdbc-postgres (>= 9.1)
16
- activerecord-jdbcsqlite3-adapter (1.3.18)
17
- activerecord-jdbc-adapter (~> 1.3.18)
16
+ activerecord-jdbcsqlite3-adapter (1.3.21)
17
+ activerecord-jdbc-adapter (~> 1.3.21)
18
18
  jdbc-sqlite3 (>= 3.7.2, < 3.9)
19
- activesupport (4.2.3)
19
+ activesupport (4.2.7.1)
20
20
  i18n (~> 0.7)
21
21
  json (~> 1.7, >= 1.7.7)
22
22
  minitest (~> 5.1)
@@ -27,25 +27,25 @@ GEM
27
27
  builder (3.2.2)
28
28
  docile (1.1.5)
29
29
  i18n (0.7.0)
30
- jdbc-postgres (9.4.1200)
31
- jdbc-sqlite3 (3.8.10.1)
30
+ jdbc-postgres (9.4.1206)
31
+ jdbc-sqlite3 (3.8.11.2)
32
32
  json (1.8.3)
33
33
  json (1.8.3-java)
34
- minitest (5.8.0)
35
- minitest-reporters (1.0.19)
34
+ minitest (5.10.1)
35
+ minitest-reporters (1.1.13)
36
36
  ansi
37
37
  builder
38
38
  minitest (>= 5.0)
39
39
  ruby-progressbar
40
- pg (0.18.2)
41
- rake (10.4.2)
42
- ruby-progressbar (1.7.5)
43
- simplecov (0.10.0)
40
+ pg (0.19.0)
41
+ rake (12.0.0)
42
+ ruby-progressbar (1.8.1)
43
+ simplecov (0.12.0)
44
44
  docile (~> 1.1.0)
45
- json (~> 1.8)
45
+ json (>= 1.8, < 3)
46
46
  simplecov-html (~> 0.10.0)
47
47
  simplecov-html (0.10.0)
48
- sqlite3 (1.3.10)
48
+ sqlite3 (1.3.12)
49
49
  thread_safe (0.3.5)
50
50
  thread_safe (0.3.5-java)
51
51
  tzinfo (1.2.2)
@@ -67,4 +67,4 @@ DEPENDENCIES
67
67
  sqlite3
68
68
 
69
69
  BUNDLED WITH
70
- 1.10.6
70
+ 1.13.6
@@ -0,0 +1,4 @@
1
+ RAILS_5 = true
2
+ eval File.read("#{File.dirname __FILE__}/common.gemfile")
3
+
4
+ gem 'activerecord', '~>5.0.1'
@@ -0,0 +1,78 @@
1
+ GIT
2
+ remote: git://github.com/jruby/activerecord-jdbc-adapter.git
3
+ revision: ee68c1881a9b0ce59f5095cd1999c109bddf6167
4
+ branch: rails-5
5
+ specs:
6
+ activerecord-jdbc-adapter (5.0)
7
+ activerecord (>= 2.2)
8
+ activerecord-jdbcpostgresql-adapter (5.0)
9
+ activerecord-jdbc-adapter (~> 5.0)
10
+ jdbc-postgres (>= 9.1)
11
+ activerecord-jdbcsqlite3-adapter (5.0)
12
+ activerecord-jdbc-adapter (~> 5.0)
13
+ jdbc-sqlite3 (>= 3.7.2, < 3.9)
14
+ jdbc-postgres (9.3.1102)
15
+ jdbc-sqlite3 (3.7.2.1)
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ activemodel (5.0.1)
21
+ activesupport (= 5.0.1)
22
+ activerecord (5.0.1)
23
+ activemodel (= 5.0.1)
24
+ activesupport (= 5.0.1)
25
+ arel (~> 7.0)
26
+ activesupport (5.0.1)
27
+ concurrent-ruby (~> 1.0, >= 1.0.2)
28
+ i18n (~> 0.7)
29
+ minitest (~> 5.1)
30
+ tzinfo (~> 1.1)
31
+ ansi (1.5.0)
32
+ arel (7.1.4)
33
+ builder (3.2.2)
34
+ concurrent-ruby (1.0.3)
35
+ concurrent-ruby (1.0.3-java)
36
+ docile (1.1.5)
37
+ i18n (0.7.0)
38
+ json (2.0.2)
39
+ json (2.0.2-java)
40
+ minitest (5.10.1)
41
+ minitest-reporters (1.1.13)
42
+ ansi
43
+ builder
44
+ minitest (>= 5.0)
45
+ ruby-progressbar
46
+ pg (0.19.0)
47
+ rake (12.0.0)
48
+ ruby-progressbar (1.8.1)
49
+ simplecov (0.12.0)
50
+ docile (~> 1.1.0)
51
+ json (>= 1.8, < 3)
52
+ simplecov-html (~> 0.10.0)
53
+ simplecov-html (0.10.0)
54
+ sqlite3 (1.3.12)
55
+ thread_safe (0.3.5)
56
+ thread_safe (0.3.5-java)
57
+ tzinfo (1.2.2)
58
+ thread_safe (~> 0.1)
59
+
60
+ PLATFORMS
61
+ java
62
+ ruby
63
+
64
+ DEPENDENCIES
65
+ activerecord (~> 5.0.1)
66
+ activerecord-jdbc-adapter!
67
+ activerecord-jdbcpostgresql-adapter!
68
+ activerecord-jdbcsqlite3-adapter!
69
+ jdbc-postgres!
70
+ jdbc-sqlite3!
71
+ minitest-reporters
72
+ pg
73
+ rake
74
+ simplecov
75
+ sqlite3
76
+
77
+ BUNDLED WITH
78
+ 1.13.6
@@ -1,9 +1,17 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  platform :jruby do
4
- gem 'activerecord-jdbc-adapter'
5
- gem 'activerecord-jdbcpostgresql-adapter'
6
- gem 'activerecord-jdbcsqlite3-adapter'
4
+ if defined?(RAILS_5)
5
+ gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
6
+ gem 'activerecord-jdbcpostgresql-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
7
+ gem 'activerecord-jdbcsqlite3-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
8
+ gem 'jdbc-postgres', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
9
+ gem 'jdbc-sqlite3', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
10
+ else
11
+ gem 'activerecord-jdbc-adapter'
12
+ gem 'activerecord-jdbcpostgresql-adapter'
13
+ gem 'activerecord-jdbcsqlite3-adapter'
14
+ end
7
15
  end
8
16
 
9
17
  platform :ruby do
@@ -3,12 +3,15 @@ require 'active_record/version'
3
3
  require 'time_of_day'
4
4
  # TODO(uwe): Simplify when we stop supporting ActiveRecord 3.2
5
5
  if ActiveRecord::VERSION::MAJOR < 3 ||
6
- (ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR < 2)
6
+ (ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR < 2)
7
7
  raise 'activerecord-time only supports ActiveRecord 3.2.21 or later'
8
8
  # TODO(uwe): Simplify when we stop supporting ActiveRecord 4.0 and 4.1
9
9
  elsif ActiveRecord::VERSION::MAJOR == 3 ||
10
- (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR <= 1)
10
+ (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR <= 1)
11
11
  require 'activerecord-time/extension_until_4_1'
12
- elsif ActiveRecord.gem_version >= Gem::Version.new('4.2.0')
12
+ # TODO(uwe): Simplify when we stop supporting ActiveRecord 4.2
13
+ elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 2
13
14
  require 'activerecord-time/extension_4_2'
15
+ elsif ActiveRecord.gem_version >= Gem::Version.new('5.0.0')
16
+ require 'activerecord-time/extension_5_0'
14
17
  end
@@ -2,20 +2,23 @@ module ActiveRecord
2
2
  module ConnectionAdapters
3
3
  module Quoting
4
4
  def _quote_with_time_of_day(value)
5
- return "'#{value}'" if TimeOfDay === value
5
+ return "'#{value}'" if value.is_a?(TimeOfDay)
6
6
  _quote_without_time_of_day(value)
7
7
  end
8
8
  alias_method_chain :_quote, :time_of_day
9
9
  def _type_cast_with_time_of_day(value)
10
- return value.to_s if TimeOfDay === value
10
+ return value.to_s if value.is_a?(TimeOfDay)
11
11
  _type_cast_without_time_of_day(value)
12
12
  end
13
13
  alias_method_chain :_type_cast, :time_of_day
14
14
  end
15
15
  end
16
- module Type
17
- class Time < Value # :nodoc:
16
+ end
17
+ module Activerecord
18
+ module Time
19
+ module TypeCast
18
20
  private
21
+
19
22
  def cast_value(value)
20
23
  return value.time_of_day if value.is_a?(::DateTime) || value.is_a?(::Time)
21
24
  return value unless value.is_a?(::String)
@@ -25,3 +28,4 @@ module ActiveRecord
25
28
  end
26
29
  end
27
30
  end
31
+ ActiveRecord::Type::Time.prepend Activerecord::Time::TypeCast
@@ -0,0 +1,33 @@
1
+ require 'active_record/connection_adapters/abstract/quoting'
2
+
3
+ module Activerecord
4
+ module Time
5
+ module Quoting
6
+ def _quote(value)
7
+ return "'#{value}'" if value.is_a?(TimeOfDay)
8
+ super(value)
9
+ end
10
+
11
+ def _type_cast(value)
12
+ return value.to_s if value.is_a?(TimeOfDay)
13
+ super(value)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ # ActiveRecord::ConnectionAdapters::Quoting.prepend Activerecord::Time::Quoting
20
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend Activerecord::Time::Quoting
21
+
22
+ module ActiveRecord
23
+ module Type
24
+ class Time < ActiveModel::Type::Time # :nodoc:
25
+ private def cast_value(value)
26
+ return value.time_of_day if value.is_a?(::DateTime) || value.is_a?(::Time)
27
+ return value unless value.is_a?(::String)
28
+ return if value.empty?
29
+ TimeOfDay.parse value
30
+ end
31
+ end
32
+ end
33
+ end
@@ -2,48 +2,64 @@ require 'active_record/connection_adapters/abstract/quoting'
2
2
 
3
3
  module ActiveRecord
4
4
  module ConnectionAdapters
5
- class Column
6
- def klass_with_time_of_day
7
- return TimeOfDay if :time === type
8
- klass_without_time_of_day
9
- end
10
-
11
- alias_method_chain :klass, :time_of_day
12
-
13
- def self.string_to_dummy_time(string)
14
- return string if string.is_a? TimeOfDay
15
- return string.time_of_day if string.is_a? ::Time
16
- return nil if string.empty?
17
- TimeOfDay.parse(string)
18
- end
19
- end
20
5
  module Quoting
21
6
  def quote_with_time_of_day(value, column = nil)
22
- if column && column.type == :time && Integer === value
7
+ if column && column.type == :time && value.is_a?(Integer)
23
8
  value = TimeOfDay.new(value / 3600, (value % 3600) / 60, value % 60)
24
9
  end
25
- return "'#{value.to_s(:db)}'" if TimeOfDay === value
10
+ return "'#{value.to_s(:db)}'" if value.is_a?(TimeOfDay)
26
11
  quote_without_time_of_day(value, column)
27
12
  end
13
+
28
14
  alias_method_chain :quote, :time_of_day
15
+
29
16
  def type_cast_with_time_of_day(value, column)
30
- return value.to_s if TimeOfDay === value
17
+ return value.to_s if value.is_a?(TimeOfDay)
31
18
  type_cast_without_time_of_day(value, column)
32
19
  end
20
+
33
21
  alias_method_chain :type_cast, :time_of_day
34
22
  end
35
23
  end
36
24
  end
37
25
 
26
+ module Activerecord
27
+ module Time
28
+ module DummyTime
29
+ def klass
30
+ return TimeOfDay if :time == type
31
+ super
32
+ end
33
+
34
+ module ClassMethods
35
+ def string_to_dummy_time(value)
36
+ return value if value.is_a? TimeOfDay
37
+ return value.time_of_day if value.is_a? ::Time
38
+ return nil if value.empty?
39
+ TimeOfDay.parse(value)
40
+ end
41
+ end
42
+
43
+ def self.prepended(base)
44
+ class << base
45
+ prepend ClassMethods
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ ActiveRecord::ConnectionAdapters::Column.prepend Activerecord::Time::DummyTime
53
+
38
54
  module Arel
39
55
  module Visitors
40
- class Arel::Visitors::Visitor
56
+ class Visitor
41
57
  if Gem::Version.new(Arel::VERSION) >= Gem::Version.new('5.0.0')
42
- def visit_TimeOfDay o, a
58
+ def visit_TimeOfDay(o, _a) # rubocop: disable Style/MethodName
43
59
  "'#{o.to_s(:db)}'"
44
60
  end
45
61
  else
46
- def visit_TimeOfDay o
62
+ def visit_TimeOfDay(o) # rubocop: disable Style/MethodName
47
63
  "'#{o.to_s(:db)}'"
48
64
  end
49
65
  end
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module Time
3
- VERSION = '0.6.1'
3
+ VERSION = '0.7.0'.freeze
4
4
  end
5
5
  end
data/lib/time_of_day.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
 
3
+ # rubocop: disable Rails/TimeZone, Rails/Date
3
4
  class TimeOfDay
4
5
  attr_accessor :hour # 0 - 23
5
6
  attr_accessor :minute # 0 - 59
@@ -17,35 +18,40 @@ class TimeOfDay
17
18
  initialize(*parts)
18
19
  end
19
20
 
21
+ def encode_with(coder)
22
+ coder.tag = 'tag:yaml.org,2002:time'
23
+ coder.scalar = to_s
24
+ end
25
+
20
26
  def self.now
21
27
  Time.now.time_of_day
22
28
  end
23
29
 
24
30
  def self.parse(string)
25
31
  return nil if string.blank?
26
- self.new(*parse_parts(string))
32
+ new(*parse_parts(string))
27
33
  end
28
34
 
29
35
  def self.parse_parts(string)
30
36
  string = string.strip
31
37
  raise "Illegal time format: '#{string}'" unless string =~ /^(\d{1,2}):?(\d{2})?(?::(\d{1,2}))?$/
32
- [$1.to_i, $2.to_i, $3.to_i]
38
+ [Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, Regexp.last_match(3).to_i]
33
39
  end
34
40
 
35
41
  def on(date)
36
42
  Time.local(date.year, date.month, date.day, hour, minute, second)
37
43
  end
38
44
 
39
- def +(seconds)
40
- raise "Illegal argument: #{seconds.inspect}" unless seconds.is_a? Numeric
45
+ def +(other)
46
+ raise "Illegal argument: #{other.inspect}" unless other.is_a? Numeric
41
47
  t = Time.local(0, 1, 1, hour, minute, second)
42
- t += seconds
48
+ t += other
43
49
  self.class.new(t.hour, t.min, t.sec)
44
50
  end
45
51
 
46
- def -(seconds)
47
- raise "Illegal argument: #{seconds.inspect}" unless seconds.is_a? Numeric
48
- self.+(-seconds)
52
+ def -(other)
53
+ raise "Illegal argument: #{other.inspect}" unless other.is_a? Numeric
54
+ self.+(-other)
49
55
  end
50
56
 
51
57
  def <=>(other)
@@ -89,23 +95,15 @@ class TimeOfDay
89
95
  end
90
96
  end
91
97
 
92
- def to_yaml(opts = {})
93
- YAML::quick_emit(nil, opts) do |out|
94
- out.scalar('tag:yaml.org,2002:time', self.to_s, :plain)
95
- end
96
- end
97
-
98
98
  def to_json(*)
99
- %{"#{to_s}"}
99
+ %("#{self}")
100
100
  end
101
-
102
101
  end
103
102
 
104
103
  class Time
105
104
  def time_of_day
106
105
  TimeOfDay.new(hour, min, sec)
107
106
  end
108
-
109
107
  end
110
108
 
111
109
  class Date
@@ -113,11 +111,10 @@ class Date
113
111
  time_of_day = TimeOfDay.parse(time_of_day) if time_of_day.is_a?(String)
114
112
  Time.local(year, month, day, time_of_day.hour, time_of_day.minute, time_of_day.second)
115
113
  end
116
-
117
114
  end
118
115
 
119
116
  module Kernel
120
- def TimeOfDay(string_or_int, *ints)
117
+ def TimeOfDay(string_or_int, *ints) # rubocop: disable Style/MethodName
121
118
  if string_or_int.is_a? String
122
119
  raise(ArgumentError, 'TimeOfDay() takes a string or multiple integers as arguments') unless ints.empty?
123
120
  TimeOfDay.parse(string_or_int)
data/matrix_test.rb CHANGED
@@ -1,33 +1,43 @@
1
1
  #!/usr/bin/env ruby -w
2
2
 
3
+ system('rubocop --auto-correct') || exit(1)
4
+
5
+ update_gemfiles = ARGV.delete('--update')
6
+
3
7
  require 'yaml'
4
8
  travis = YAML.load(File.read('.travis.yml'))
5
9
 
6
10
  travis['rvm'].each do |ruby|
11
+ next if ruby =~ /head/
7
12
  puts '#' * 80
8
13
  puts "Testing #{ruby}"
9
14
  puts
10
- system "rvm install #{ruby}"
11
- exit $? unless $? == 0
12
- system "rvm #{ruby} do gem query -i -n bundler >/dev/null || gem install bundler"
13
- exit $? unless $? == 0
15
+ system "ruby-install --no-reinstall #{ruby}" || exit(1)
16
+ bundler_gem_check_cmd = "chruby-exec #{ruby} -- gem query -i -n bundler >/dev/null"
17
+ system "#{bundler_gem_check_cmd} || chruby-exec #{ruby} -- gem install bundler" || exit(1)
14
18
  travis['gemfile'].each do |gemfile|
19
+ if travis['matrix']['exclude'].any? { |f| f['rvm'] == ruby && f['gemfile'] == gemfile }
20
+ puts 'Skipping known failure.'
21
+ next
22
+ end
15
23
  puts '$' * 80
16
24
  puts "Testing #{gemfile}"
17
25
  puts
18
26
  ENV['BUNDLE_GEMFILE'] = gemfile
19
- system "rvm #{ruby} do bundle install"
20
- exit $?.exitstatus unless $? == 0
27
+ if update_gemfiles
28
+ system "chruby-exec #{ruby} -- bundle update"
29
+ else
30
+ system "chruby-exec #{ruby} -- bundle check || chruby-exec #{ruby} -- bundle install"
31
+ end || exit(1)
21
32
  travis['env'].each do |env|
22
- env.scan(/\b(?<key>[A-Z_]+)="?(?<value>.+?)"?\b/) do |key, value|
33
+ env.scan(/\b(?<key>[A-Z_]+)="(?<value>.+?)"/) do |key, value|
23
34
  ENV[key] = value
24
- puts '*' * 80
25
- puts "Testing #{ruby} #{gemfile} #{env}"
26
- puts
27
- system "rvm #{ruby} do bundle exec rake"
28
- exit $? unless $? == 0
29
- puts '*' * 80
30
35
  end
36
+ puts '*' * 80
37
+ puts "Testing #{ruby} #{gemfile} #{env}"
38
+ puts
39
+ system "chruby-exec #{ruby} -- bundle exec rake" || exit(1)
40
+ puts '*' * 80
31
41
  end
32
42
  puts "Testing #{gemfile} OK"
33
43
  puts '$' * 80
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
2
2
  RAILS_ROOT = File.dirname(__FILE__)
3
3
 
4
4
  require 'rubygems'
@@ -17,20 +17,20 @@ require 'simplecov'
17
17
  SimpleCov.start
18
18
 
19
19
  FileUtils.rm_rf File.expand_path(':memory:', File.dirname(__FILE__))
20
- config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
20
+ config = YAML.load(IO.read(File.dirname(__FILE__) + '/database.yml'))
21
21
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/test.log')
22
22
  db = ENV['DB'] || 'sqlite3'
23
23
  if db != 'sqlite3'
24
24
  ActiveRecord::Base.establish_connection config[db].merge(database: nil)
25
25
  begin
26
26
  ActiveRecord::Base.connection.drop_database config[db][:database]
27
- rescue
28
- puts $!
27
+ rescue => e
28
+ puts e
29
29
  end
30
30
  begin
31
31
  ActiveRecord::Base.connection.create_database config[db][:database], charset: 'utf8'
32
- rescue
33
- puts $!
32
+ rescue => e
33
+ puts e
34
34
  end
35
35
  end
36
36
  ActiveRecord::Base.establish_connection config[db]
@@ -4,7 +4,7 @@ class Event < ActiveRecord::Base
4
4
  end
5
5
 
6
6
  # TODO(uwe): Remove when we stop testing ActiveRecord 4.0
7
- MiniTest::Test = Minitest::Unit unless defined? Minitest::Test
7
+ Minitest::Test = Minitest::Unit unless defined? Minitest::Test
8
8
  # ODOT
9
9
 
10
10
  class TimeOfDayTest < Minitest::Test
@@ -80,11 +80,11 @@ class TimeOfDayTest < Minitest::Test
80
80
 
81
81
  def test_yaml_load
82
82
  hash = YAML.load('start_at: !!time 12:34:56')
83
- assert_equal({'start_at' => TimeOfDay.parse('12:34:56')}, hash)
83
+ assert_equal({ 'start_at' => TimeOfDay.parse('12:34:56') }, hash)
84
84
  end
85
85
 
86
86
  def test_yaml_dump
87
- string = YAML.dump({'start_at' => TimeOfDay.parse('12:34:56')})
87
+ string = YAML.dump('start_at' => TimeOfDay.parse('12:34:56'))
88
88
  assert_match(/---\nstart_at: !!time '?12:34:56'?\n/, string)
89
89
  end
90
90
 
@@ -93,10 +93,10 @@ class TimeOfDayTest < Minitest::Test
93
93
  end
94
94
 
95
95
  def test_activerecord
96
- Event.create! :name => 'Bored meeting', :start_at => @twelve_o_clock
97
- t = Event.where(:start_at => '12:00:00').first
96
+ Event.create! name: 'Bored meeting', start_at: @twelve_o_clock
97
+ t = Event.where(start_at: '12:00:00').first
98
98
  assert_equal TimeOfDay, t.start_at.class
99
- assert_equal t, Event.where(:start_at => @twelve_o_clock).first
99
+ assert_equal t, Event.where(start_at: @twelve_o_clock).first
100
100
  assert_equal t, Event.where('start_at = ?', @twelve_o_clock).first
101
101
  assert_equal t, Event.where('start_at >= ?', @twelve_o_clock).first
102
102
  assert_equal t, Event.where('start_at <= ?', @twelve_o_clock).first
@@ -106,9 +106,9 @@ class TimeOfDayTest < Minitest::Test
106
106
 
107
107
  # TODO(uwe): Simplify when we stop supporting ActiveRecord 3
108
108
  if ActiveRecord::VERSION::MAJOR >= 4
109
- t.update! :start_at => TimeOfDay.new(13)
109
+ t.update! start_at: TimeOfDay.new(13)
110
110
  else
111
- t.update_attributes! :start_at => TimeOfDay.new(13)
111
+ t.update_attributes! start_at: TimeOfDay.new(13)
112
112
  end
113
113
  # ODOT
114
114
 
@@ -117,15 +117,15 @@ class TimeOfDayTest < Minitest::Test
117
117
 
118
118
  def test_activerecord_binary_column
119
119
  text = 'Some binary content'
120
- Event.create! :content => text
121
- e = Event.where(:content => text).first
120
+ Event.create! content: text
121
+ e = Event.where(content: text).first
122
122
  assert_equal text, e.content
123
123
 
124
124
  # TODO(uwe): Simplify when we stop supporting ActiveRecord 3
125
125
  if ActiveRecord::VERSION::MAJOR >= 4
126
- e.update! :content => 'Other binary content'
126
+ e.update! content: 'Other binary content'
127
127
  else
128
- e.update_attributes! :content => 'Other binary content'
128
+ e.update_attributes! content: 'Other binary content'
129
129
  end
130
130
  # ODOT
131
131
  end
@@ -166,7 +166,7 @@ class TimeOfDayTest < Minitest::Test
166
166
  tod2 = TimeOfDay.new(13, 0)
167
167
  assert_equal(-1, tod1 <=> tod2)
168
168
  assert_equal 1, tod2 <=> tod1
169
- assert_equal 0, tod1 <=> tod1
169
+ assert_equal 0, tod1 <=> tod1 # rubocop: disable Lint/UselessComparison
170
170
  end
171
171
 
172
172
  def test_strftime
@@ -211,6 +211,6 @@ class TimeOfDayTest < Minitest::Test
211
211
 
212
212
  def test_to_json
213
213
  tod = TimeOfDay.new(12, 13)
214
- assert_equal "\"12:13:00\"", tod.to_json('foo')
214
+ assert_equal '"12:13:00"', tod.to_json('foo')
215
215
  end
216
216
  end
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.6.1
4
+ version: 0.7.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: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.2.21
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 5.0.0
22
+ version: '5.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.2.21
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 5.0.0
32
+ version: '5.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pg
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: simplecov
91
105
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +123,8 @@ extensions: []
109
123
  extra_rdoc_files: []
110
124
  files:
111
125
  - ".gitignore"
126
+ - ".rubocop.yml"
127
+ - ".rubocop_todo.yml"
112
128
  - ".travis.yml"
113
129
  - Gemfile
114
130
  - LICENSE
@@ -124,9 +140,12 @@ files:
124
140
  - gemfiles/ar41.gemfile.lock
125
141
  - gemfiles/ar42.gemfile
126
142
  - gemfiles/ar42.gemfile.lock
143
+ - gemfiles/ar50.gemfile
144
+ - gemfiles/ar50.gemfile.lock
127
145
  - gemfiles/common.gemfile
128
146
  - lib/activerecord-time.rb
129
147
  - lib/activerecord-time/extension_4_2.rb
148
+ - lib/activerecord-time/extension_5_0.rb
130
149
  - lib/activerecord-time/extension_until_4_1.rb
131
150
  - lib/activerecord-time/version.rb
132
151
  - lib/time_of_day.rb