jsonb_accessor 1.3.10-java → 1.4-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61fa514ba532ab6dc613d5f1e13ac2bb6731714694990e5377ec1501e6357e01
4
- data.tar.gz: c37757deac5de852ace762f7d135db62124ee9d9a842445156611d1f577ebf03
3
+ metadata.gz: 35b19c75fe9615c62f23f463cc888eec8e9bce7e04b8719d72dcd424e48976df
4
+ data.tar.gz: 982e7853f817ff89c6db7a17fffe55733f536f0fe2b9d24cedb2bcfe4a90d532
5
5
  SHA512:
6
- metadata.gz: fb68c0714bed5224e145321aae128e5d0c7e9330dc4aee97c04d42a0fe5c11018d5bdd788bbb541af35900d3077459675484c3bc878920c9afdd9bb51778d2f3
7
- data.tar.gz: d069cfe296853335a7038068d891360a919d119fe4bc273498e4736b14129eb2595a9b3e8dbfd14e7fe8860482771fbc09ffc6d00984ecd973f5aaba0cd8ba43
6
+ metadata.gz: af53d7db74992093da6869c3d430ee098b3cb12987d87f5459dc85af3c4fa20fd492065bba0b737e983609a0ccda3d524c01f568c1e502ab555c5a1db0b31c7e
7
+ data.tar.gz: 21a9997db6d4b21ec4ef737835f1a8f4630ab31fd89b3a29b9905c93ef7e79df354fdabea63648fe4cfe1b2420c3689c2d594a0fdb83ff3b3efaeb8ca9c67353
@@ -24,7 +24,7 @@ jobs:
24
24
  needs: lint
25
25
  services:
26
26
  db:
27
- image: postgres:9.4
27
+ image: postgres
28
28
  env:
29
29
  POSTGRES_HOST_AUTH_METHOD: trust
30
30
  POSTGRES_DB: jsonb_accessor
@@ -36,99 +36,40 @@ jobs:
36
36
  fail-fast: false
37
37
  matrix:
38
38
  include:
39
- - gemfile: activerecord_5.0.0
40
- ruby: '2.4'
41
-
42
- - gemfile: activerecord_5.1.0
43
- ruby: '2.4'
44
-
45
- - gemfile: activerecord_5.2.0
46
- ruby: '2.4'
47
-
48
- - gemfile: activerecord_5.0.0
49
- ruby: '2.5'
50
-
51
- - gemfile: activerecord_5.1.0
52
- ruby: '2.5'
53
-
54
- - gemfile: activerecord_5.2.0
55
- ruby: '2.5'
56
-
57
- - gemfile: activerecord_6.0.0
58
- ruby: '2.5'
59
-
60
- - gemfile: activerecord_6.1.0
61
- ruby: '2.5'
62
-
63
- - gemfile: activerecord_5.0.0
64
- ruby: '2.6'
65
-
66
- - gemfile: activerecord_5.1.0
67
- ruby: '2.6'
68
-
69
- - gemfile: activerecord_5.2.0
70
- ruby: '2.6'
71
-
72
- - gemfile: activerecord_6.0.0
73
- ruby: '2.6'
74
-
75
- - gemfile: activerecord_6.1.0
76
- ruby: '2.6'
77
-
78
- - gemfile: activerecord_5.0.0
79
- ruby: '2.7'
80
-
81
- - gemfile: activerecord_5.1.0
82
- ruby: '2.7'
83
-
84
- - gemfile: activerecord_5.2.0
85
- ruby: '2.7'
86
-
87
- - gemfile: activerecord_6.0.0
88
- ruby: '2.7'
89
-
90
- - gemfile: activerecord_6.1.0
91
- ruby: '2.7'
92
-
93
- - gemfile: activerecord_7.0.1
94
- ruby: '2.7'
95
-
96
- - gemfile: activerecord_6.1.0
39
+ - gemfile: activerecord_6.1
97
40
  ruby: '3.0'
98
41
 
99
- - gemfile: activerecord_6.1.0
42
+ - gemfile: activerecord_6.1
100
43
  ruby: '3.1'
101
44
 
102
- - gemfile: activerecord_6.1.0
45
+ - gemfile: activerecord_6.1
103
46
  ruby: '3.2'
104
47
 
105
- - gemfile: activerecord_7.0.1
48
+ - gemfile: activerecord_7.0
106
49
  ruby: '3.0'
107
50
 
108
- - gemfile: activerecord_7.0.1
51
+ - gemfile: activerecord_7.0
109
52
  ruby: '3.1'
110
53
 
111
- - gemfile: activerecord_7.0.1
54
+ - gemfile: activerecord_7.0
112
55
  ruby: '3.2'
113
56
 
