keepr 0.7.0 → 0.8.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: d2680eedcb47403d6bcbae90de674d208f8a9ab06570b20e122c0c641c42e114
4
- data.tar.gz: c33827bf895e0e15ea763a5217eb2efa3ff0f9fa5a48ae74ee4c07750a56ee28
3
+ metadata.gz: 52559eefe26a6b165210c72a477351e559f0b936bd098880f134991a981490ce
4
+ data.tar.gz: 448a874a9a03197c51e9df977c523539eb552881cf83a7ff3ddfd37be887d41a
5
5
  SHA512:
6
- metadata.gz: f9c5e2703b9ce01a2aed1b29c096ffc879518a10528fb1f31092c6fb5602c7b566eade957974ec381904525c3d3ff455937fbb38f12fa700778b6d9b06d1256f
7
- data.tar.gz: bb4d6e29f65dd0fac3d5b3f3ff764511387e543371df91318bf1117b1a8d4aba9bc9dc245ac94b6a07bdf063aa8f5a93ed70322899067306881b3162e1ac4091
6
+ metadata.gz: 621ee808cd1ff8e361e7d00e3a67690a24befdbe40b6e35757aee1b260eb9141e155e99f2a4707614b612e5a19c32c2a0d29e8ae042546f49cf7f81525a874c5
7
+ data.tar.gz: 86c1dc8d10841836a66db76393d379b2b57c9d623effcf32e63ba18ee481199ce7b97a2a0736b90100f3c7d0e3d64b7e1a2ddbdd61cd909f53810fba77f04ec8
@@ -0,0 +1,38 @@
1
+ name: Test
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: ['3.0', '3.1', '3.2']
13
+ rails: ['6.1', '7.0', '7.1']
14
+
15
+ name: Test against Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup System
21
+ run: sudo apt-get install libsqlite3-dev
22
+
23
+ - name: Setup Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby }}
27
+
28
+ - name: Install gems
29
+ env:
30
+ MATRIX_RAILS_VERSION: ${{ matrix.rails }}
31
+ run: |
32
+ export BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/ci/Gemfile-rails-${MATRIX_RAILS_VERSION}"
33
+ bundle install --jobs 4 --retry 3
34
+
35
+ - name: RSpec
36
+ env:
37
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
38
+ run: bundle exec rake
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2020 Georg Ledermann <georg@ledermann.dev>
1
+ Copyright (c) 2013-2023 Georg Ledermann <georg@ledermann.dev>
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,25 +2,25 @@
2
2
 
3
3
  This Ruby gem provides a double entry accounting system for use in any Rails application. It stores all the data via ActiveRecord in the SQL database.
4
4
 
