couch_potato 1.12.1 → 1.13.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
  SHA256:
3
- metadata.gz: 0d0a16b09e8b1a251f8639d5960980da2b50f1deb41a619253322013d24b12ae
4
- data.tar.gz: 8b6e6c2a0b8e81399a1bd5addf528583b157109971948e59f9a2cf96dcd858d9
3
+ metadata.gz: c36fc0534a7564b1fcf3b2a59ca91e3e4e97452c2a74d77e30540eb4b7617211
4
+ data.tar.gz: b1583818a743459e8ab86d88350f7ad5c6953c058c3b49c8b90da50610bdd197
5
5
  SHA512:
6
- metadata.gz: 2d7ed319a85dbe37898f1892ff355b6e3f0f7a559b86f4f31b8d59aa69417e403e075f41f236dadc3c46f317e29526049804607767e44a8ecddc8aeff1ecf128
7
- data.tar.gz: a8655290fc89f80185b21ec5722867644dacd2c7990779df325bb0ab0697156a213a0a2e6d7d492a48d1ed8dbc0a0b2a09f5aeb61f48b3c8a1e85a10236d75cc
6
+ metadata.gz: ceffb27b13b2cf9825cd5fcf507bb0e13a6ed9b5caa612fd1f5f27ba98934eb9dae34c4f4dc70835352a9176bc4562e49da12d489b925ebbeb37a3c9eaa964f4
7
+ data.tar.gz: c5e01a2d0d83ea11b14a618f218fe3ff66af35be893a4d74644089938b852045c52a8e1d8ecf31b53e70396737f9db0a8849ef0fbacd843c89137ec4d8bfc0e2
@@ -16,18 +16,13 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [2.7, "3.0", "3.1", "jruby"]
19
+ ruby: ["3.0", "3.1", "3.2", "jruby"]
20
20
  gemfile:
21
- - "active_support_6_0"
22
- - "active_support_6_1"
23
21
  - "active_support_7_0"
22
+ - "active_support_7_1"
24
23
  exclude:
25
24
  - ruby: "jruby"
26
25
  gemfile: "active_support_7_0"
27
- - ruby: "3.0"
28
- gemfile: "active_support_6_0"
29
- - ruby: "3.1"
30
- gemfile: "active_support_6_0"
31
26
  steps:
32
27
  - uses: actions/checkout@v2
33
28
  - name: Set up CouchDB
data/CHANGES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Changes
2
2
 
3
+ # 1.13.0
4
+
5
+ - add Ruby 3.2 support
6
+ - remove Ruby 2.7 support
7
+ - add active_support 7.1 support
8
+ - remove active_support 6.x support
9
+
3
10
  # 1.12.1
4
11
 
5
12
  - re-enable aliases when parsing config yaml file
data/Rakefile CHANGED
@@ -26,8 +26,8 @@ end
26
26
 
27
27
  desc 'Run all specs for all gemfiles'
28
28
  task :spec do
29
- %w(7_0 6_1 6_0 5_2 5_1 5_0).each do |version|
30
- Bundler.with_clean_env do
29
+ %w(7_1 7_0).each do |version|
30
+ Bundler.with_original_env do
31
31
  puts "Running tests with ActiveSupport #{version.sub('_', '.')}"
32
32
  sh "env BUNDLE_GEMFILE=gemfiles/active_support_#{version} bundle install"
33
33
  sh "env BUNDLE_GEMFILE=gemfiles/active_support_#{version} bundle exec rake spec_unit spec_functional"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.version = CouchPotato::RSPEC_VERSION
12
12
  s.platform = Gem::Platform::RUBY
13
13
 
14
- s.add_dependency 'rspec', '~>3.4'
14
+ s.add_dependency 'rspec', '~>3.12'
15
15
  s.add_development_dependency 'rake'
16
16
  s.add_dependency 'execjs', '~>2.7'
17
17
 
data/couch_potato.gemspec CHANGED
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
13
13
  s.version = CouchPotato::VERSION
14
14
  s.platform = Gem::Platform::RUBY
15
15
 
