active_type 2.5.1 → 2.8.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/README.md +23 -9
  4. data/lib/active_type/change_association.rb +2 -6
  5. data/lib/active_type/marshalling.rb +62 -0
  6. data/lib/active_type/nested_attributes/association.rb +5 -20
  7. data/lib/active_type/no_table.rb +66 -148
  8. data/lib/active_type/object.rb +2 -0
  9. data/lib/active_type/record.rb +2 -0
  10. data/lib/active_type/record_extension/inheritance.rb +41 -76
  11. data/lib/active_type/type_caster.rb +2 -8
  12. data/lib/active_type/version.rb +3 -1
  13. data/lib/active_type/virtual_attributes.rb +65 -40
  14. data/lib/active_type.rb +0 -7
  15. metadata +7 -41
  16. data/.github/workflows/test.yml +0 -134
  17. data/.gitignore +0 -8
  18. data/.rspec +0 -1
  19. data/.ruby-version +0 -1
  20. data/Gemfile +0 -1
  21. data/Gemfile.5.2.mysql2 +0 -9
  22. data/Gemfile.5.2.mysql2.lock +0 -59
  23. data/Gemfile.5.2.pg +0 -9
  24. data/Gemfile.5.2.pg.lock +0 -59
  25. data/Gemfile.5.2.sqlite3 +0 -9
  26. data/Gemfile.5.2.sqlite3.lock +0 -59
  27. data/Gemfile.6.0.sqlite3 +0 -9
  28. data/Gemfile.6.0.sqlite3.lock +0 -59
  29. data/Gemfile.6.1.pg +0 -9
  30. data/Gemfile.6.1.pg.lock +0 -59
  31. data/Gemfile.6.1.sqlite3 +0 -9
  32. data/Gemfile.6.1.sqlite3.lock +0 -59
  33. data/Gemfile.7.0.pg +0 -9
  34. data/Gemfile.7.0.pg.lock +0 -56
  35. data/Gemfile.7.0.sqlite3 +0 -9
  36. data/Gemfile.7.0.sqlite3.lock +0 -58
  37. data/Gemfile.7.1.pg +0 -9
  38. data/Gemfile.7.1.pg.lock +0 -68
  39. data/Gemfile.7.1.sqlite3 +0 -9
  40. data/Gemfile.7.1.sqlite3.lock +0 -70
  41. data/Gemfile.7.2.pg +0 -9
  42. data/Gemfile.7.2.pg.lock +0 -70
  43. data/Gemfile.7.2.sqlite3 +0 -9
  44. data/Gemfile.7.2.sqlite3.lock +0 -72
  45. data/Gemfile.lock +0 -1
  46. data/Rakefile +0 -57
  47. data/active_type.gemspec +0 -31
@@ -18,11 +18,7 @@ module ActiveType
18
18
  unless options[:foreign_key] || options[:as]
19
19
  options = options.merge(foreign_key: extended_record_base_class.name.foreign_key)
20
20
  end
21
- if ActiveRecord::VERSION::MAJOR > 3
22
- [options, scope]
23
- else
24
- [options]
25
- end
21
+ [options, scope]
26
22
  end
27
23
 
28
24
  module ClassMethods
@@ -66,7 +62,7 @@ module ActiveType
66
62
 
67
63
  def has_many(name, scope=nil, *args, &extension)
68
64
  new_args, new_scope = Inheritance.add_foreign_key_option(extended_record_base_class, scope, *args)
69
- if ActiveRecord::VERSION::MAJOR <= 3 || new_scope.nil?
65
+ if new_scope.nil?
70
66
  super(name, **new_args, &extension)
71
67
  else
72
68
  super(name, new_scope, **new_args, &extension)
@@ -75,7 +71,7 @@ module ActiveType
75
71
 
76
72
  def has_one(name, scope=nil, *args, &extension)
77
73
  new_args, new_scope = Inheritance.add_foreign_key_option(extended_record_base_class, scope, *args)
