rails_core_extensions 0.13.2 → 0.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9a3bc99415c6959119365c5b542dc8ae3c912d004d7a4ae809755c7eeaccc44
4
- data.tar.gz: 3a3db36a2823a7116674253ede3efe09222829285e038561de663b33bf8b9671
3
+ metadata.gz: dbfd55f440894bc4d7f2a50652fa3e184f37aaa55b15c5c6bd28244f8ef6cde5
4
+ data.tar.gz: cabe588cad7d8acbadc17ef9ae0c72c0d4d8255542a3d10a7e4aa4bb9f2ffc43
5
5
  SHA512:
6
- metadata.gz: 2b02c74b69ba727097ecea9edbba9db615c517ac15f9573c12770f0ce9893bb31d5beaa8701e259854db15fe41f7f3b49fc269784fabdcf3d51a7c6d0243aec2
7
- data.tar.gz: deeab7f200cd2439ea720c4c2338dd82d9feb370be4d650bd25675d6cab826c6701e95bdc716f133740a95a083e06d07d977d5c7a7510049a6184ff4a2a10f63
6
+ metadata.gz: d73f4aa53361a19b9a7b422fbf1db78590dd5e16a526ecf24a131da6d5d859f8f72cc05dbcf9eab9194e64cf1ea378b3c6fa0919c0ade8993ac59ba56159e430
7
+ data.tar.gz: 45d5a3ddf135577f169d841ec246b2f6a310d631d0c594788098688c55fa65001920b817d031af88e17969dc1f2914c6b87eba92fb7acdb336836d63425e179e
@@ -0,0 +1,12 @@
1
+ # The commits that did automated reformatting. You can ignore them
2
+ # during git-blame with `--ignore-rev` or `--ignore-revs-file`.
3
+ # You can also globally configure GIT with the following command
4
+ #
5
+ # $ git config --add 'blame.ignoreRevsFile' '.git-blame-ignore-revs'
6
+ #
7
+ # Example entries:
8
+ #
9
+ # <full commit hash> # initial black-format
10
+ # <full commit hash> # rename something internal
11
+
12
+ 043b2db647926c048202b037f87e5e2396f830e1 # Pretty CHANGELOG.md
@@ -6,7 +6,7 @@ jobs:
6
6
  fail-fast: false
7
7
  matrix:
8
8
  gemfile: [rails60, rails61, rails70]
9
- ruby: ["2.7", "3.0", "3.1"]
9
+ ruby: ["3.0", "3.1", "3.2"]
10
10
  runs-on: ubuntu-latest
11
11
  env:
12
12
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.2.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.0
4
+
5
+ - [PLAT-1175] Update to Ruby 3.2
6
+
7
+ ## 0.14.0
8
+
9
+ - [PLAT-1135] Remove `enum_int` as we have now fully migrated to rails native `enum`
10
+
3
11
  ## 0.13.2
4
12
 
5
13
  - [PLAT-390] Fix broken `action_view` extensions
@@ -22,74 +30,74 @@
22
30
 
23
31
  ## 0.11.2
24
32
 
25
- * [TT-8640] Add dependabot config
33
+ - [TT-8640] Add dependabot config
26
34
 
27
35
  ## 0.11.1
28
36
 
29
- * [TT-8608] Fix broken rake command in the gem publish stage
37
+ - [TT-8608] Fix broken rake command in the gem publish stage
30
38
 
31
39
  ## 0.11.0
32
40
 
33
- * [TT-8608] Switch from travis to gihthub actions
34
- * [TT-8608] Add support for Rails 6.1 / Ruby 3
41
+ - [TT-8608] Switch from travis to gihthub actions
42
+ - [TT-8608] Add support for Rails 6.1 / Ruby 3
35
43
 
36
44
  ## 0.10.0
37
45
 
38
- * [TT-8507] Sortable will now fire callbacks to ensure we audit these changes
46
+ - [TT-8507] Sortable will now fire callbacks to ensure we audit these changes
39
47
 
40
48
  ## 0.9.0