16
- s.add_dependency 'activemodel', ['>= 5.0', '< 7.1']
16
+ s.add_dependency 'activemodel', ['>= 5.0', '< 8.0']
17
17
  s.add_dependency 'couchrest', '~>2.0.0'
18
18
  s.add_dependency 'json', '~> 2.3'
19
19
 
20
20
  s.add_development_dependency 'rake', '~>12.0'
21
- s.add_development_dependency 'rspec', '~>3.10.0'
21
+ s.add_development_dependency 'rspec', '~>3.12.0'
22
22
  s.add_development_dependency 'timecop'
23
23
  s.add_development_dependency 'tzinfo'
24
24
 
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'railties', '~>7.0.4'
3
+ gem 'railties', '~>7.0.8'
4
4
  gem 'activemodel'
5
5
  gem 'execjs'
6
6
 
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'railties', '~>6.1'
3
+ gem 'railties', '~>7.1.3'
4
4
  gem 'activemodel'
5
5
  gem 'execjs'
6
6
 
@@ -93,7 +93,11 @@ module CouchPotato
93
93
  active_support_module.module_eval do
94
94
  undef_method(name) if instance_methods.include?(name)
95
95
  end
96
- cache = send(:attribute_method_matchers_cache)
96
+ cache = if respond_to?(:attribute_method_matchers_cache, true) # activemodel 7.0
97
+ send(:attribute_method_matchers_cache)
98
+ else # activemodel 7.1
99
+ send(:attribute_method_patterns_cache)
100
+ end
97
101
  cache.delete(name)
98
102
 
99
103
  define_attribute_method name
@@ -15,12 +15,13 @@ module CouchPotato
15
15
  end
16
16
 
17
17
  class SimpleProperty #:nodoc:
18
- attr_accessor :name, :type
18
+ attr_accessor :name, :type, :default_value
19
19
 
20
20
  def initialize(owner_clazz, name, options = {})
21
21
  self.name = name
22
22
  @setter_name = "#{name}="
23
23
  self.type = options[:type]
24
+ self.default_value = options[:default]
24
25
  @type_caster = TypeCaster.new
25
26
  owner_clazz.send :include, PropertyMethods unless owner_clazz.ancestors.include?(PropertyMethods)
26
27
 
@@ -32,7 +32,7 @@ module CouchPotato
32
32
  def cast_native(value, type)
33
33
  if type && !value.is_a?(type)
34
34
 
35
- if %w[Integer Bignum Fixnum].include?(type.to_s)
35
+ if %w[Integer Bignum].include?(type.to_s)
36
36
  value.to_s.scan(NUMBER_REGEX).join.to_d.round unless value.blank?
37
37
  elsif type == Float
38
38
  value.to_s.scan(NUMBER_REGEX).join.to_f unless value.blank?
@@ -1,4 +1,4 @@
1
1
  module CouchPotato
2
- VERSION = '1.12.1'.freeze
3
- RSPEC_VERSION = '4.0.2'.freeze
2
+ VERSION = '1.13.0'.freeze
3
+ RSPEC_VERSION = '4.1.0'.freeze
4
4
  end
@@ -9,7 +9,6 @@ end
9
9
  class Plant
10
10
  include CouchPotato::Persistence
11
11
  property :leaf_count
12
- property :typed_leaf_count, type: Fixnum
13
12
  property :integer_something, type: Integer
14
13
  property :typed_leaf_size, type: Float
15
14
  property :branch, type: Branch
@@ -42,7 +41,7 @@ describe 'attributes' do
42
41
 
43
42
  expect(plant.attributes).to eq('leaf_count' => 1, 'created_at' => nil,
44
43
  'integer_something' => nil,
45
- 'updated_at' => nil, 'typed_leaf_count' => nil,
44
+ 'updated_at' => nil,
46
45
  'typed_leaf_size' => nil, 'branch' => nil)
47
46
  end
48
47
 
@@ -112,25 +111,25 @@ describe 'attributes' do
112
111
  end
113
112
 
114
113
  describe 'integer' do
