attr_json 0.2.0 → 1.5.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
- SHA1:
3
- metadata.gz: 1033d8a923d5935a8b18e10612883d6756279089
4
- data.tar.gz: 8c8b5faf3c24cc27d1d6e382b44c3a63b180826a
2
+ SHA256:
3
+ metadata.gz: 3cd2566fed014325bee56f5c062080d3c929a790dbb3b287e92b086c2fa3180f
4
+ data.tar.gz: ffa8e7b471dce27a2708b12e6a2bf27edb5b20d1345656ca026ecc4b263a01a7
5
5
  SHA512:
6
- metadata.gz: 57dec15a2438c7d5fa8b2460afc3c3fcedef01aad80a78bf9bb1511b9be68bb6b7166acb7dc9b1aa25d5614c8cd7eb688fc55433ed9bce1fdb8eab8d1061e22d
7
- data.tar.gz: 76f0397e93f14b3ca5ff38c01bf4da3b6d4ea11080414d60e7da2126ecffc78926e087245fe82cc8d30a5d8bc6ffa41d2092b096ed8bcb2ad91149960610a85d
6
+ metadata.gz: f8db6d4211a2dd9f4b9d8a5482b723597958082617e139157c325e8e3b9dddf15216d21bd56daece5d5b3674acdc8e099a22998ad452473a4bf0834774b7a21f
7
+ data.tar.gz: 13e2cd5b4b10f67f4ecfc1be8732c6a33a7f7a7fdb561b6d8f4f89ae39c74e4b0b153ae10fdf5d650a239534f5b28cd33750aaff90009eeec8877677e765a935
@@ -0,0 +1,87 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ '**' ]
8
+ # UTC Tuesdays 0900. note, no notifications will be sent for failed scheduled builds. :(
9
+ schedule:
10
+ - cron: '0 9 * * TUE'
11
+
12
+
13
+ env:
14
+ POSTGRES_USER: postgres
15
+ POSTGRES_PASSWORD: postgres
16
+
17
+ jobs:
18
+ tests:
19
+ services:
20
+ db:
21
+ image: postgres:9.4
22
+ env:
23
+ POSTGRES_USER: postgres
24
+ POSTGRES_PASSWORD: postgres
25
+ ports: ['5432:5432']
26
+
27
+ runs-on: ubuntu-latest
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ include:
32
+ - gemfile: rails_5_0
33
+ ruby: 2.4
34
+
35
+ - gemfile: rails_5_0
36
+ ruby: 2.5
37
+
38
+ - gemfile: rails_5_1
39
+ ruby: 2.4
40
+
41
+ - gemfile: rails_5_2
42
+ ruby: 2.4
43
+
44
+ - gemfile: rails_5_2
45
+ ruby: 2.6
46
+
47
+ - gemfile: rails_6_0
48
+ ruby: 2.6
49
+
50
+ - gemfile: rails_6_0
51
+ ruby: 2.7
52
+
53
+ - gemfile: rails_6_1
54
+ ruby: 2.7
55
+
56
+ - gemfile: rails_6_1
57
+ ruby: '3.0'
58
+
59
+ - gemfile: rails_7_0
60
+ ruby: '3.0'
61
+
62
+ - gemfile: rails_7_0
63
+ ruby: 3.1
64
+
65
+ - gemfile: rails_7_0
66
+ ruby: 3.2
67
+
68
+
69
+ name: ${{ matrix.gemfile }}, ruby ${{ matrix.ruby }}
70
+
71
+ steps:
72
+ - uses: actions/checkout@v3
73
+
74
+ - name: Set up Ruby
75
+ uses: ruby/setup-ruby@v1
76
+ with:
77
+ ruby-version: ${{ matrix.ruby }}
78
+ bundler-cache: false
79
+
80
+ - name: Bundle install
81
+ run: |
82
+ bundle config set gemfile "${GITHUB_WORKSPACE}/gemfiles/${{ matrix.gemfile }}.gemfile"
83
+ bundle install --jobs 4 --retry 3
84
+
85
+ - name: Run tests
86
+ run: |
87
+ bundle exec rspec
@@ -0,0 +1,66 @@
1
+ name: CI on Future Rails Versions
2
+
3
+ # Experimenting with separate github actions workflow
4
+ # for gemfiles for FUTURE Rails vesions, we'd like to keep an eye on
5
+ # if they pass, but they aren't required to do so.
6
+ #
7
+ # This has to just be a copy-and-paste copy of our main ci.yml,
8
+ # but with different gemfiles in the matrix. That is not great.
9
+ # We also choose NOT to run this one on pull_request, we just
10
+ # run it on master, see how that works.
11
+ #
12
+ # These jobs can be left out of "required" for merge in github settings
13
+ # for "Branch Protection Rules" at https://github.com/jrochkind/attr_json/settings/branches
14
+ #
15
+ # You can move a Rails version between this file and ci.yml, and (un)check it in those
16
+ # github settings. (I wish whether it was required to pass could be in this file
17
+ # too, to keep things together)
18
+
19
+ on:
20
+ push:
21
+ branches: [ master ]
22
+ # UTC Sundays 0900. note, no notifications will be sent for failed scheduled builds. :(
23
+ schedule:
24
+ - cron: '0 9 * * SUN'
25
+
26
+ env:
27
+ POSTGRES_USER: postgres
28
+ POSTGRES_PASSWORD: postgres
29
+
30
+ jobs:
31
+ tests:
32
+ services:
33
+ db:
34
+ image: postgres:9.4
35
+ env:
36
+ POSTGRES_USER: postgres
37
+ POSTGRES_PASSWORD: postgres
38
+ ports: ['5432:5432']
39
+
40
+ runs-on: ubuntu-latest
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+
47
+ - gemfile: rails_edge
48
+ ruby: '3.1'
49
+
50
+ name: ${{ matrix.gemfile }}, ruby ${{ matrix.ruby }}
51
+
52
+ steps:
53
+ - uses: actions/checkout@v3
54
+
55
+ - name: Set up Ruby
56
+ uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ${{ matrix.ruby }}
59
+
60
+ - name: Bundle install
61
+ run: |
62
+ bundle config set gemfile "${GITHUB_WORKSPACE}/gemfiles/${{ matrix.gemfile }}.gemfile"
63
+ bundle install --jobs 4 --retry 3
64
+
65
+ - name: Run tests
66
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /spec/internal/tmp/cache
10
10
  /tmp/
