Skip to content

Commit aa1cfbf

Browse files
authored
Merge branch 'main' into main
2 parents f8ef113 + 777c565 commit aa1cfbf

27 files changed

+117
-206
lines changed

.github/workflows/ruby.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
66
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
77

8-
name: Ruby
8+
name: CI
99

1010
on:
1111
push:
@@ -19,10 +19,12 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
ruby-version: ['3.0', '3.1', '3.2', '3.3']
22+
ruby-version: ['3.1', '3.2', '3.3', '3.4']
2323
mongodb-version: ['4.4']
2424
sqlite-version: ['3.0']
2525

26+
name: Test (Ruby ${{ matrix.ruby-version }}, MongoDB ${{ matrix.mongodb-version }}, SQLite ${{ matrix.sqlite-version }})
27+
2628
steps:
2729
- uses: actions/checkout@v4
2830
- name: Set up Ruby

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
gemfiles/*.lock
33
Gemfile.lock
44

5+
spec/dummy/db/schema.rb
6+
57
# RVM / rbenv version files
68
.rvmrc
79
.rbenv-version
810
.ruby-version
911

1012
# dummy dbs
11-
*.sqlite3
13+
*.sqlite3*
1214

1315
# rcov generated
1416
coverage

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
## Unreleased
44

5+
- **Breaking change**: Drop support for Ruby < 3 and Rails < 6.1
6+
- **Breaking change**: Requires `money` gem version ~> 7.0
57
- Allow monetizing methods with kwargs
6-
- Fix money_only_cents for negative money
8+
- Fix `money_only_cents` for negative money
9+
- Allow `nil` to be set as the default currency
10+
- Portuguese translation for errors
711

812
## 1.15.0
913

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ James Chen
3131
Jamie Dyer
3232
Joe Frambach
3333
John Wood
34+
Julia López
3435
Kevin Sołtysiak
3536
Kirill Shamardin
3637
Michael J.

Gemfile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,22 @@ source 'https://rubygems.org'
22

33
gemspec
44

5+
gem "bigdecimal"
6+
gem "mutex_m"
7+
gem "benchmark"
8+
gem "drb"
9+
510
platforms :jruby do
611
gem "activerecord-jdbc-adapter"
712
gem "activerecord-jdbcsqlite3-adapter"
813
gem "jruby-openssl"
914
end
1015

1116
platforms :ruby do
12-
gem "sqlite3"
13-
end
14-
15-
platform :mri do
16-
# gem "ruby-prof", "~> 0.11.2"
17-
18-
case RUBY_VERSION
19-
when /^1.9/
20-
gem 'debugger'
21-
end
17+
gem "sqlite3", "~> 1.4"
2218
end
2319

2420
group :development do
2521
gem "pry"
26-
gem 'rb-inotify', '~> 0.9'
27-
gem 'guard'
28-
gem 'guard-rspec'
29-
gem 'guard-rails'
22+
gem "money", git: "https://github.com/RubyMoney/money.git"
3023
end

Guardfile

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class Transaction < ActiveRecord::Base
248248
monetize :price_cents
249249
monetize :tax_cents
250250
monetize :total_cents
251-
251+
252252
def total_cents
253253
price_cents + tax_cents
254254
end
@@ -576,12 +576,12 @@ For examples on using the test_helpers look at
576576

577577
## Supported ORMs/ODMs
578578

579-
* ActiveRecord (>= 3.x)
579+
* ActiveRecord (>= 6.1)
580580
* Mongoid (>= 2.x)
581581

582582
## Supported Ruby interpreters
583583

584-
* MRI Ruby >= 2.6
584+
* MRI Ruby >= 3.0
585585

586586
You can see a full list of the currently supported interpreters in
587587
[ruby.yml](https://github.com/RubyMoney/money-rails/blob/main/.github/workflows/ruby.yml)

Rakefile

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# encoding: utf-8
2-
31
require 'rubygems'
42
require 'bundler'
53
require 'bundler/gem_tasks'
@@ -15,8 +13,6 @@ end
1513
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
1614
GEMFILES_PATH = 'gemfiles/*.gemfile'.freeze
1715

18-
load 'rails/tasks/engine.rake' if File.exist?(APP_RAKEFILE)
19-
2016
require 'rake'
2117
require 'rspec/core/rake_task'
2218

@@ -28,22 +24,19 @@ task spec: :prepare_test_env
2824

2925
desc "Prepare money-rails engine test environment"
3026
task :prepare_test_env do
31-
Rake.application['app:db:drop:all'].invoke
32-
Rake.application['app:db:create'].invoke if Rails::VERSION::MAJOR >= 5
33-
Rake.application['app:db:migrate'].invoke
34-
Rake.application['app:db:test:prepare'].invoke
27+
load APP_RAKEFILE if File.exist?(APP_RAKEFILE)
28+
Rake.application["db:drop"].invoke
29+
Rake.application["db:create"].invoke
30+
Rake.application["db:migrate"].invoke
31+
Rake.application["db:test:prepare"].invoke
3532
end
3633

3734
def run_with_gemfile(gemfile)
3835
Bundler.with_original_env do
39-
begin
40-
sh "BUNDLE_GEMFILE='#{gemfile}' bundle install --quiet"
41-
Rake.application['app:db:create'].invoke
42-
Rake.application['app:db:test:prepare'].invoke
43-
sh "BUNDLE_GEMFILE='#{gemfile}' bundle exec rake spec"
44-
ensure
45-
Rake.application['app:db:drop:all'].execute
46-
end
36+
lockfile = "#{gemfile}.lock"
37+
File.delete(lockfile) if File.exist?(lockfile)
38+
sh "BUNDLE_GEMFILE=#{gemfile} bundle install --quiet"
39+
sh "BUNDLE_GEMFILE=#{gemfile} bundle exec rake spec"
4740
end
4841
end
4942

@@ -57,17 +50,10 @@ namespace :spec do
5750

5851
# Ruby 3 exclusions
5952
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
60-
# Rails 5 does not support ruby-3.0.0 https://github.com/rails/rails/issues/40938#issuecomment-751569171
6153
# Mongoid gem does not yet support ruby-3.0.0 https://github.com/mongodb/mongoid#compatibility
62-
next if framework == 'mongoid' || (framework == 'rails' && version == "5")
54+
next if framework == 'mongoid'
6355
end
6456

65-
# Skip Rails 7 unless the Ruby version is at least 2.7
66-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
67-
next if framework == 'rails' && version == "7"
68-
end
69-
70-
7157
frameworks_versions[framework] ||= []
7258
frameworks_versions[framework] << file_name
7359

config/locales/money.pt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pt:
2+
errors:
3+
messages:
4+
invalid_currency: tem um formato inválido (deve ser '100', '5%{decimal}24', ou '123%{thousands}456%{decimal}78'). Recebido %{currency}

gemfiles/rails5.gemfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)