114
- - gemfile: activerecord_5.1.0
115
- ruby: 'jruby-9.3'
116
-
117
- - gemfile: activerecord_5.2.0
118
- ruby: 'jruby-9.3'
57
+ - gemfile: activerecord_7.1
58
+ ruby: '3.0'
119
59
 
120
- - gemfile: activerecord_6.0.0
121
- ruby: 'jruby-9.3'
60
+ - gemfile: activerecord_7.1
61
+ ruby: '3.1'
122
62
 
123
- - gemfile: activerecord_6.1.0
124
- ruby: 'jruby-9.3'
63
+ - gemfile: activerecord_7.1
64
+ ruby: '3.2'
125
65
 
126
- # waiting for https://github.com/jruby/activerecord-jdbc-adapter/issues/1125 to be addressed
127
- # - gemfile: activerecord_7.0.1
128
- # ruby: 'jruby-9.4'
66
+ - gemfile: activerecord_7.0
67
+ ruby: 'jruby-9.4'
129
68
 
130
69
  name: ${{ matrix.gemfile }}, ruby ${{ matrix.ruby }}
131
70
 
71
+ env:
72
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
132
73
  steps:
133
74
  - uses: actions/checkout@v3
134
75
 
@@ -140,8 +81,7 @@ jobs:
140
81
 
141
82
  - name: Bundle install
142
83
  run: |
143
- bundle config set gemfile "${GITHUB_WORKSPACE}/gemfiles/${{ matrix.gemfile }}.gemfile"
144
- bundle install --jobs 4 --retry 3
84
+ bundle install
145
85
 
146
86
  - name: Setup DB
147
87
  run: |
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 3.2.2
data/Appraisals CHANGED
@@ -1,25 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "activerecord-5.0.0" do
4
- gem "activerecord", "~> 5.0.0"
5
- end
6
-
7
- appraise "activerecord-5.1.0" do
8
- gem "activerecord", "~> 5.1.3"
9
- end
10
-
11
- appraise "activerecord-5.2.0" do
12
- gem "activerecord", "~> 5.2.8"
13
- end
14
-
15
- appraise "activerecord-6.0.0" do
16
- gem "activerecord", "~> 6.0.6"
3
+ appraise "activerecord-6.1" do
4
+ gem "activerecord", "~> 6.1"
17
5
  end
18
6
 
19
- appraise "activerecord-6.1.0" do
20
- gem "activerecord", "~> 6.1"
7
+ appraise "activerecord-7.0" do
8
+ gem "activerecord", "~> 7.0.8"
21
9
  end
22
10
 
23
- appraise "activerecord-7.0.1" do
24
- gem "activerecord", "~> 7.0.1"
11
+ appraise "activerecord-7.1" do
12
+ gem "activerecord", "~> 7.1"
25
13
  end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,25 @@
1
1
  # Changelog
2
2
  ## [Unreleased]
3
3
 
4
+ ## [1.4] - 2023-10-15
5
+ ### Breaking change
6
+ - `jsonb_accessor` dropped support for Ruby 2 and Rails versions lower than 6.1. Support for ActiveRecord::Enum was also
7
+ dropped because ActiveRecord 7.1 now requires each enum field to be backed by a database column. Enums will still work
8
+ when using AR versions lower than 7.1. This is a limitation of Rails, not of this gem.
9
+
10
+ ### Fixed
11
+
12
+ - Bug fix: An array of datetimes previously caused an error. https://github.com/madeintandem/jsonb_accessor/pull/169. Thanks @bekicot.
13
+ - Rails 7.1 is officially supported and tested against.
14
+
15
+ ## [1.3.10] - 2023-05-30
16
+ ### No changes
17
+ A new release was necessary to fix the corrupted 1.3.9 Java release on RubyGems.
18
+
19
+ ## [1.3.9] - 2023-05-30
20
+ ### No changes
21
+ A new release was necessary to fix the corrupted 1.3.8 Java release on RubyGems.
22
+
4
23
  ## [1.3.8] - 2023-05-29
5
24
  ### Fixes
6
25
 
data/Dockerfile CHANGED
@@ -8,5 +8,5 @@ WORKDIR /usr/src/app
8
8
 
9
9
  COPY lib/jsonb_accessor/version.rb ./lib/jsonb_accessor/version.rb
10
10
  COPY jsonb_accessor.gemspec Gemfile ./
11
- # RUN bundle install
11
+ RUN bundle install
12
12
  COPY . ./