41
49
 
42
- * [TT-6727] Fix usage of symbolize_keys in sortable
50
+ - [TT-6727] Fix usage of symbolize_keys in sortable
43
51
 
44
52
  ## 0.8.0
45
53
 
46
- * [TT-6539] Remove cache_all_attributes and other unused methods
47
- * [TT-5384] Remove validates_presence_of_parent method (Use rails optional flag instead)
48
- * [TT-6293] Drop breadcrumbs / cache without host and some unused view helpers
54
+ - [TT-6539] Remove cache_all_attributes and other unused methods
55
+ - [TT-5384] Remove validates_presence_of_parent method (Use rails optional flag instead)
56
+ - [TT-6293] Drop breadcrumbs / cache without host and some unused view helpers
49
57
 
50
58
  ## 0.7.1
51
59
 
52
- * [TT-5745] Fix passing of symbol to liquid template parse
60
+ - [TT-5745] Fix passing of symbol to liquid template parse
53
61
 
54
62
  ## 0.7.0
55
63
 
56
- * [TT-5745] Update Liquid validate to be v4 compatible
64
+ - [TT-5745] Update Liquid validate to be v4 compatible
57
65
 
58
66
  ## 0.6.1
59
67
 
60
- * [TT-5671] More fixes to sortable
68
+ - [TT-5671] More fixes to sortable
61
69
 
62
70
  ## 0.6.0
63
71
 
64
- * [TT-5542] Remove Rails 4 support
65
- * [TT-5642] Fixed sortable so it can sort on empty scopes
72
+ - [TT-5542] Remove Rails 4 support
73
+ - [TT-5642] Fixed sortable so it can sort on empty scopes
66
74
 
67
75
  ## 0.5.0
68
76
 
69
- * Support include_blank properly (was broken)
77
+ - Support include_blank properly (was broken)
70
78
 
71
79
  ## 0.4.0 (Removes Rails3 Support)
72
80
 
73
- * [TT-3778] Store the cacheable attributes in memory for the duration of the request
81
+ - [TT-3778] Store the cacheable attributes in memory for the duration of the request
74
82
 
75
83
  ## 0.3.0
76
84
 
77
- * Use coverage kit to enforce maximum coverage
78
- * [ROT-73] Always cache cacheable attributes
79
- * [RU-133] Replace alias_method_chain with alias_method
85
+ - Use coverage kit to enforce maximum coverage
86
+ - [ROT-73] Always cache cacheable attributes
87
+ - [RU-133] Replace alias_method_chain with alias_method
80
88
 
81
89
  ## 0.2.0
82
90
 
83
- * Extract and test translations
91
+ - Extract and test translations
84
92
 
85
93
  ## 0.1.1
86
94
 
87
- * Fixes issue with sortable controllers
95
+ - Fixes issue with sortable controllers
88
96
  implicitly depending on prototype based template rendering
89
97
 
90
98
  ## 0.1.0
91
99
 
92
- * Add rails 5 support
93
- * Refactor clone_excluding to enable rails 5 support
94
- * Extract transfer_records to class
95
- * Rename enum to enum_int to be rails 4/5 compatible
100
+ - Add rails 5 support
101
+ - Refactor clone_excluding to enable rails 5 support
102
+ - Extract transfer_records to class
103
+ - Rename enum to enum_int to be rails 4/5 compatible
@@ -9,28 +9,6 @@ module ActiveRecordExtensions
9
9
  establish_connection("#{key}_#{Rails.env}")
10
10
  end
11
11
 
12
- def enum_int(field, values, options = {})
13
- const_set("#{field.to_s.upcase}_OPTIONS", values)
14
-
15
- select_options = values.map.with_index{|v, i| [v.to_s.humanize, i]}
16
- const_set("#{field.to_s.upcase}_SELECT_OPTIONS", select_options)
17
-
18
- values.each.with_index do |value, i|
19
- const_set("#{field.to_s.upcase}_#{value.to_s.upcase}", i)
20
- method_name = options[:short_name] ? "#{value}?" : "#{field}_#{value}?"
21
- class_eval <<-ENUM
22
- def #{method_name}
23
- #{field} == #{i}
24
- end
25
- ENUM
26
- end
27
- class_eval <<-ENUM
28
- def #{field}_name
29
- #{field.to_s.upcase}_OPTIONS[#{field}]
30
- end
31
- ENUM
32
- end
33
-
34
12
  def optional_fields(*possible_fields)