78
- if ActiveRecord::VERSION::MAJOR <= 3 || new_scope.nil?
74
+ if new_scope.nil?
79
75
  super(name, **new_args, &extension)
80
76
  else
81
77
  super(name, new_scope, **new_args, &extension)
@@ -84,79 +80,48 @@ module ActiveType
84
80
 
85
81
  private
86
82
 
87
- if ActiveRecord::VERSION::MAJOR < 5
88
-
89
- def find_sti_class(type_name)
90
- sti_class = super
91
-
92
- # Consider this class hierarchy
93
- # class Parent < ActiveRecord::Base; end
94
- # class Child < Parent; end
95
- # class ExtendedParent < ActiveType::Record[Parent]; end
96
- # class ExtendedChild < ActiveType::Record[Child]; end
97
- if self < sti_class
98
- # i.e. ExtendendChild.find(child.id)
99
- # => self = ExtendedChild; sti_class = Child
100
- # instantiate as ExtendedChild
101
- self
102
- elsif sti_class < extended_record_base_class
103
- # i.e. ExtendedParent.find(child.id)
104
- # => sti_class = Child; self = ExtendedParent; extended_record_base_class = Parent
105
- # There is no really good solution here, since we cannot instantiate as both ExtendedParent
106
- # and Child. We opt to instantiate as ExtendedParent, since the other option can be
107
- # achieved by using Parent.find(child.id)
108
- self
83
+ # Rails 5 find_sti_class does a sanity check for proper inheritance that fails for
84
+ # our usecase
85
+ # copied from activerecord/lib/active_record/inheritance.rb
86
+ def find_sti_class(type_name)
87
+ type_name = base_class.type_for_attribute(inheritance_column).cast(type_name)
88
+ subclass = begin
89
+ if store_full_sti_class
90
+ type_name.constantize
109
91
  else
110
- sti_class
92
+ compute_type(type_name)
111
93
  end
94
+ rescue NameError
95
+ raise ActiveRecord::SubclassNotFound,
96
+ "The single-table inheritance mechanism failed to locate the subclass: '#{type_name}'. " \
97
+ "This error is raised because the column '#{inheritance_column}' is reserved for storing the class in case of inheritance. " \
98
+ "Please rename this column if you didn't intend it to be used for storing the inheritance class " \
99
+ "or overwrite #{name}.inheritance_column to use another column for that information."
112
100
  end
113
-
114
- else
115
-
116
- # Rails 5 find_sti_class does a sanity check for proper inheritance that fails for
117
- # our usecase
118
- # copied from activerecord/lib/active_record/inheritance.rb
119
- def find_sti_class(type_name)
120
- type_name = base_class.type_for_attribute(inheritance_column).cast(type_name)
121
- subclass = begin
122
- if store_full_sti_class
123
- type_name.constantize
124
- else
125
- compute_type(type_name)
126
- end
127
- rescue NameError
128
- raise ActiveRecord::SubclassNotFound,
129
- "The single-table inheritance mechanism failed to locate the subclass: '#{type_name}'. " \
130
- "This error is raised because the column '#{inheritance_column}' is reserved for storing the class in case of inheritance. " \
131
- "Please rename this column if you didn't intend it to be used for storing the inheritance class " \
132
- "or overwrite #{name}.inheritance_column to use another column for that information."
133
- end
134
- #### our code starts here
135
- # Consider this class hierarchy
136
- # class Parent < ActiveRecord::Base; end
137
- # class Child < Parent; end
138
- # class ExtendedParent < ActiveType::Record[Parent]; end
139
- # class ExtendedChild < ActiveType::Record[Child]; end
140
- if self < subclass
141
- # i.e. ExtendendChild.find(child.id)
142
- # => self = ExtendedChild; subclass = Child
143
- # instantiate as ExtendedChild
144
- subclass = self
145
- elsif subclass < extended_record_base_class
146
- # i.e. ExtendedParent.find(child.id)
147
- # => subclass = Child; self = ExtendedParent; extended_record_base_class = Parent
148
- # There is no really good solution here, since we cannot instantiate as both ExtendedParent
149
- # and Child. We opt to instantiate as ExtendedParent, since the other option can be
150
- # achieved by using Parent.find(child.id)
151
- subclass = self
152
- end
153
- #### our code ends here
154
- unless subclass == self || descendants.include?(subclass)
155
- raise ActiveRecord::SubclassNotFound, "Invalid single-table inheritance type: #{subclass.name} is not a subclass of #{name}"
156
- end
157
- subclass
101
+ #### our code starts here
102
+ # Consider this class hierarchy
103
+ # class Parent < ActiveRecord::Base; end
104
+ # class Child < Parent; end
105
+ # class ExtendedParent < ActiveType::Record[Parent]; end
106
+ # class ExtendedChild < ActiveType::Record[Child]; end
107
+ if self < subclass
108
+ # i.e. ExtendendChild.find(child.id)
109
+ # => self = ExtendedChild; subclass = Child
110
+ # instantiate as ExtendedChild
111
+ subclass = self
112
+ elsif subclass < extended_record_base_class
113
+ # i.e. ExtendedParent.find(child.id)
114
+ # => subclass = Child; self = ExtendedParent; extended_record_base_class = Parent
115
+ # There is no really good solution here, since we cannot instantiate as both ExtendedParent
116
+ # and Child. We opt to instantiate as ExtendedParent, since the other option can be
117
+ # achieved by using Parent.find(child.id)
118
+ subclass = self
158
119
  end