data/Makefile ADDED
@@ -0,0 +1,7 @@
1
+ build-gem:
2
+ @docker build --build-arg RUBY_PLATFORM=ruby --build-arg RUBY_VERSION=3.2.2 -t jsonb_accessor-ruby:3.2.2 .
3
+ @docker run --rm -v $(PWD):/usr/src/app -w /usr/src/app jsonb_accessor-ruby:3.2.2 gem build
4
+
5
+ build-gem-java:
6
+ @docker build --build-arg RUBY_PLATFORM=jruby --build-arg RUBY_VERSION=9.4.2-jdk -t jsonb_accessor-jruby:9.4.2-jdk .
7
+ @docker run --rm -v $(PWD):/usr/src/app -w /usr/src/app jsonb_accessor-jruby:9.4.2-jdk gem build --platform java
data/README.md CHANGED
@@ -318,7 +318,8 @@ Because this gem promotes attributes nested into the JSON column to first level
318
318
 
319
319
  ## Dependencies
320
320
 
321
- - ActiveRecord >= 5.0
321
+ - Ruby > 3. Lower versions are not tested.
322
+ - ActiveRecord >= 6.1
322
323
  - Postgres >= 9.4 (in order to use the [jsonb column type](http://www.postgresql.org/docs/9.4/static/datatype-json.html)).
323
324
 
324
325
  ## Upgrading
data/bin/console CHANGED
@@ -7,7 +7,7 @@ require "rspec"
7
7
  require File.expand_path("../spec/spec_helper.rb", __dir__)
8
8
 
9
9
  dbconfig = YAML.safe_load(ERB.new(File.read(File.join("db", "config.yml"))).result, aliases: true)
10
- ActiveRecord::Base.establish_connection(dbconfig["development"])
10
+ ActiveRecord::Base.establish_connection(dbconfig["test"])
11
11
 
12
12
  # rubocop:disable Lint/UselessAssignment
13
13
  x = Product.new
data/db/config.yml CHANGED
@@ -2,7 +2,7 @@ default: &default
2
2
  adapter: postgresql
3
3
  database: jsonb_accessor
4
4
  host: <%= ENV.fetch("DATABASE_HOST") { "127.0.0.1" } %>
5
- user: postgres
5
+ username: <%= ENV.fetch("DATABASE_USER") { "postgres" } %>
6
6
 
7
7
  test:
8
8
  <<: *default
data/db/schema.rb CHANGED
@@ -1,18 +1,16 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file is auto-generated from the current state of the database. Instead
4
2
  # of editing this file, please use the migrations feature of Active Record to
5
3
  # incrementally modify your database, and then regenerate this schema definition.
6
4
  #
7
- # Note that this schema.rb definition is the authoritative source for your
8
- # database schema. If you need to create the application database on another
9
- # system, you should be using db:schema:load, not running all the migrations
10
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
11
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
12
10
  #
13
11
  # It's strongly recommended that you check this file into your version control system.
14
12
 
15
- ActiveRecord::Schema.define(version: 20_150_407_031_737) do
13
+ ActiveRecord::Schema.define(version: 2015_04_07_031737) do
16
14
  # These are extensions that must be enabled in order to support this database
17
15
  enable_extension "plpgsql"
18
16
 
@@ -30,7 +28,8 @@ ActiveRecord::Schema.define(version: 20_150_407_031_737) do
30
28
  t.float "float_type"
31
29
  t.time "time_type"
32
30
  t.date "date_type"
33
- t.datetime "datetime_type"
31
+ t.datetime "datetime_type", precision: nil
34
32
  t.decimal "decimal_type"
35
33
  end
34
+
36
35
  end
data/docker-compose.yml CHANGED
@@ -16,7 +16,7 @@ services:
16
16
 
17
17
 
18
18
  postgres:
19
- image: postgres:12
19
+ image: postgres
20
20
  environment:
21
21
  - POSTGRES_HOST_AUTH_METHOD=trust
22
22
  - POSTGRES_DB=jsonb_accessor
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 5.0.0"
5
+ gem "activerecord", "~> 7.0.8"
6
6
 
7
7
  gemspec path: "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 5.1.3"
5
+ gem "activerecord", "~> 7.1"
6
6
 
7
7
  gemspec path: "../"
@@ -17,24 +17,24 @@ Gem::Specification.new do |spec|
17
17
  spec.description = "Adds typed jsonb backed fields to your ActiveRecord models."
18
18
  spec.homepage = "https://github.com/devmynd/jsonb_accessor"
19
19
  spec.license = "MIT"
20
- spec.required_ruby_version = ">= 2"
20
+ spec.required_ruby_version = ">= 3"
21
21
 
22
22
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) || f.match(/png\z/) }
23
23
  spec.bindir = "exe"
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "activerecord", ">= 5.0"
28
- spec.add_dependency "activesupport", ">= 5.0"
27
+ spec.add_dependency "activerecord", ">= 6.1"
28
+ spec.add_dependency "activesupport", ">= 6.1"
29
29
  if is_java
30
30
  spec.add_dependency "activerecord-jdbcpostgresql-adapter", ">= 50.0"
31
31
  else
32
32
  spec.add_dependency "pg", ">= 0.18.1"