35
13
  @optional_fields_loader = possible_fields.pop if possible_fields.last.is_a?(Proc)
36
14
 
@@ -1,3 +1,3 @@
1
1
  module RailsCoreExtensions
2
- VERSION = '0.13.2'
2
+ VERSION = '0.15.0'
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
- spec.required_ruby_version = '>= 2.7'
21
+ spec.required_ruby_version = '>= 3.0'
22
22
 
23
23
  spec.add_dependency 'activerecord', ['>= 6.0.0']
24
24
  spec.add_dependency 'actionpack', ['>= 6.0.0']
@@ -22,52 +22,6 @@ describe "optional_fields" do
22
22
  end
23
23
  end
24
24
 
25
- describe 'enum_int' do
26
- let(:model_class) {
27
- Class.new(ActiveRecord::Base) do
28
- enum_int :category_id, %w(one two thr)
29
- end
30
- }
31
- before do
32
- connect_to_sqlite
33
- stub_const 'Model', model_class
34
- end
35
- let(:one) { Model.new(category_id: 'one') }
36
-
37
- it 'should define constants' do
38
- expect(Model::CATEGORY_ID_OPTIONS).to eq %w(one two thr)
39
- expect(Model::CATEGORY_ID_ONE).to eq 0
40
- expect(Model::CATEGORY_ID_TWO).to eq 1
41
- expect(Model::CATEGORY_ID_THR).to eq 2
42
- end
43
-
44
- it 'should define methods' do
45
- expect(one.category_id_one?).to be true
46
- expect(one.category_id_two?).to be false
47
- expect(one.category_id_thr?).to be false
48
- end
49
-
50
- it 'should define select options' do
51
- expect(Model::CATEGORY_ID_SELECT_OPTIONS).to eq([
52
- ['One', 0], ['Two', 1], ['Thr', 2]
53
- ])
54
- end
55
-
56
- context 'when short name' do
57
- let(:model_class) {
58
- Class.new(ActiveRecord::Base) do
59
- enum_int :category_id, %w(one two thr), short_name: true
60
- end
61
- }
62
-
63
- it 'should define methods' do
64
- expect(one.one?).to be true
65
- expect(one.two?).to be false
66
- expect(one.thr?).to be false
67
- end
68
- end
69
- end
70
-
71
25
  describe RailsCoreExtensions::ActionControllerSortable do
72
26
  class NormalController < ActionController::Base
73
27
  end
@@ -1,3 +1,3 @@
1
1
  require 'coverage/kit'
2
2
 
3
- Coverage::Kit.setup(minimum_coverage: 84.1)
3
+ Coverage::Kit.setup(minimum_coverage: 83.5)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_core_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-07-04 00:00:00.000000000 Z
12
+ date: 2023-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -144,6 +144,7 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
+ - ".git-blame-ignore-revs"
147
148
  - ".github/dependabot.yml"
148
149
  - ".github/workflows/release.yml"
149
150
  - ".github/workflows/ruby.yml"
@@ -201,14 +202,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
202
  requirements:
202
203
  - - ">="
203
204
  - !ruby/object:Gem::Version
204
- version: '2.7'
205
+ version: '3.0'
205
206
  required_rubygems_version: !ruby/object:Gem::Requirement
206
207
  requirements:
207
208
  - - ">="
208
209
  - !ruby/object:Gem::Version
209
210
  version: '0'
210
211
  requirements: []
211
- rubygems_version: 3.3.3
212
+ rubygems_version: 3.4.1
212
213
  signing_key:
213
214
  specification_version: 4
214
215
  summary: Set of extensions to core rails libraries.