5
- [![Build Status](https://travis-ci.org/ledermann/keepr.svg?branch=master)](https://travis-ci.org/ledermann/keepr)
5
+ [![Build Status](https://github.com/ledermann/keepr/workflows/Test/badge.svg?branch=master)](https://github.com/ledermann/keepr/actions)
6
6
  [![Code Climate](https://codeclimate.com/github/ledermann/keepr/badges/gpa.svg)](https://codeclimate.com/github/ledermann/keepr)
7
7
  [![Coverage Status](https://coveralls.io/repos/github/ledermann/keepr/badge.svg?branch=master)](https://coveralls.io/github/ledermann/keepr?branch=master)
8
8
 
9
9
  ## Features
10
10
 
11
- * Journal entries with two or more postings
11
+ * Journal entries with two or more postings follow the [Double Entry](https://www.accountingcoach.com/blog/what-is-the-double-entry-system) principle
12
12
  * Accounts (including subaccounts and groups)
13
- * Tax
14
- * Cost center
15
- * Balance sheet
16
- * Profit and loss statement
17
- * DATEV export
13
+ * Taxes
14
+ * Cost centers
15
+ * Balance sheets
16
+ * Profit and loss statements
17
+ * DATEV exports
18
18
 
19
19
 
20
20
  ## Dependencies
21
21
 
22
- * Ruby 2.5+
23
- * Rails 4.2+ (including Rails 6.0)
22
+ * Ruby 3.0+
23
+ * Rails 6.1+ (including Rails 7.1)
24
24
 
25
25
 
26
26
  ## Installation
@@ -38,9 +38,92 @@ Or install it yourself as:
38
38
  $ gem install keepr
39
39
 
40
40
 
41
+ ## Getting started
42
+
43
+ After installation run the following:
44
+
45
+ rails g keepr:migration
46
+ rails db:migrate
47
+
48
+ This will create the database migration files and add new models.
49
+
41
50
  ## Usage
51
+ ### Account
52
+ All accounting entries are stored inside "accounts", per standard accounting
53
+ principles. To create an account, use the following format:
54
+
55
+ Keepr::Account.create!(number: 27, name: 'Software', kind: :asset)
56
+
57
+ "kind" is one of following values:
58
+
59
+ [asset liability revenue expense forward debtor creditor]
60
+
61
+ Accounts can have "child" accounts. All entries posted in a child account will
62
+ be shown in the "parent" account as well. To create a child account:
63
+
64
+ account_1400 = Keepr::Account.create!(number: 1400, name: 'Software', kind: :expense)
65
+ account_14001 = Keepr::Account.create!(number: 14001, name: 'Rails', parent: account_1400 , kind: :expense)
66
+
67
+ Accounts can be organised inside of groups:
68
+
69
+ group = Keepr::Group.create!(is_result: true, target: :liability, name: 'foo')
70
+ Keepr::Account.create!(number: 100, name: 'Trade payable', kind: :liability, keepr_group: group)
71
+
72
+ Groups also allow a parent/child hierarchy:
73
+
74
+ parent_group = Keepr::Group.create!(is_result: true, target: :liability, name: 'foo')
75
+ child_group = parent_group.children.create! name: 'Bar'
76
+
77
+ ### Journal
78
+
79
+
80
+ Simple journal:
81
+
82
+ simple_journal = Keepr::Journal.create keepr_postings_attributes: [
83
+ { keepr_account: account_1000, amount: 100.99, side: 'debit' },
84
+ { keepr_account: account_1200, amount: 100.99, side: 'credit' }
85
+ ]
86
+
87
+
88
+ Complex journal:
89
+
90
+ complex_journal = Keepr::Journal.create keepr_postings_attributes: [
91
+ { keepr_account: account_4920, amount: 8.40, side: 'debit' },
92
+ { keepr_account: account_1576, amount: 1.60, side: 'debit' },
93
+ { keepr_account: account_1600, amount: 10.00, side: 'credit' }
94
+ ]
95
+
96
+ Entries can be locked for changing data:
97
+
98
+ simple_journal.update! permanent: true
99
+
100
+
101
+ ### Account balance
102
+ We can get an account balance as follows:
103
+
104
+ account_1000.balance
105
+
106
+ account_1000.balance(Date.today)
107
+
108
+ account_1000.balance(Date.yesterday...Date.today)
109
+
110
+ ### Tax account
111
+
112
+ // Create Tax account
113
+ Keepr::Account.create! number: 1776, name: 'Umsatzsteuer 19%', kind: :asset
114
+
115
+ tax = Keepr::Tax.create! name: 'USt19',
116
+ description: 'Umsatzsteuer 19%',
117
+ value: 19.0,
118
+ keepr_account: tax_account
119
+
120
+ // Create a sale account that links to the tax account
121
+ account = Keepr::Account.new number: 8400,
122
+ name: 'Erlöse 19% USt',
123
+ kind: :revenue,
124
+ keepr_tax: tax
125
+
42
126
 
43
- TODO: Write usage instructions here
44
127
 
45
128
 
46
129
  ## Contributing
@@ -64,4 +147,4 @@ TODO: Write usage instructions here
64
147
  * https://github.com/bigfleet/accountable
65
148
 
66
149
 
67
- Copyright (c) 2013-2020 [Georg Ledermann](https://ledermann.dev), released under the MIT license
150
+ Copyright (c) 2013-2023 [Georg Ledermann](https://ledermann.dev), released under the MIT license
@@ -1,12 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', '~> 6.0.0'
3
+ gem 'activerecord', '~> 6.1.0'
4
4
  gem 'ancestry', '>= 3.1.0'
5
5
  gem 'sqlite3', "~> 1.4"
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
8
  gem 'simplecov'
9
- gem 'coveralls', '~> 0.8'
9
+ gem 'coveralls_reborn'
10
10
  gem 'database_cleaner'
11
11
  gem 'factory_bot'
12
12
  gem 'datev'
@@ -1,12 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', '~> 5.0.7'
3
+ gem 'activerecord', '~> 7.0.0'
4
4
  gem 'ancestry', '>= 3.1.0'
5
- gem 'sqlite3', '~> 1.3.6'
5
+ gem 'sqlite3', "~> 1.4"
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
8
  gem 'simplecov'
9
- gem 'coveralls', '~> 0.8'
9
+ gem 'coveralls_reborn'
10
10
  gem 'database_cleaner'
11
11
  gem 'factory_bot'
12
12
  gem 'datev'
@@ -1,12 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', '~> 4.2.11'
3
+ gem 'activerecord', '~> 7.1.0'
4
4
  gem 'ancestry', '>= 3.1.0'
5
- gem 'sqlite3', '~> 1.3.6'
5
+ gem 'sqlite3', "~> 1.4"
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
8
  gem 'simplecov'
9
- gem 'coveralls', '~> 0.8'
9
+ gem 'coveralls_reborn'
10
10
  gem 'database_cleaner'
11
11
  gem 'factory_bot'
12
12
  gem 'datev'
data/keepr.gemspec CHANGED
@@ -13,19 +13,19 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'Some basic ActiveRecord models to build a double entry bookkeeping application'
14
14
  spec.homepage = 'https://github.com/ledermann/keepr'
15
15
  spec.license = 'MIT'
16
- spec.required_ruby_version = '>= 2.5'
16
+ spec.required_ruby_version = '>= 3.0'
17
17
 
18
18
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'activerecord', '>= 4.2'
23
+ spec.add_dependency 'activerecord', '>= 6.1'
24
24
  spec.add_dependency 'ancestry', '>= 3.1.0'
25
25
  spec.add_dependency 'datev', '>= 0.5.0'
26
26
 
27
27
  spec.add_development_dependency 'bundler'
28
- spec.add_development_dependency 'coveralls', '~> 0.8'
28
+ spec.add_development_dependency 'coveralls_reborn'
29
29
  spec.add_development_dependency 'database_cleaner'
30
30
  spec.add_development_dependency 'factory_bot'
31
31
  spec.add_development_dependency 'rake'
@@ -15,11 +15,22 @@ module Keepr
15
15
  end
16
16
 
17
17
  def self.next_migration_number(dirname)
18
- if ActiveRecord::Base.timestamped_migrations
18
+ if timestamped_migrations?
19
19
  Time.now.utc.strftime('%Y%m%d%H%M%S')
20
20
  else
21
21
  format('%.3d', (current_migration_number(dirname) + 1))
22
22
  end
23
23
  end
24
+
25
+ def self.timestamped_migrations?
26
+ (
27
+ ActiveRecord::Base.respond_to?(:timestamped_migrations) &&
28
+ ActiveRecord::Base.timestamped_migrations
29
+ ) ||
30
+ (
31
+ ActiveRecord.respond_to?(:timestamped_migrations) &&
32
+ ActiveRecord.timestamped_migrations
33
+ )
34
+ end
24
35
  end
25
36
  end
data/lib/keepr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Keepr
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keepr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Ledermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-09 00:00:00.000000000 Z
11
+ date: 2023-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ancestry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: coveralls
70
+ name: coveralls_reborn
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.8'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.8'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: database_cleaner
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -170,17 +170,15 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
+ - ".github/workflows/main.yml"
173
174
  - ".gitignore"
174
- - ".travis.yml"
175
175
  - Gemfile
176
176
  - LICENSE.txt
177
177
  - README.md
178
178
  - Rakefile
179
- - ci/Gemfile-rails-4-2
180
- - ci/Gemfile-rails-5-0
181
- - ci/Gemfile-rails-5-1
182
- - ci/Gemfile-rails-5-2
183
- - ci/Gemfile-rails-6-0
179
+ - ci/Gemfile-rails-6.1
180
+ - ci/Gemfile-rails-7.0
181
+ - ci/Gemfile-rails-7.1
184
182
  - keepr.gemspec
185
183
  - lib/generators/keepr/migration/migration_generator.rb
186
184
  - lib/generators/keepr/migration/templates/migration.rb
@@ -239,14 +237,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
237
  requirements:
240
238
  - - ">="
241
239
  - !ruby/object:Gem::Version
242
- version: '2.5'
240
+ version: '3.0'
243
241
  required_rubygems_version: !ruby/object:Gem::Requirement
244
242
  requirements:
245
243
  - - ">="
246
244
  - !ruby/object:Gem::Version
247
245
  version: '0'
248
246
  requirements: []
249
- rubygems_version: 3.1.4
247
+ rubygems_version: 3.5.1
250
248
  signing_key:
251
249
  specification_version: 4
252
250
  summary: Some basic ActiveRecord models to build a double entry bookkeeping application
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- os: linux
2
- dist: xenial
3
- language: ruby
4
- rvm:
5
- - 2.5.8
6
- - 2.6.6
7
- - 2.7.2
8
- gemfile:
9
- - ci/Gemfile-rails-4-2
10
- - ci/Gemfile-rails-5-0
11
- - ci/Gemfile-rails-5-1
12
- - ci/Gemfile-rails-5-2
13
- - ci/Gemfile-rails-6-0
14
- matrix:
15
- exclude:
16
- - rvm: 2.7.2
17
- gemfile: ci/Gemfile-rails-4-2
18
- script:
19
- - bundle exec rake
20
- before_install:
21
- - gem update bundler
data/ci/Gemfile-rails-5-1 DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'activerecord', '~> 5.1.7'
4
- gem 'ancestry', '>= 3.1.0'
5
- gem "sqlite3", "~> 1.3", ">= 1.3.6"
6
- gem 'rake'
7
- gem 'rspec'
8
- gem 'simplecov'
9
- gem 'coveralls', '~> 0.8'
10
- gem 'database_cleaner'
11
- gem 'factory_bot'
12
- gem 'datev'
data/ci/Gemfile-rails-5-2 DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'activerecord', '~> 5.2.3'
4
- gem 'ancestry', '>= 3.1.0'
5
- gem "sqlite3", "~> 1.3", ">= 1.3.6"
6
- gem 'rake'
7
- gem 'rspec'
8
- gem 'simplecov'
9
- gem 'coveralls', '~> 0.8'
10
- gem 'database_cleaner'
11
- gem 'factory_bot'
12
- gem 'datev'