115
- it 'rounds a float to a fixnum' do
114
+ it 'rounds a float to an integer' do
116
115
  @plant.integer_something = 4.5
117
116
 
118
117
  expect(@plant.integer_something).to eq(5)
119
118
  end
120
119
 
121
- it 'converts a string into a fixnum' do
120
+ it 'converts a string into an integer' do
122
121
  @plant.integer_something = '4'
123
122
 
124
123
  expect(@plant.integer_something).to eq(4)
125
124
  end
126
125
 
127
- it 'converts a string into a negative fixnum' do
126
+ it 'converts a string into a negative integer' do
128
127
  @plant.integer_something = '-4'
129
128
 
130
129
  expect(@plant.integer_something).to eq(-4)
131
130
  end
132
131
 
133
- it 'leaves a fixnum as is' do
132
+ it 'leaves an integer as is' do
134
133
  @plant.integer_something = 4
135
134
 
136
135
  expect(@plant.integer_something).to eq(4)
@@ -161,57 +160,6 @@ describe 'attributes' do
161
160
  end
162
161
  end
163
162
 
164
-
165
- describe 'fixnum' do
166
- it 'rounds a float to a fixnum' do
167
- @plant.typed_leaf_count = 4.5
168
-
169
- expect(@plant.typed_leaf_count).to eq(5)
170
- end
171
-
172
- it 'converts a string into a fixnum' do
173
- @plant.typed_leaf_count = '4'
174
-
175
- expect(@plant.typed_leaf_count).to eq(4)
176
- end
177
-
178
- it 'converts a string into a negative fixnum' do
179
- @plant.typed_leaf_count = '-4'
180
-
181
- expect(@plant.typed_leaf_count).to eq(-4)
182
- end
183
-
184
- it 'leaves a fixnum as is' do
185
- @plant.typed_leaf_count = 4
186
-
187
- expect(@plant.typed_leaf_count).to eq(4)
188
- end
189
-
190
- it 'leaves nil as is' do
191
- @plant.typed_leaf_count = nil
192
-
193
- expect(@plant.typed_leaf_count).to be_nil
194
- end
195
-
196
- it 'sets the attributes to zero if a string given' do
197
- @plant.typed_leaf_count = 'x'
198
-
199
- expect(@plant.typed_leaf_count).to eq(0)
200
- end
201
-
202
- it 'parses numbers out of a string' do
203
- @plant.typed_leaf_count = 'x123'
204
-
205
- expect(@plant.typed_leaf_count).to eq(123)
206
- end
207
-
208
- it 'sets the attributes to nil if given a blank string' do
209
- @plant.typed_leaf_count = ''
210
-
211
- expect(@plant.typed_leaf_count).to be_nil
212
- end
213
- end
214
-
215
163
  context 'float' do
216
164
  it 'converts a number in a string with a decimal place' do
217
165
  @plant.typed_leaf_size = '0.5001'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.1
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-31 00:00:00.000000000 Z
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.1'
22
+ version: '8.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '8.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: couchrest
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 3.10.0
81
+ version: 3.12.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 3.10.0
88
+ version: 3.12.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: timecop
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -130,9 +130,8 @@ files:
130
130
  - Rakefile
131
131
  - couch_potato-rspec.gemspec
132
132
  - couch_potato.gemspec
133
- - gemfiles/active_support_6_0
134
- - gemfiles/active_support_6_1
135
133
  - gemfiles/active_support_7_0
134
+ - gemfiles/active_support_7_1
136
135
  - init.rb
137
136
  - lib/core_ext/date.rb
138
137
  - lib/core_ext/time.rb
@@ -231,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
230
  - !ruby/object:Gem::Version
232
231
  version: '0'
233
232
  requirements: []
234
- rubygems_version: 3.3.3
233
+ rubygems_version: 3.4.7
235
234
  signing_key:
236
235
  specification_version: 4
237
236
  summary: Ruby persistence layer for CouchDB
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'railties', '~>6.0.2.2'
4
- gem 'activemodel'
5
- gem 'execjs'
6
-
7
- gemspec name: 'couch_potato', path: '..'