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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f15a987389dd56fc45dcddf6145adddbfe47bfc8b3b7666180c1bd51d7638a1
4
- data.tar.gz: 1a23700ce3d891c26c35e53fe2d2e3c2d07dea910b0e6057a71aa17740933b6b
3
+ metadata.gz: 65db41fdb8408b564c411d3ccd1af1e472283c5c3d3f315eafc32b5a9f027315
4
+ data.tar.gz: 5741d0ea7a24844389f7f522fca71f180b4271d0572647d0ccbb110ad1506d03
5
5
  SHA512:
6
- metadata.gz: 3642a8c7ad8a7eb8ff0e039cb77abadb6ee11b4d53521e53028d2b4c74ad71e8a3ed1ab3762e36e55067d8e31813dfde1c0a2fdf1ae15fdf7583bac6f4ba65b4
7
- data.tar.gz: 68285488fe760b730d09fd54640e2529bd579dbb3227cd313842ae8c7f5d4aa6db6d46d0e7bc7dc7a03541c0cf8de78a6aadb731fb654252df217f2ffa4a7a38
6
+ metadata.gz: ee011dcc7d65f146f331243798ce8c2198994215f9b6a565b1e859270eb38a852bd137bcb45dcdb0cd60eae7b43ba90d57d70dffc2669213b42e21123f954d65
7
+ data.tar.gz: 0a509e297d204a95326072236cc036b493b95e90204bc5170410b07163b9760135797e3928fedd97668c242565addd26eb76845523cacd2a72b9e3089a0cdfcf
@@ -12,12 +12,19 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  ruby:
15
- - '2.6'
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.6'
18
+ gem.required_ruby_version = '>= 2.7'
19
19
 
20
- gem.add_dependency 'activerecord', '>= 5.2', '< 7'
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'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: "../"
4
+
5
+ gem "activerecord", "~> 7.0.0"
@@ -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(args)
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(args)
30
+ save_amounts! if super
31
31
  end
32
32
  end
33
33
 
@@ -1,5 +1,5 @@
1
1
  # Copyright 2015-2021, Instacart
2
2
 
3
3
  module Amountable
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
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
@@ -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
- config = ActiveRecord::Base.configurations[db_name]
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.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: 2021-10-01 00:00:00.000000000 Z
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: '7'
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: '7'
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.6'
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.22
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.