159
-
120
+ #### our code ends here
121
+ unless subclass == self || descendants.include?(subclass)
122
+ raise ActiveRecord::SubclassNotFound, "Invalid single-table inheritance type: #{subclass.name} is not a subclass of #{name}"
123
+ end
124
+ subclass
160
125
  end
161
126
 
162
127
  end
@@ -2,13 +2,7 @@ module ActiveType
2
2
  class TypeCaster
3
3
 
4
4
  def self.get(type)
5
- native_caster = if ActiveRecord::VERSION::STRING < '4.2'
6
- NativeCasters::DelegateToColumn.new(type)
7
- elsif ActiveRecord::VERSION::STRING < '5'
8
- NativeCasters::DelegateToRails4Type.new(type)
9
- else
10
- NativeCasters::DelegateToRails5Type.new(type)
11
- end
5
+ native_caster = NativeCasters::DelegateToRailsType.new(type)
12
6
  new(type, native_caster)
13
7
  end
14
8
 
@@ -104,7 +98,7 @@ module ActiveType
104
98
 
105
99
  # Adapter for Rails 5+.
106
100
  # In these versions, casting logic lives in subclasses of ActiveRecord::Type::Value
107
- class DelegateToRails5Type
101
+ class DelegateToRailsType
108
102
 
109
103
  def initialize(type)
110
104
  @active_record_type = lookup(type)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveType
2
- VERSION = '2.5.1'
4
+ VERSION = '2.8.0'
3
5
  end
@@ -134,6 +134,19 @@ module ActiveType
134
134
  result
135
135
  end
136
136
 