11
11
  .byebug_history
12
+ /gemfiles/*.lock
data/Appraisals ADDED
@@ -0,0 +1,62 @@
1
+ appraise "rails-5-0" do
2
+ gem 'combustion', '~> 0.9.0'
3
+
4
+ gem "rails", "~> 5.0.0"
5
+
6
+ # rails 5.1+ includes it by default, but rails 5.0 needs it:
7
+ gem 'rails-ujs', require: false
8
+
9
+ # Rails 5 won't work with pg 1.0 even though it doesn't say so
10
+ gem "pg", "~> 0.18"
11
+ end
12
+
13
+ appraise "rails-5-1" do
14
+ gem 'combustion', '~> 0.9.0'
15
+
16
+ gem "rails", "~> 5.1.0"
17
+
18
+ gem "pg", "~> 1.0"
19
+ end
20
+
21
+ appraise "rails-5-2" do
22
+ gem 'combustion', '~> 0.9.0'
23
+
24
+ gem "rails", "~> 5.2.0"
25
+ gem "pg", "~> 1.0"
26
+ end
27
+
28
+ appraise "rails-6-0" do
29
+ gem 'combustion', "~> 1.0"
30
+
31
+ gem "rails", ">= 6.0.0", "< 6.1"
32
+ gem "pg", "~> 1.0"
33
+ end
34
+
35
+ appraise "rails-6-1" do
36
+ gem 'combustion', "~> 1.0"
37
+
38
+ gem "rails", "~> 6.1.0"
39
+ gem "pg", "~> 1.0"
40
+
41
+ # sprockets-rails is already a rails 6.1 dependency, but combustion is failing
42
+ # to require it, this is one way to get it required.
43
+ # https://github.com/pat/combustion/issues/128
44
+ gem "sprockets-rails"
45
+ end
46
+
47
+ appraise "rails-7-0" do
48
+ gem 'combustion', "~> 1.0"
49
+
50
+ gem "rails", "~> 7.0.0"
51
+ gem "pg", "~> 1.0"
52
+ end
53
+
54
+ appraise "rails-edge" do
55
+ # need combustion edge to work with rails edge, will no longer
56
+ # be true on next combustion release, probably no later than Rails 7.1
57
+ # https://github.com/pat/combustion/pull/126
58
+ gem 'combustion', "~> 1.0", github: "pat/combustion"
59
+
60
+ gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
61
+ gem "pg", "~> 1.0"
62
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,67 @@
1
+ # Changelog
2
+ Notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased](https://github.com/jrochkind/attr_json/compare/v1.4.1...HEAD)
8
+
9
+
10
+ ## [1.5.0](https://github.com/jrochkind/attr_json/compare/v1.4.1...v1.5.0)
11
+
12
+ ### Added
13
+
14
+ * AttrJson::Model#dup will properly deep-dup attributes https://github.com/jrochkind/attr_json/pull/169
15
+
16
+ * AttrJson::Model#freeze will freeze attributes -- but not deep-freeze. https://github.com/jrochkind/attr_json/pull/169
17
+
18
+ * AttrJson::Model has some methods conventional in ActiveModel classes: Klass.attribute_types, Klass.attribute_names, and instance.attribute_names. https://github.com/jrochkind/attr_json/pull/169
19
+
20
+ ## [1.4.1](https://github.com/jrochkind/attr_json/compare/v1.4.0...v1.4.1)
21
+
22
+ ### Fixed
23
+
24
+ * Fixed an obscure bug involving a conflict between attribute defaults and accepts_nested_attributes, in which defaults could overwrite assigned attributes. The `.fill_in_defaults` class method, which was never intended as public API and was commented accordingly, is gone. https://github.com/jrochkind/attr_json/pull/160
25
+
26
+ ## [1.4.0](https://github.com/jrochkind/attr_json/compare/v1.3.0...v1.4.0)
27
+
28
+ ### Changed
29
+
30
+ * When using store_key feature on an AttrJson::Model, you should not be able to pass in the store_key as a key in initializer or assign_attributes. It was really a bug that this ended up mapped to attribute this way, which could cause a problem in some cases; but calling it out in Changed section because if you were accidentally relying on it, it may appear as a backwards incompat to you. https://github.com/jrochkind/attr_json/pull/125
31
+
32
+ * Rails 7.0.0 allowed by gemspec and tested in CI
33
+
34
+ ### Fixed
35
+
36
+ * polymorphic single type can be set to nil https://github.com/jrochkind/attr_json/pull/115
37
+ * polymorphic models can be serialized from hash in container attribute. Thanks @machty. https://github.com/jrochkind/attr_json/pull/123
38
+ * fix bug with deserialization of nested attributes that have types that apply different serialization vs cast logic. Thanks @bradleesand. https://github.com/jrochkind/attr_json/pull/125
39
+
40
+ ## [1.3.0](https://github.com/jrochkind/attr_json/compare/v1.2.0...v1.3.0)
41
+
42
+ ### Added
43
+
44
+ * Gemspec allows use with ActiveRecord 6.1.x
45
+
46
+ ## [1.2.0](https://github.com/jrochkind/attr_json/compare/v1.1.0...v1.2.0)
47
+
48
+ ### Added
49
+
50
+ * attr_json_config(bad_cast: :as_nil) to avoid raising on data that can't be cast to a
51
+ AttrJson::Model, instead just casting to nil. https://github.com/jrochkind/attr_json/pull/95
52
+
53
+ * Documented and tested support for using ActiveRecord serialize to map one AttrJson::Model
54
+ to an entire column on it's own. https://github.com/jrochkind/attr_json/pull/89 and
55
+ https://github.com/jrochkind/attr_json/pull/93
56
+
57
+ * Better synchronization with ActiveRecord attributes when using rails_attribute:true, and a configurable true default_rails_attribute. Thanks @volkanunsal . https://github.com/jrochkind/attr_json/pull/94
58
+
59
+ ### Changed
60
+
61
+ * AttrJson::Model#== now requires same class for equality. And doesn't raise on certain arguments. https://github.com/jrochkind/attr_json/pull/90 Thanks @caiofilipemr for related bug report.
62
+
63
+ ## [1.1.0](https://github.com/jrochkind/attr_json/compare/v1.0.0...v1.1.0)
64
+
65
+ ### Added
66
+
67
+ * not_jsonb_contains query method, like `jsonb_contains` but negated. https://github.com/jrochkind/attr_json/pull/85
data/Gemfile CHANGED
@@ -3,40 +3,43 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in attr_json.gemspec
4
4
  gemspec
5
5
 
6
- # for our integration test in a real rails env, we add em in development too,
7
- # so we can bring up the app or a console in development to play with it.
8
- group :test, :development do
9
- gem 'combustion', '~> 0.9.0'
10
- # all of rails is NOT a dependency, just activerecord.
11
- # But we use it for integration testing with combustion. Hmm, a bit annoying
12
- # that now our other tests can't be sure they're depending, this might not
13
- # be the way to do it.
14
- gem "rails", ENV["RAILS_GEM"] && ENV["RAILS_GEM"].split(",")
15
-
16
- # Rails 5.0 won't work with pg 1.0, but that isn't actually in it's gemspec.
17
- # So we specify a compatible PG_GEM spec when testing with rails 5.
18
- ENV['PG_GEM'] ||= ">= 0.18.1"
19
- gem "pg", ENV['PG_GEM']
20
-
21
- gem "rspec-rails", "~> 3.7"
22
- gem "simple_form", ">= 4.0"
23
- gem 'cocoon', ">= 1.2"
24
- gem 'jquery-rails'
25
- gem 'capybara', "~> 3.0"
26
- gem "chromedriver-helper"
27
- gem "selenium-webdriver"
28
- # rails 5.1+ includes it by default, but rails 5.0 needs it:
29
- gem 'rails-ujs', require: false
30
- end
31
-
32
- if ENV['RAILS_GEM']
33
- gem "activerecord", ENV['RAILS_GEM'].split(",")
34
-
35
- # This shouldn't really be needed, but seems to maybe be a bundler bug,
36
- # this makes standalone_migrations dependencies resolve properly even when our
37
- # RAILS_REQ is for 5.2.0.rc2. If in the future you delete this and everything
38
- # still passes, feel free to remove.
39
- gem "railties", ENV['RAILS_GEM'].split(",")
40
- end
6
+ # Dependencies for testing and development. To let appraisal override them, we
7
+ # do NOT put them in group :test,:development -- which anyway doesn't make a
8
+ # lot of sense in a gem Gemfile anyway, there is no "production" in a gem Gemfile.
9
+ #
10
+ # We also have these development dependencies here in the Gemfile instead of the
11
+ # gemspec so appraisal can override them from our Appraisal file.
12
+
13
+ gem 'combustion', '~> 1.1'
14
+
15
+ # all of rails is NOT a dependency, just activerecord.
16
+ # But we use it for integration testing with combustion. Hmm, a bit annoying
17
+ # that now our other tests can't be sure they're depending, this might not
18
+ # be the way to do it.
19
+ gem 'rails'
20
+
21
+ gem "pg"
22
+ gem "rspec-rails", "~> 6.0"
23
+ gem "simple_form", ">= 4.0"
24
+ gem 'cocoon', ">= 1.2"
25
+ gem 'jquery-rails'
26
+
27
+ # Even though we don't use coffee-script, when running specs, some part of rails
28
+ # or other part of our stack is still insisting on requiring it, for reasons we
29
+ # don't understand, so we need to depend on it.
30
+ gem "coffee-rails"
31
+
32
+ # We do some tests using cocoon via sprockets, which needs sprockets-rails,
33
+ # which is not automatically available in Rails 7. We add it explicitly,
34
+ # which will duplciate dependences in rails pre-7, but add for rails 7. Not sure
35
+ # the future of cocoon in general. https://github.com/nathanvda/cocoon/issues/555
36
+ gem "sprockets-rails"
37
+
38
+
39
+ gem 'capybara', "~> 3.0"
40
+ gem 'webdrivers', '~> 5.0'
41
+ gem "selenium-webdriver"
41
42
 
42
43
  gem "byebug"
44
+
45
+