acts_as_account 3.4.1 → 3.4.2
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +20 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +15 -11
- data/VERSION +1 -1
- data/acts_as_account.gemspec +7 -5
- data/acts_as_account.sqlite +0 -0
- data/docker-compose.yml +12 -0
- data/features/db/database.yml +13 -5
- data/features/support/db.rb +12 -0
- data/features/support/env.rb +4 -3
- data/lib/acts_as_account/journal.rb +2 -2
- data/lib/acts_as_account/version.rb +1 -1
- data/log/.keep +0 -0
- metadata +38 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c967cdb648bf8b3606030d45e54fd95150457fc7e1e380719d4f9d042d144af7
|
|
4
|
+
data.tar.gz: b0810ca4cc4444d56612cc8f6a3a127735923ba071dcf20492ec2ef608cc8767
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1f991f1af38f2ae583e4e88f96b2d9f9866959dde98b13eca27b9933fa7ff2d2e2b383977682fac25a2168c9f6d1a558434a5b74910992c7f994828325fe1d1
|
|
7
|
+
data.tar.gz: eaab3ae3d6555781b9de03274459c890ecf8f4391118e3923e791c676423cabd5094feac97b3047972f2425710814abc838556ae75ec22a6c0012a5557589e1b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2024-11-01 v3.4.2
|
|
4
|
+
|
|
5
|
+
* Add compact to attributes handling of transfer method:
|
|
6
|
+
+ Use `posting1.attributes.compact` and `posting2.attributes.compact` instead
|
|
7
|
+
of just `posting1.attributes` and `posting2.attributes`.
|
|
8
|
+
* Update logging configuration and ignore log files:
|
|
9
|
+
+ Update `DATABASE_LOG` handling in `features/support/env.rb`
|
|
10
|
+
+ Add `log/*` to `.gitignore`
|
|
11
|
+
+ Modify `transfer` method in `lib/acts_as_account/journal.rb` to safely
|
|
12
|
+
reference objects.
|
|
13
|
+
+ Added log directory
|
|
14
|
+
* Add mysql for database testing:
|
|
15
|
+
+ Add `mysql2` as a development dependency to Gemfile
|
|
16
|
+
+ Update `acts_as_account.gemspec` to reflect new dependencies and version
|
|
17
|
+
+ Update Rakefile to be able to use `mysql2` for connecting to MySQL database
|
|
18
|
+
+ Add Docker Compose file for running MySQL service for testing
|
|
19
|
+
+ Update database.yml files to point to MySQL or SQLite databases
|
|
20
|
+
+ Create a new file features/support/db.rb for setting up the database connection
|
|
21
|
+
* Update copyright year upto **2024**
|
|
22
|
+
|
|
3
23
|
## 2024-10-28 v3.4.1
|
|
4
24
|
|
|
5
25
|
* Improved account management features:
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -52,4 +52,4 @@ This gem was written for the payment backend of betterplace.org by [Thies C. Arn
|
|
|
52
52
|
|
|
53
53
|
## Copyright
|
|
54
54
|
|
|
55
|
-
Copyright (c) 2010
|
|
55
|
+
Copyright (c) 2010-2024 [gut.org gAG](https://gut.org), released under the [Apache License v2.0](LICENSE).
|
data/Rakefile
CHANGED
|
@@ -8,10 +8,16 @@ GemHadar do
|
|
|
8
8
|
email 'developers@betterplace.org'
|
|
9
9
|
homepage "https://github.com/betterplace/acts_as_account"
|
|
10
10
|
summary 'acts_as_account implements double entry accounting for Rails models'
|
|
11
|
-
description
|
|
11
|
+
description <<~EOT
|
|
12
|
+
acts_as_account implements double entry accounting for Rails models. Your
|
|
13
|
+
models get accounts and you can do consistent transactions between them.
|
|
14
|
+
Since the documentation is sparse, see the transfer.feature for usage
|
|
15
|
+
examples.
|
|
16
|
+
EOT
|
|
17
|
+
|
|
12
18
|
test_dir 'tests'
|
|
13
19
|
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
|
|
14
|
-
'.AppleDouble', 'tags', '.byebug_history', '.DS_Store'
|
|
20
|
+
'.AppleDouble', 'tags', '.byebug_history', '.DS_Store', '/log/*'
|
|
15
21
|
readme 'README.md'
|
|
16
22
|
title "#{name.camelize} -- More Math in Ruby"
|
|
17
23
|
licenses << 'Apache-2.0'
|
|
@@ -20,23 +26,21 @@ GemHadar do
|
|
|
20
26
|
dependency 'actionpack' , '>= 4.1', '<8'
|
|
21
27
|
development_dependency 'cucumber'
|
|
22
28
|
development_dependency 'sqlite3'
|
|
29
|
+
development_dependency 'mysql2'
|
|
23
30
|
development_dependency 'rspec'
|
|
24
31
|
development_dependency 'simplecov'
|
|
25
32
|
development_dependency 'database_cleaner'
|
|
26
33
|
development_dependency 'rubocop'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def connect_database
|
|
30
|
-
require 'active_record'
|
|
31
|
-
require 'yaml'
|
|
32
|
-
db_config = YAML.load_file('features/db/database.yml')
|
|
33
|
-
ActiveRecord::Base.establish_connection(db_config).lease_connection
|
|
34
|
+
development_dependency 'debug'
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
namespace :features do
|
|
38
|
+
task :connect_database do
|
|
39
|
+
load("#{__dir__}/features/support/db.rb")
|
|
40
|
+
end
|
|
41
|
+
|
|
37
42
|
desc "create test database out of db/schema.rb"
|
|
38
|
-
task :create_database do
|
|
39
|
-
connect_database
|
|
43
|
+
task :create_database => :connect_database do
|
|
40
44
|
load("#{__dir__}/features/db/schema.rb")
|
|
41
45
|
end
|
|
42
46
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.4.
|
|
1
|
+
3.4.2
|
data/acts_as_account.gemspec
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: acts_as_account 3.4.
|
|
2
|
+
# stub: acts_as_account 3.4.2 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "acts_as_account".freeze
|
|
6
|
-
s.version = "3.4.
|
|
6
|
+
s.version = "3.4.2".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
10
10
|
s.authors = ["Thies C. Arntzen, Norman Timmler, Matthias Frick, Phillip Oertel".freeze]
|
|
11
|
-
s.date = "2024-
|
|
12
|
-
s.description = "acts_as_account implements double entry accounting for Rails models. Your
|
|
11
|
+
s.date = "2024-11-01"
|
|
12
|
+
s.description = "acts_as_account implements double entry accounting for Rails models. Your\nmodels get accounts and you can do consistent transactions between them.\nSince the documentation is sparse, see the transfer.feature for usage\nexamples.\n".freeze
|
|
13
13
|
s.email = "developers@betterplace.org".freeze
|
|
14
14
|
s.extra_rdoc_files = ["README.md".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/configuration.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze]
|
|
15
|
-
s.files = [".github/workflows/lint.yml".freeze, ".github/workflows/tests.yml".freeze, ".gitignore".freeze, ".rubocop.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "acts_as_account.gemspec".freeze, "acts_as_account.sqlite".freeze, "cucumber.yml".freeze, "features/account/account_creation.feature".freeze, "features/db/database.yml".freeze, "features/db/schema.rb".freeze, "features/step_definitions/account_steps.rb".freeze, "features/support/abstract_user.rb".freeze, "features/support/cheque.rb".freeze, "features/support/env.rb".freeze, "features/support/inheriting_user.rb".freeze, "features/support/user.rb".freeze, "features/transfer/journal_creation.feature".freeze, "features/transfer/transfer.feature".freeze, "init.rb".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/configuration.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze]
|
|
15
|
+
s.files = [".github/workflows/lint.yml".freeze, ".github/workflows/tests.yml".freeze, ".gitignore".freeze, ".rubocop.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "acts_as_account.gemspec".freeze, "acts_as_account.sqlite".freeze, "cucumber.yml".freeze, "docker-compose.yml".freeze, "features/account/account_creation.feature".freeze, "features/db/database.yml".freeze, "features/db/schema.rb".freeze, "features/step_definitions/account_steps.rb".freeze, "features/support/abstract_user.rb".freeze, "features/support/cheque.rb".freeze, "features/support/db.rb".freeze, "features/support/env.rb".freeze, "features/support/inheriting_user.rb".freeze, "features/support/user.rb".freeze, "features/transfer/journal_creation.feature".freeze, "features/transfer/transfer.feature".freeze, "init.rb".freeze, "lib/acts_as_account.rb".freeze, "lib/acts_as_account/account.rb".freeze, "lib/acts_as_account/active_record_extensions.rb".freeze, "lib/acts_as_account/configuration.rb".freeze, "lib/acts_as_account/global_account.rb".freeze, "lib/acts_as_account/journal.rb".freeze, "lib/acts_as_account/manually_created_account.rb".freeze, "lib/acts_as_account/posting.rb".freeze, "lib/acts_as_account/rails.rb".freeze, "lib/acts_as_account/transfer.rb".freeze, "lib/acts_as_account/version.rb".freeze, "log/.keep".freeze]
|
|
16
16
|
s.homepage = "https://github.com/betterplace/acts_as_account".freeze
|
|
17
17
|
s.licenses = ["Apache-2.0".freeze]
|
|
18
18
|
s.rdoc_options = ["--title".freeze, "ActsAsAccount -- More Math in Ruby".freeze, "--main".freeze, "README.md".freeze]
|
|
@@ -24,10 +24,12 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.19".freeze])
|
|
25
25
|
s.add_development_dependency(%q<cucumber>.freeze, [">= 0".freeze])
|
|
26
26
|
s.add_development_dependency(%q<sqlite3>.freeze, [">= 0".freeze])
|
|
27
|
+
s.add_development_dependency(%q<mysql2>.freeze, [">= 0".freeze])
|
|
27
28
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
|
|
28
29
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
|
29
30
|
s.add_development_dependency(%q<database_cleaner>.freeze, [">= 0".freeze])
|
|
30
31
|
s.add_development_dependency(%q<rubocop>.freeze, [">= 0".freeze])
|
|
32
|
+
s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
|
|
31
33
|
s.add_runtime_dependency(%q<activerecord>.freeze, [">= 5.1".freeze, "< 8".freeze])
|
|
32
34
|
s.add_runtime_dependency(%q<actionpack>.freeze, [">= 4.1".freeze, "< 8".freeze])
|
|
33
35
|
end
|
data/acts_as_account.sqlite
CHANGED
|
Binary file
|
data/docker-compose.yml
ADDED
data/features/db/database.yml
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
mysql:
|
|
2
|
+
adapter: mysql2
|
|
3
|
+
encoding: utf8
|
|
4
|
+
database: acts_as_account
|
|
5
|
+
username: root
|
|
6
|
+
host: 127.0.0.1
|
|
7
|
+
port: 3306
|
|
8
|
+
sqlite:
|
|
9
|
+
adapter: sqlite3
|
|
10
|
+
encoding: utf8
|
|
11
|
+
database: acts_as_account.sqlite
|
|
12
|
+
username: root
|
|
13
|
+
host: localhost
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'active_record'
|
|
2
|
+
require 'yaml'
|
|
3
|
+
db_type = ENV.fetch('DATABASE_TYPE', 'sqlite')
|
|
4
|
+
db_config = YAML.load_file('features/db/database.yml').fetch(db_type)
|
|
5
|
+
if db_type == 'mysql'
|
|
6
|
+
ActiveRecord::Base.establish_connection(db_config.except('database')).with_connection do |c|
|
|
7
|
+
c.execute p %{CREATE DATABASE IF NOT EXISTS #{db_config.fetch('database')}}
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
ActiveRecord::Base.establish_connection(db_config).with_connection do |c|
|
|
11
|
+
c.execute %{ SELECT 1}
|
|
12
|
+
end
|
data/features/support/env.rb
CHANGED
|
@@ -6,9 +6,7 @@ if ENV['START_SIMPLECOV'].to_i == 1
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
require 'acts_as_account'
|
|
9
|
-
|
|
10
|
-
db_config = YAML.load_file(__dir__ + '/../db/database.yml')
|
|
11
|
-
ActiveRecord::Base.establish_connection(db_config)
|
|
9
|
+
require_relative 'db'
|
|
12
10
|
|
|
13
11
|
require 'database_cleaner'
|
|
14
12
|
require 'database_cleaner/cucumber'
|
|
@@ -30,4 +28,7 @@ Before do
|
|
|
30
28
|
# Default values:
|
|
31
29
|
# config.persist_attributes_on_account = true
|
|
32
30
|
end
|
|
31
|
+
if ENV['DATABASE_LOG'].to_i == 1 && ActiveRecord::Base.logger.nil?
|
|
32
|
+
ActiveRecord::Base.logger = Logger.new(File.open("log/cucumber.log", 'a'))
|
|
33
|
+
end
|
|
33
34
|
end
|
|
@@ -37,7 +37,7 @@ module ActsAsAccount
|
|
|
37
37
|
"amount: #{amount}",
|
|
38
38
|
"from: #{from_account.id}",
|
|
39
39
|
"to: #{to_account.id}",
|
|
40
|
-
"reference: #{reference.class.name}(#{reference
|
|
40
|
+
"reference: #{reference.class.name}(#{reference&.id})",
|
|
41
41
|
"valuta: #{valuta}",
|
|
42
42
|
].join(' ')
|
|
43
43
|
)
|
|
@@ -52,7 +52,7 @@ module ActsAsAccount
|
|
|
52
52
|
posting1 = build_posting(-amount, from_account, to_account, reference, valuta)
|
|
53
53
|
posting2 = build_posting( amount, to_account, from_account, reference, valuta)
|
|
54
54
|
|
|
55
|
-
result = postings.model.insert_all([ posting1.attributes, posting2.attributes ])
|
|
55
|
+
result = postings.model.insert_all([ posting1.attributes.compact, posting2.attributes.compact ])
|
|
56
56
|
|
|
57
57
|
update_attributes_on(from_account, -amount)
|
|
58
58
|
update_attributes_on(to_account, amount)
|
data/log/.keep
ADDED
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acts_as_account
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.4.
|
|
4
|
+
version: 3.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thies C. Arntzen, Norman Timmler, Matthias Frick, Phillip Oertel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gem_hadar
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: mysql2
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: rspec
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -108,6 +122,20 @@ dependencies:
|
|
|
108
122
|
- - ">="
|
|
109
123
|
- !ruby/object:Gem::Version
|
|
110
124
|
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: debug
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
111
139
|
- !ruby/object:Gem::Dependency
|
|
112
140
|
name: activerecord
|
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -148,9 +176,11 @@ dependencies:
|
|
|
148
176
|
- - "<"
|
|
149
177
|
- !ruby/object:Gem::Version
|
|
150
178
|
version: '8'
|
|
151
|
-
description:
|
|
152
|
-
|
|
153
|
-
|
|
179
|
+
description: |
|
|
180
|
+
acts_as_account implements double entry accounting for Rails models. Your
|
|
181
|
+
models get accounts and you can do consistent transactions between them.
|
|
182
|
+
Since the documentation is sparse, see the transfer.feature for usage
|
|
183
|
+
examples.
|
|
154
184
|
email: developers@betterplace.org
|
|
155
185
|
executables: []
|
|
156
186
|
extensions: []
|
|
@@ -181,12 +211,14 @@ files:
|
|
|
181
211
|
- acts_as_account.gemspec
|
|
182
212
|
- acts_as_account.sqlite
|
|
183
213
|
- cucumber.yml
|
|
214
|
+
- docker-compose.yml
|
|
184
215
|
- features/account/account_creation.feature
|
|
185
216
|
- features/db/database.yml
|
|
186
217
|
- features/db/schema.rb
|
|
187
218
|
- features/step_definitions/account_steps.rb
|
|
188
219
|
- features/support/abstract_user.rb
|
|
189
220
|
- features/support/cheque.rb
|
|
221
|
+
- features/support/db.rb
|
|
190
222
|
- features/support/env.rb
|
|
191
223
|
- features/support/inheriting_user.rb
|
|
192
224
|
- features/support/user.rb
|
|
@@ -204,6 +236,7 @@ files:
|
|
|
204
236
|
- lib/acts_as_account/rails.rb
|
|
205
237
|
- lib/acts_as_account/transfer.rb
|
|
206
238
|
- lib/acts_as_account/version.rb
|
|
239
|
+
- log/.keep
|
|
207
240
|
homepage: https://github.com/betterplace/acts_as_account
|
|
208
241
|
licenses:
|
|
209
242
|
- Apache-2.0
|