137
+ def self.attribute_for_inspect(value)
138
+ if value.is_a?(String) && value.length > 50
139
+ "#{value[0, 50]}...".inspect
140
+ elsif value.is_a?(Date) || value.is_a?(Time)
141
+ %("#{value.to_formatted_s(:db)}")
142
+ elsif value.is_a?(Array) && value.size > 10
143
+ inspected = value.first(10).inspect
144
+ %(#{inspected[0...-1]}, ...])
145
+ else
146
+ value.inspect
147
+ end
148
+ end
149
+
137
150
  extend ActiveSupport::Concern
138
151
 
139
152
  included do
@@ -141,6 +154,14 @@ module ActiveType
141
154
  class_attribute :virtual_columns_hash
142
155
  self.virtual_columns_hash = {}
143
156
 
157
+ if respond_to?(:attributes_for_inspect)
158
+ # 7.1 had [:id] as a default, we want a consistent default across all versions
159
+ self.attributes_for_inspect = :all
160
+ else
161
+ # ActiveRecord < 7.2
162
+ class_attribute :attributes_for_inspect, instance_accessor: false, default: :all
163
+ end
164
+
144
165
  class << self
145
166
  if method_defined?(:attribute)
146
167
  alias_method :ar_attribute, :attribute
@@ -189,34 +210,24 @@ module ActiveType
189
210
  read_existing_virtual_attribute(name) { super }
190
211
  end
191
212
 
192
- if ActiveRecord::VERSION::STRING >= '4.2.0'
193
- def _read_attribute(name)
194
- read_existing_virtual_attribute(name) { super }
195
- end
213
+ def _read_attribute(name)
214
+ read_existing_virtual_attribute(name) { super }
196
215
  end
197
216
 
198
- if ActiveRecord::VERSION::STRING < '4.2.0' || ActiveRecord::VERSION::STRING >= '6.1.0'
199
- # in 6.1, read_attribute does not call _read_attribute
200
- def read_attribute(name)
201
- read_existing_virtual_attribute(name) { super }
202
- end
217
+ def read_attribute(name)
218
+ read_existing_virtual_attribute(name) { super }
203
219
  end
204
220
 
205
221
  def []=(name, value)
206
222
  write_existing_virtual_attribute(name, value) { super }
207
223
  end
208
224
 
209
- if ActiveRecord::VERSION::STRING >= '5.2.0'
210
- def _write_attribute(name, value)
211
- write_existing_virtual_attribute(name, value) { super }
212
- end
225
+ def _write_attribute(name, value)
226
+ write_existing_virtual_attribute(name, value) { super }
213
227
  end
214
228
 
215
- if ActiveRecord::VERSION::STRING < '5.2.0' || ActiveRecord::VERSION::STRING >= '6.1.0'
216
- # in 6.1, write_attribute does not call _write_attribute
217
- def write_attribute(name, value)
218
- write_existing_virtual_attribute(name, value) { super }
219
- end
229
+ def write_attribute(name, value)
230
+ write_existing_virtual_attribute(name, value) { super }
220
231
  end
221
232
 
222
233
  def attributes
@@ -229,6 +240,10 @@ module ActiveType
229
240
  self.class._virtual_column_names.any? { |attr| virtual_attributes_were[attr] != send(attr) } || super
230
241
  end
231
242
 
243
+ def changed_for_autosave?
244
+ changed? || super
245
+ end
246
+
232
247
  def changes
233
248
  changes = self.class._virtual_column_names.each_with_object({}) do |attr, changes|
234
249
  current_value = send(attr)
@@ -239,14 +254,21 @@ module ActiveType
239
254
  super.merge(changes)
240
255
  end
241
256
 
242
- if ActiveRecord::VERSION::MAJOR >= 4
243
- def changes_applied
257
+ def attribute_changed?(attr, **)
258
+ attr = attr.to_s
259
+ if virtual_attributes.key?(attr)
260
+ virtual_attributes_were[attr] != send(attr)
261
+ else
244
262
  super
263
+ end
264
+ end
245
265
 
246
- virtual_attributes.each do |attr, _|
247
- value = read_virtual_attribute(attr)
248
- virtual_attributes_were[attr] = value.duplicable? ? value.clone : value
249
- end
266
+ def changes_applied
267
+ super
268
+
269
+ virtual_attributes.each do |attr, _|
270
+ value = read_virtual_attribute(attr)
271
+ virtual_attributes_were[attr] = value.duplicable? ? value.clone : value
250
272
  end
251
273
  end
252
274
 
@@ -269,25 +291,28 @@ module ActiveType
269
291
  virtual_attributes[name] = value
270
292
  end
271
293
 
272
- # Returns the contents of the record as a nicely formatted string.
294
+ def attributes_for_inspect
295
+ self.class.attributes_for_inspect == :all ? attributes.keys : self.class.attributes_for_inspect
296
+ end
297
+
273
298
  def inspect
274
- inspection = attributes.collect do |name, value|
275
- "#{name}: #{VirtualAttributes.attribute_for_inspect(value)}"
276
- end.sort.compact.join(", ")
277
- "#<#{self.class} #{inspection}>"
299
+ inspect_with_attributes(attributes_for_inspect)
278
300
  end
279
301
 
280
- def self.attribute_for_inspect(value)
281
- if value.is_a?(String) && value.length > 50
282
- "#{value[0, 50]}...".inspect
283
- elsif value.is_a?(Date) || value.is_a?(Time)
284
- %("#{value.to_formatted_s(:db)}")
285
- elsif value.is_a?(Array) && value.size > 10
286
- inspected = value.first(10).inspect
287
- %(#{inspected[0...-1]}, ...])
288
- else
289
- value.inspect
290
- end
302
+ def full_inspect
303
+ inspect_with_attributes(attributes.keys)
304
+ end
305
+
306
+ # Returns the contents of the record as a nicely formatted string.
307
+ def inspect_with_attributes(attribute_names)
308
+ inspection = attribute_names.collect do |name|
309
+ name = name.to_s
310
+ if attributes.key?(name)
311
+ value = attributes[name]
312
+ "#{name}: #{VirtualAttributes.attribute_for_inspect(value)}"
313
+ end
314
+ end.compact.sort.join(", ")
315
+ "#<#{self.class} #{inspection}>"
291
316
  end
292
317
 
293
318
  private
data/lib/active_type.rb CHANGED
@@ -4,13 +4,6 @@ require 'active_type/version'
4
4
 
5
5
  require 'active_record'
6
6
 
7
- if ActiveRecord::VERSION::STRING == '4.2.0'
8
- raise(<<-MESSAGE.strip_heredoc)
9
- ActiveType is not compatible with ActiveRecord 4.2.0. Please upgrade to 4.2.1
10
- For details see https://github.com/makandra/active_type/issues/31
11
- MESSAGE
12
- end
13
-
14
7
  module ActiveType
15
8
  extend ActiveSupport::Autoload
16
9
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  - Henning Koch
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -45,57 +44,26 @@ dependencies:
45
44
  requirements:
46
45
  - - ">="
47
46
  - !ruby/object:Gem::Version
48
- version: '3.2'
47
+ version: '6.1'
49
48
  type: :runtime
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
52
  - - ">="
54
53
  - !ruby/object:Gem::Version
55
- version: '3.2'
54
+ version: '6.1'
56
55
  description: Make any Ruby object quack like ActiveRecord
57
56
  email: tobias.kraze@makandra.de
58
57
  executables: []
59
58
  extensions: []
60
59
  extra_rdoc_files: []
61
60
  files:
62
- - ".github/workflows/test.yml"
63
- - ".gitignore"
64
- - ".rspec"
65
- - ".ruby-version"
66
61
  - CHANGELOG.md
67
- - Gemfile
68
- - Gemfile.5.2.mysql2
69
- - Gemfile.5.2.mysql2.lock
70
- - Gemfile.5.2.pg
71
- - Gemfile.5.2.pg.lock
72
- - Gemfile.5.2.sqlite3
73
- - Gemfile.5.2.sqlite3.lock
74
- - Gemfile.6.0.sqlite3
75
- - Gemfile.6.0.sqlite3.lock
76
- - Gemfile.6.1.pg
77
- - Gemfile.6.1.pg.lock
78
- - Gemfile.6.1.sqlite3
79
- - Gemfile.6.1.sqlite3.lock
80
- - Gemfile.7.0.pg
81
- - Gemfile.7.0.pg.lock
82
- - Gemfile.7.0.sqlite3
83
- - Gemfile.7.0.sqlite3.lock
84
- - Gemfile.7.1.pg
85
- - Gemfile.7.1.pg.lock
86
- - Gemfile.7.1.sqlite3
87
- - Gemfile.7.1.sqlite3.lock
88
- - Gemfile.7.2.pg
89
- - Gemfile.7.2.pg.lock
90
- - Gemfile.7.2.sqlite3
91
- - Gemfile.7.2.sqlite3.lock
92
- - Gemfile.lock
93
62
  - LICENSE
94
63
  - README.md
95
- - Rakefile
96
- - active_type.gemspec
97
64
  - lib/active_type.rb
98
65
  - lib/active_type/change_association.rb
66
+ - lib/active_type/marshalling.rb
99
67
  - lib/active_type/mutation_after_cast_error.rb
100
68
  - lib/active_type/nested_attributes.rb
101
69
  - lib/active_type/nested_attributes/association.rb
@@ -121,7 +89,6 @@ metadata:
121
89
  bug_tracker_uri: https://github.com/makandra/active_type/issues
122
90
  changelog_uri: https://github.com/makandra/active_type/blob/master/CHANGELOG.md
123
91
  rubygems_mfa_required: 'true'
124
- post_install_message:
125
92
  rdoc_options: []
126
93
  require_paths:
127
94
  - lib
@@ -129,15 +96,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
96
  requirements:
130
97
  - - ">="
131
98
  - !ruby/object:Gem::Version
132
- version: 2.5.0
99
+ version: 2.7.0
133
100
  required_rubygems_version: !ruby/object:Gem::Requirement
134
101
  requirements:
135
102
  - - ">="
136
103
  - !ruby/object:Gem::Version
137
104
  version: '0'
138
105
  requirements: []
139
- rubygems_version: 3.4.10
140
- signing_key:
106
+ rubygems_version: 3.6.9
141
107
  specification_version: 4
142
108
  summary: Make any Ruby object quack like ActiveRecord
143
109
  test_files: []
@@ -1,134 +0,0 @@
1
- name: Tests
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
- branches: [main]
8
-
9
- jobs:
10
- test_sqlite:
11
- runs-on: ubuntu-20.04
12
-
13
- strategy:
14
- fail-fast: false
15
- matrix:
16
- include:
17
- - ruby: "2.5.5"
18
- gemfile: Gemfile.5.2.sqlite3
19
- - ruby: "2.7.7"
20
- gemfile: Gemfile.5.2.sqlite3
21
- - ruby: "3.0.5"
22
- gemfile: Gemfile.6.0.sqlite3
23
- - ruby: "3.0.5"
24
- gemfile: Gemfile.6.1.sqlite3
25
- - ruby: "3.0.5"
26
- gemfile: Gemfile.7.0.sqlite3
27
- - ruby: "3.1.3"
28
- gemfile: Gemfile.7.0.sqlite3
29
- - ruby: "3.2.0"
30
- gemfile: Gemfile.7.0.sqlite3
31
- - ruby: "3.2.0"
32
- gemfile: Gemfile.7.1.sqlite3
33
- - ruby: "3.2.0"
34
- gemfile: Gemfile.7.2.sqlite3
35
- env:
36
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
37
-
38
- steps:
39
- - uses: actions/checkout@v3
40
- - name: Install ruby
41
- uses: ruby/setup-ruby@v1
42
- with:
43
- ruby-version: ${{ matrix.ruby }}
44
- bundler-cache: true
45
- - name: Run tests
46
- run: bundle exec rake spec
47
-
48
- test_mysql:
49
- runs-on: ubuntu-20.04
50
-
51
- services:
52
- mysql:
53
- image: mysql:5.6
54
- env:
55
- MYSQL_ROOT_PASSWORD: password
56
- ports:
57
- - 3306:3306
58
- options: >-
59
- --health-cmd="mysqladmin ping"
60
- --health-interval=10s
61
- --health-timeout=5s
62
- --health-retries=3
63
-
64
- strategy:
65
- fail-fast: false
66
- matrix:
67
- include:
68
- - ruby: "2.7.7"
69
- gemfile: Gemfile.5.2.mysql2
70
- env:
71
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
72
-
73
- steps:
74
- - uses: actions/checkout@v3
75
- - name: Install ruby
76
- uses: ruby/setup-ruby@v1
77
- with:
78
- ruby-version: ${{ matrix.ruby }}
79
- bundler-cache: true
80
- - name: Setup databases
81
- run: |
82
- mysql -e 'create database IF NOT EXISTS active_type_test;' -u root --password=password -P 3306 -h 127.0.0.1
83
- - name: Run tests
84
- run: bundle exec rake spec
85
-
86
- test_pg:
87
- runs-on: ubuntu-20.04
88
-
89
- services:
90
- postgres:
91
- image: postgres
92
- env:
93
- POSTGRES_PASSWORD: postgres
94
- POSTGRES_DB: active_type_test
95
- options: >-
96
- --health-cmd pg_isready
97
- --health-interval 10s
98
- --health-timeout 5s
99
- --health-retries 5
100
- ports:
101
- - 5432:5432
102
-
103
- strategy:
104
- fail-fast: false
105
- matrix:
106
- include:
107
- - ruby: "2.5.5"
108
- gemfile: Gemfile.5.2.pg
109
- - ruby: "2.7.7"
110
- gemfile: Gemfile.5.2.pg
111
- - ruby: "3.0.5"
112
- gemfile: Gemfile.6.1.pg
113
- - ruby: "3.0.5"
114
- gemfile: Gemfile.7.0.pg
115
- - ruby: "3.1.3"
116
- gemfile: Gemfile.7.0.pg
117
- - ruby: "3.2.0"
118
- gemfile: Gemfile.7.0.pg
119
- - ruby: "3.2.0"
120
- gemfile: Gemfile.7.1.pg
121
- - ruby: "3.2.0"
122
- gemfile: Gemfile.7.2.pg
123
- env:
124
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
125
-
126
- steps:
127
- - uses: actions/checkout@v3
128
- - name: Install ruby
129
- uses: ruby/setup-ruby@v1
130
- with:
131
- ruby-version: ${{ matrix.ruby }}
132
- bundler-cache: true
133
- - name: Run tests
134
- run: bundle exec rake spec
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- doc
2
- pkg
3
- tags
4
- *.gem
5
- .idea
6
- tmp
7
- spec/support/database.yml
8
- .bundle
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.2
data/Gemfile DELETED
@@ -1 +0,0 @@
1
- Gemfile.7.0.sqlite3
data/Gemfile.5.2.mysql2 DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'activerecord', '~>5.1.0'
4
- gem 'rspec', '~>3.4'
5
- gem 'mysql2'
6
- gem 'rake'
7
- gem 'gemika'
8
-
9
- gem 'active_type', :path => '.'
@@ -1,59 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- active_type (2.5.1)
5
- activerecord (>= 3.2)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (5.1.7)
11
- activesupport (= 5.1.7)
12
- activerecord (5.1.7)
13
- activemodel (= 5.1.7)
14
- activesupport (= 5.1.7)
15
- arel (~> 8.0)
16
- activesupport (5.1.7)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- arel (8.0.0)
22
- concurrent-ruby (1.1.7)
23
- diff-lcs (1.4.4)
24
- gemika (0.5.0)
25
- i18n (1.8.5)
26
- concurrent-ruby (~> 1.0)
27
- minitest (5.14.2)
28
- mysql2 (0.5.3)
29
- rake (13.0.1)
30
- rspec (3.10.0)
31
- rspec-core (~> 3.10.0)
32
- rspec-expectations (~> 3.10.0)
33
- rspec-mocks (~> 3.10.0)
34
- rspec-core (3.10.0)
35
- rspec-support (~> 3.10.0)
36
- rspec-expectations (3.10.0)
37
- diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.10.0)
39
- rspec-mocks (3.10.0)
40
- diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.10.0)
42
- rspec-support (3.10.0)
43
- thread_safe (0.3.6)
44
- tzinfo (1.2.8)
45
- thread_safe (~> 0.1)
46
-
47
- PLATFORMS
48
- ruby
49
-
50
- DEPENDENCIES
51
- active_type!
52
- activerecord (~> 5.1.0)
53
- gemika
54
- mysql2
55
- rake
56
- rspec (~> 3.4)
57
-
58
- BUNDLED WITH
59
- 2.2.27