33
33
  end
34
34
 
35
- spec.add_development_dependency "appraisal", "~> 2.2.0"
35
+ spec.add_development_dependency "appraisal", "~> 2.5"
36
36
  spec.add_development_dependency "awesome_print"
37
- spec.add_development_dependency "database_cleaner", "~> 1.6.0"
37
+ spec.add_development_dependency "database_cleaner-active_record", "~> 2.1"
38
38
  spec.add_development_dependency "pry"
39
39
  spec.add_development_dependency "pry-doc"
40
40
  spec.add_development_dependency "pry-nav"
@@ -24,14 +24,23 @@ module JsonbAccessor
24
24
  return value if value.blank?
25
25
 
26
26
  if attribute_type == :datetime
27
- value = if active_record_default_timezone == :utc
28
- Time.find_zone("UTC").parse(value).in_time_zone
27
+ value = if value.is_a?(Array)
28
+ value.map { |v| parse_date(v) }
29
29
  else
30
- Time.zone.parse(value)
30
+ parse_date(value)
31
31
  end
32
32
  end
33
33
 
34
34
  value
35
35
  end
36
+
37
+ # Parse datetime based on the configured default_timezone
38
+ def parse_date(datetime)
39
+ if active_record_default_timezone == :utc
40
+ Time.find_zone("UTC").parse(datetime).in_time_zone
41
+ else
42
+ Time.zone.parse(datetime)
43
+ end
44
+ end
36
45
  end
37
46
  end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonbAccessor
4
- VERSION = "1.3.10"
4
+ VERSION = "1.4"
5
+
6
+ def self.enum_support?
7
+ # From AR 7.1 on, enums require a database column.
8
+ Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new("7.1")
9
+ end
5
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonb_accessor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: '1.4'
5
5
  platform: java
6
6
  authors:
7
7
  - Michael Crismali
@@ -10,14 +10,14 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-05-30 00:00:00.000000000 Z
13
+ date: 2023-10-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.0'
20
+ version: '6.1'
21
21
  name: activerecord
22
22
  prerelease: false
23
23
  type: :runtime
@@ -25,13 +25,13 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '5.0'
28
+ version: '6.1'
29
29
  - !ruby/object:Gem::Dependency
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '5.0'
34
+ version: '6.1'
35
35
  name: activesupport
36
36
  prerelease: false
37
37
  type: :runtime
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '5.0'
42
+ version: '6.1'
43
43
  - !ruby/object:Gem::Dependency
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
@@ -59,7 +59,7 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 2.2.0
62
+ version: '2.5'
63
63
  name: appraisal
64
64
  prerelease: false
65
65
  type: :development
@@ -67,7 +67,7 @@ dependencies:
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 2.2.0
70
+ version: '2.5'
71
71
  - !ruby/object:Gem::Dependency
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
@@ -87,15 +87,15 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.6.0
91
- name: database_cleaner
90
+ version: '2.1'
91
+ name: database_cleaner-active_record
92
92
  prerelease: false
93
93
  type: :development
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: 1.6.0
98
+ version: '2.1'
99
99
  - !ruby/object:Gem::Dependency
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
@@ -214,6 +214,7 @@ files:
214
214
  - Dockerfile
215
215
  - Gemfile
216
216
  - LICENSE.txt
217
+ - Makefile
217
218
  - README.md
218
219
  - Rakefile
219
220
  - UPGRADE_GUIDE.md
@@ -223,12 +224,9 @@ files:
223
224
  - db/migrate/20150407031737_set_up_testing_db.rb
224
225
  - db/schema.rb
225
226
  - docker-compose.yml
226
- - gemfiles/activerecord_5.0.0.gemfile
227
- - gemfiles/activerecord_5.1.0.gemfile
228
- - gemfiles/activerecord_5.2.0.gemfile
229
- - gemfiles/activerecord_6.0.0.gemfile
230
- - gemfiles/activerecord_6.1.0.gemfile
231
- - gemfiles/activerecord_7.0.1.gemfile
227
+ - gemfiles/activerecord_6.1.gemfile
228
+ - gemfiles/activerecord_7.0.gemfile
229
+ - gemfiles/activerecord_7.1.gemfile
232
230
  - jsonb_accessor.gemspec
233
231
  - lib/jsonb_accessor.rb
234
232
  - lib/jsonb_accessor/attribute_query_methods.rb
@@ -249,7 +247,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
247
  requirements:
250
248
  - - ">="
251
249
  - !ruby/object:Gem::Version
252
- version: '2'
250
+ version: '3'
253
251
  required_rubygems_version: !ruby/object:Gem::Requirement
254
252
  requirements:
255
253
  - - ">="
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.2.8"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 6.0.6"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 7.0.1"
6
-
7
- gemspec path: "../"