amountable 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/CI.yml +8 -1
- data/amountable.gemspec +2 -2
- data/gemfiles/activerecord_7.0.gemfile +5 -0
- data/lib/amountable/table_methods.rb +4 -4
- data/lib/amountable/version.rb +1 -1
- data/lib/amountable.rb +2 -0
- data/spec/support/database.rb +8 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65db41fdb8408b564c411d3ccd1af1e472283c5c3d3f315eafc32b5a9f027315
|
4
|
+
data.tar.gz: 5741d0ea7a24844389f7f522fca71f180b4271d0572647d0ccbb110ad1506d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee011dcc7d65f146f331243798ce8c2198994215f9b6a565b1e859270eb38a852bd137bcb45dcdb0cd60eae7b43ba90d57d70dffc2669213b42e21123f954d65
|
7
|
+
data.tar.gz: 0a509e297d204a95326072236cc036b493b95e90204bc5170410b07163b9760135797e3928fedd97668c242565addd26eb76845523cacd2a72b9e3089a0cdfcf
|
data/.github/workflows/CI.yml
CHANGED
@@ -12,12 +12,19 @@ jobs:
|
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
14
|
ruby:
|
15
|
-
- '
|
15
|
+
- '3.1'
|
16
|
+
- '3.0'
|
16
17
|
- '2.7'
|
17
18
|
activerecord:
|
19
|
+
- '7.0'
|
18
20
|
- '6.1'
|
19
21
|
- '6.0'
|
20
22
|
- '5.2'
|
23
|
+
exclude:
|
24
|
+
- activerecord: '5.2'
|
25
|
+
ruby: '3.0'
|
26
|
+
- activerecord: '5.2'
|
27
|
+
ruby: '3.1'
|
21
28
|
services:
|
22
29
|
postgres:
|
23
30
|
image: postgres:12
|
data/amountable.gemspec
CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.test_files = gem.files.grep(%r{^spec/})
|
17
17
|
gem.require_paths = ['lib']
|
18
|
-
gem.required_ruby_version = '>= 2.
|
18
|
+
gem.required_ruby_version = '>= 2.7'
|
19
19
|
|
20
|
-
gem.add_dependency 'activerecord', '>= 5.2', '<
|
20
|
+
gem.add_dependency 'activerecord', '>= 5.2', '< 8'
|
21
21
|
gem.add_dependency 'activerecord-import', '>= 0.19.1'
|
22
22
|
gem.add_dependency 'money-rails', '>=1.7.0'
|
23
23
|
gem.add_dependency 'monetize'
|
@@ -19,15 +19,15 @@ module Amountable
|
|
19
19
|
amount.value
|
20
20
|
end
|
21
21
|
|
22
|
-
def save(args
|
22
|
+
def save(**args)
|
23
23
|
ActiveRecord::Base.transaction do
|
24
|
-
save_amounts if super
|
24
|
+
save_amounts if super
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def save!(args
|
28
|
+
def save!(**args)
|
29
29
|
ActiveRecord::Base.transaction do
|
30
|
-
save_amounts! if super
|
30
|
+
save_amounts! if super
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/lib/amountable/version.rb
CHANGED
data/lib/amountable.rb
CHANGED
@@ -119,6 +119,7 @@ module Amountable
|
|
119
119
|
super
|
120
120
|
end
|
121
121
|
end
|
122
|
+
ruby2_keywords :where if Module.private_method_defined?(:ruby2_keywords)
|
122
123
|
|
123
124
|
def where_json(opts, *rest)
|
124
125
|
values = []
|
@@ -136,6 +137,7 @@ module Amountable
|
|
136
137
|
query = [query.join(' AND ')] + values
|
137
138
|
where(query, *rest).where(opts, *rest)
|
138
139
|
end
|
140
|
+
ruby2_keywords :where_json if Module.private_method_defined?(:ruby2_keywords)
|
139
141
|
|
140
142
|
def pg_json_field_access(name, field = :cents)
|
141
143
|
name = name.to_sym
|
data/spec/support/database.rb
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
# Copyright 2015-2021, Instacart
|
2
2
|
|
3
|
+
require "activerecord-import/base"
|
4
|
+
|
3
5
|
db_name = ENV['DB'] || 'postgresql'
|
4
6
|
spec_dir = Pathname.new(File.dirname(__FILE__)) / '..'
|
5
7
|
database_yml = spec_dir.join('internal/config/database.yml')
|
6
8
|
|
7
9
|
fail "Please create #{database_yml} first to configure your database. Take a look at: #{database_yml}.sample" unless File.exist?(database_yml)
|
8
10
|
|
11
|
+
module ActiveRecord::Import::Connection
|
12
|
+
ruby2_keywords :establish_connection if Module.private_method_defined?(:ruby2_keywords)
|
13
|
+
end
|
14
|
+
|
9
15
|
ActiveRecord::Migration.verbose = false
|
10
16
|
ActiveRecord::Base.default_timezone = :utc
|
11
17
|
ActiveRecord::Base.configurations = YAML.load_file(database_yml)
|
12
18
|
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), '../debug.log'))
|
13
19
|
ActiveRecord::Base.logger.level = ENV['CI'] ? ::Logger::ERROR : ::Logger::DEBUG
|
14
|
-
|
20
|
+
configs = ActiveRecord::Base.configurations
|
21
|
+
config = configs.try(:find_db_config, db_name) || configs[db_name]
|
15
22
|
|
16
23
|
begin
|
17
24
|
ActiveRecord::Base.establish_connection(db_name.to_sym)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amountable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Turlay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
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.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activerecord-import
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- gemfiles/activerecord_5.2.gemfile
|
193
193
|
- gemfiles/activerecord_6.0.gemfile
|
194
194
|
- gemfiles/activerecord_6.1.gemfile
|
195
|
+
- gemfiles/activerecord_7.0.gemfile
|
195
196
|
- lib/amountable.rb
|
196
197
|
- lib/amountable/amount.rb
|
197
198
|
- lib/amountable/jsonb_methods.rb
|
@@ -222,14 +223,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
223
|
requirements:
|
223
224
|
- - ">="
|
224
225
|
- !ruby/object:Gem::Version
|
225
|
-
version: '2.
|
226
|
+
version: '2.7'
|
226
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
228
|
requirements:
|
228
229
|
- - ">="
|
229
230
|
- !ruby/object:Gem::Version
|
230
231
|
version: '0'
|
231
232
|
requirements: []
|
232
|
-
rubygems_version: 3.2.
|
233
|
+
rubygems_version: 3.2.32
|
233
234
|
signing_key:
|
234
235
|
specification_version: 4
|
235
236
|
summary: Easy Money fields for your Rails models.
|