credere 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +25 -27
- data/app/views/layouts/credere/_navigation.html.erb +1 -1
- data/app/views/layouts/credere/application.html.erb +1 -1
- data/lib/credere/version.rb +1 -1
- data/lib/generators/credere/USAGE +0 -10
- data/lib/generators/credere/id_to_uuid_generator.rb +12 -0
- data/lib/generators/credere/templates/id_to_uuid_migration.rb +101 -0
- data/lib/generators/credere/templates/tenant_migration.rb +2 -2
- data/lib/generators/credere/templates/update_migration.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df241e74cbe54c0d5579b1cd2818db405c4ec1325bc97c2aff138e10f791cd32
|
4
|
+
data.tar.gz: 6aba4d648903d013a981daeb4764acc7f6854eaeeba73fabd7aab13d13a579e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bf4dae13f82850a2388dc9a84f79bc221fc94072033d4febe22d64faaac6e63e41b6406855bbdd72917fa71b5ece6daddcf7344cda5a665b04e99d3587a7243
|
7
|
+
data.tar.gz: 805f93e48c080a7bafeaed677758621e3f43187a3f5ff40c507e88a71dc23d8954c3b3dd351e9bb692c1ccf0e8254a3c23400c358269fb09dd7886337da7a2c9
|
data/README.markdown
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
credere
|
2
2
|
=================
|
3
|
-
<!-- [![Build Status](https://travis-ci.org/legalshield/credere.svg?branch=master)](https://travis-ci.org/legalshield/credere) [![Coverage Status](https://coveralls.io/repos/github/legalshield/credere/badge.svg?branch=master)](https://coveralls.io/github/legalshield/credere?branch=master) -->
|
4
3
|
|
5
4
|
The credere plugin is a Ruby on Rails Engine which provides a double entry accounting system for your application.
|
6
5
|
|
@@ -10,8 +9,6 @@ Compatibility
|
|
10
9
|
* Ruby versions: MRI 2.2.2+ (should work with earlier versions if using Rails 4)
|
11
10
|
* Rails versions: ~> 5.0, ~> 4.0
|
12
11
|
|
13
|
-
For earlier versions, and upgrading, please see the section titled [Previous Versions](https://github.com/legalshield/credere#previous-versions)
|
14
|
-
|
15
12
|
Installation
|
16
13
|
============
|
17
14
|
|
@@ -286,7 +283,7 @@ rake db:migrate
|
|
286
283
|
- Add an initializer to your Rails application, i.e. `config/initializers/credere.rb`
|
287
284
|
|
288
285
|
```ruby
|
289
|
-
|
286
|
+
Credere.config do |config|
|
290
287
|
config.enable_tenancy = true
|
291
288
|
config.tenant_class = 'Tenant'
|
292
289
|
end
|
@@ -305,6 +302,29 @@ entry = Credere::Entry.new(
|
|
305
302
|
{:account => credit_account, :amount => 100.00}])
|
306
303
|
```
|
307
304
|
|
305
|
+
If you are pre-seeding a system, or are adding Credere to a system with existing Users (or whatever you are associating your leger entries with) you may wish to consider scripting the creation of your Book of Accounts for all Users.
|
306
|
+
|
307
|
+
UUID Support
|
308
|
+
============
|
309
|
+
|
310
|
+
Not every system supports basic integer IDs for primary keys. By default, Credere uses integers for primary keys, but offers the ability to use UUIDs for the primary keys through the following migration.
|
311
|
+
|
312
|
+
*NOTE: This migration will need to be run _after_ the multitenancy support migration*
|
313
|
+
|
314
|
+
```sh
|
315
|
+
bundle exec rails g credere:id_to_uuid
|
316
|
+
```
|
317
|
+
|
318
|
+
- Run the migration
|
319
|
+
|
320
|
+
```sh
|
321
|
+
rake db:migrate
|
322
|
+
```
|
323
|
+
|
324
|
+
Credere should now be set up to utilize your UUIDs.
|
325
|
+
|
326
|
+
*NOTE: This should be done during initial installation only. Running this at any other time will cause a loss of data.*
|
327
|
+
|
308
328
|
Reporting Views
|
309
329
|
===============
|
310
330
|
|
@@ -312,7 +332,7 @@ The Engine provides controllers and views for rendering basic reports, including
|
|
312
332
|
|
313
333
|
These views and controllers are read-only for reporting purposes. It is assumed entry creation will occur within your applications code.
|
314
334
|
|
315
|
-
Routing is supplied via an engine mount point. credere can be mounted on a subpath in your existing Rails
|
335
|
+
Routing is supplied via an engine mount point. credere can be mounted on a subpath in your existing Rails app by adding the following to your routes.rb:
|
316
336
|
|
317
337
|
```ruby
|
318
338
|
mount Credere::Engine => "/credere", :as => "credere"
|
@@ -320,34 +340,12 @@ mount Credere::Engine => "/credere", :as => "credere"
|
|
320
340
|
|
321
341
|
*NOTE: The `Credere::ApplicationController` does not currently support authentication. If you enable routing, the views will be publicly available on your mount point. Authentication can be added by overriding the controller.*
|
322
342
|
|
323
|
-
<!-- *Future versions of Credere will allow for customization of authentication.* -->
|
324
|
-
|
325
343
|
|
326
344
|
Previous Versions
|
327
345
|
=================
|
328
346
|
|
329
|
-
<!-- For the rails 3 version, you can go here:
|
330
|
-
|
331
|
-
[https://github.com/legalshield/credere/tree/rails3](https://github.com/legalshield/credere/tree/rails3)
|
332
|
-
|
333
|
-
For the rails 2 version, you can go here:
|
334
|
-
|
335
|
-
[https://github.com/legalshield/credere/tree/rails2](https://github.com/legalshield/credere/tree/rails2)
|
336
|
-
|
337
|
-
* Gems in RubyGems.org >= 0.5.0 support Rails 3
|
338
|
-
* Gems in RubyGems.org >= 0.8.0 support Rails 4
|
339
|
-
* Gems in RubyGems.org >= 0.9.0 support Rails ~> 4.1 -->
|
340
347
|
* Gems in RubyGems.org >= 0.10.0 support Rails ~> 5.0
|
341
348
|
|
342
|
-
<!-- Upgrading from older versions
|
343
|
-
-----------------------------
|
344
|
-
|
345
|
-
As credere is still in alpha, there have been some breaking changes with previous versions.
|
346
|
-
|
347
|
-
If you are upgrading, please check the Wiki for guides on how to properly upgrade credere to deal with the changes:
|
348
|
-
|
349
|
-
[Upgrade Notes](https://github.com/legalshield/credere/wiki/Updrade-Notes) -->
|
350
|
-
|
351
349
|
Testing
|
352
350
|
=======
|
353
351
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<span class="icon-bar"></span>
|
9
9
|
<span class="icon-bar"></span>
|
10
10
|
</button>
|
11
|
-
<a class="navbar-brand" href="/">
|
11
|
+
<a class="navbar-brand" href="/"> Credere</a>
|
12
12
|
</div>
|
13
13
|
<div class="collapse navbar-collapse">
|
14
14
|
<ul class="nav navbar-nav">
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
-
<title>
|
5
|
+
<title>Credere</title>
|
6
6
|
<%= stylesheet_link_tag "credere/application", media: "all" %>
|
7
7
|
<%= javascript_include_tag "credere/application" %>
|
8
8
|
<%= csrf_meta_tags %>
|
data/lib/credere/version.rb
CHANGED
@@ -10,13 +10,3 @@ Installation:
|
|
10
10
|
|
11
11
|
Once generated, simply run:
|
12
12
|
rake db:migrate
|
13
|
-
|
14
|
-
Upgrade < 0.8 -> 0.9+:
|
15
|
-
rails g credere:upgrade_credere
|
16
|
-
|
17
|
-
This will:
|
18
|
-
Create a migration in the application for renaming the
|
19
|
-
"Transaction" table, columns and indexes to "Entry" tables.
|
20
|
-
|
21
|
-
Once generated, simply run:
|
22
|
-
rake db:migrate
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# lib/generators/credere/credere_generator.rb
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
require_relative 'base_generator'
|
5
|
+
|
6
|
+
module Credere
|
7
|
+
class IdToUuidGenerator < BaseGenerator
|
8
|
+
def create_migration_file
|
9
|
+
migration_template 'id_to_uuid_migration.rb', 'db/migrate/id_to_uuid_credere_tables.rb'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
class IdToUuidCredereTables < ActiveRecord::Migration[5.2]
|
2
|
+
def up
|
3
|
+
# Migrate all integer IDs to UUID in all Credere tables.
|
4
|
+
add_column :credere_accounts, :uuid, :uuid, default: -> { "uuid_generate_v4()" }, null: false
|
5
|
+
|
6
|
+
change_table :credere_accounts do |t|
|
7
|
+
t.remove :id
|
8
|
+
t.rename :uuid, :id
|
9
|
+
end
|
10
|
+
|
11
|
+
if column_exists? :credere_accounts, :tenant_id
|
12
|
+
add_column :credere_accounts, :tenant_uuid, :uuid, default: -> { "uuid_generate_v4()" }, null: false
|
13
|
+
|
14
|
+
change_table :credere_accounts do |t|
|
15
|
+
t.remove :tenant_id
|
16
|
+
t.rename :tenant_uuid, :tenant_id
|
17
|
+
end
|
18
|
+
|
19
|
+
add_index :credere_accounts, :tenant_id
|
20
|
+
end
|
21
|
+
|
22
|
+
execute "ALTER TABLE credere_accounts ADD PRIMARY KEY (id);"
|
23
|
+
|
24
|
+
add_column :credere_amounts, :uuid, :uuid, default: -> { "uuid_generate_v4()" }, null: false
|
25
|
+
add_column :credere_amounts, :account_uuid, :uuid, default: -> { "uuid_generate_v4()" }, null: false
|
26
|
+
add_column :credere_amounts, :entry_uuid, :uuid, default: -> { "uuid_generate_v4()" }, null: false
|
27
|
+
|
28
|
+
change_table :credere_amounts do |t|
|
29
|
+
t.remove :id
|
30
|
+
t.rename :uuid, :id
|
31
|
+
t.remove :account_id
|
32
|
+
t.rename :account_uuid, :account_id
|
33
|
+
t.remove :entry_id
|
34
|
+
t.rename :entry_uuid, :entry_id
|
35
|
+
end
|
36
|
+
|
37
|
+
add_index :credere_amounts, :account_id
|
38
|
+
add_index :credere_amounts, :entry_id
|
39
|
+
|
40
|
+
execute "ALTER TABLE credere_amounts ADD PRIMARY KEY (id);"
|
41
|
+
|
42
|
+
add_column :credere_entries, :uuid, :uuid, default: -> { "uuid_generate_v4()" }, null: false
|
43
|
+
|
44
|
+
change_table :credere_entries do |t|
|
45
|
+
t.remove :id
|
46
|
+
t.rename :uuid, :id
|
47
|
+
end
|
48
|
+
|
49
|
+
execute "ALTER TABLE credere_entries ADD PRIMARY KEY (id);"
|
50
|
+
end
|
51
|
+
|
52
|
+
def down
|
53
|
+
# Migrate all UUID IDs to integers in all Credere tables. Why would you want to?
|
54
|
+
add_column :credere_accounts, :temp_id, :integer, null: false
|
55
|
+
|
56
|
+
change_table :credere_accounts do |t|
|
57
|
+
t.remove :id
|
58
|
+
t.rename :temp_id, :id
|
59
|
+
end
|
60
|
+
|
61
|
+
if column_exists? :credere_accounts, :tenant_id
|
62
|
+
add_column :credere_accounts, :temp_tenant_id, :integer
|
63
|
+
|
64
|
+
change_table :credere_accounts do |t|
|
65
|
+
t.remove :tenant_id
|
66
|
+
t.rename :temp_tenant_id, :tenant_id
|
67
|
+
end
|
68
|
+
|
69
|
+
add_index :credere_accounts, :tenant_id
|
70
|
+
end
|
71
|
+
|
72
|
+
execute "ALTER TABLE credere_accounts ADD PRIMARY KEY (id);"
|
73
|
+
|
74
|
+
add_column :credere_amounts, :temp_id, :integer, null: false
|
75
|
+
add_column :credere_amounts, :temp_account_id, :integer, null: false
|
76
|
+
add_column :credere_amounts, :temp_entry_id, :integer, null: false
|
77
|
+
|
78
|
+
change_table :credere_amounts do |t|
|
79
|
+
t.remove :id
|
80
|
+
t.rename :temp_id, :id
|
81
|
+
t.remove :temp_account_id
|
82
|
+
t.rename :temp_account_uuid, :account_id
|
83
|
+
t.remove :temp_entry_id
|
84
|
+
t.rename :temp_entry_uuid, :entry_id
|
85
|
+
end
|
86
|
+
|
87
|
+
add_index :credere_amounts, :account_id
|
88
|
+
add_index :credere_amounts, :entry_id
|
89
|
+
|
90
|
+
execute "ALTER TABLE credere_amounts ADD PRIMARY KEY (id);"
|
91
|
+
|
92
|
+
add_column :credere_entries, :temp_id, :integer, null: false
|
93
|
+
|
94
|
+
change_table :credere_entries do |t|
|
95
|
+
t.remove :id
|
96
|
+
t.rename :temp_id, :id
|
97
|
+
end
|
98
|
+
|
99
|
+
execute "ALTER TABLE credere_entries ADD PRIMARY KEY (id);"
|
100
|
+
end
|
101
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class TenantCredereTables < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
|
-
# add a tenant column to
|
3
|
+
# add a tenant column to credere accounts table.
|
4
4
|
add_column :credere_accounts, :tenant_id, :integer, index: true
|
5
5
|
end
|
6
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Eric Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,11 +52,11 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: The
|
55
|
+
description: The Credere plugin provides a complete double entry accounting system
|
56
56
|
for use in any Ruby on Rails application. The plugin follows general Double Entry
|
57
57
|
Bookkeeping practices. All calculations are done using BigDecimal in order to prevent
|
58
58
|
floating point rounding errors. The plugin requires a decimal type on your database
|
59
|
-
as well.
|
59
|
+
as well. It is strongly based off of the Plutus gem.
|
60
60
|
email: ericroberts@legalshieldcorp.com
|
61
61
|
executables: []
|
62
62
|
extensions: []
|
@@ -111,7 +111,9 @@ files:
|
|
111
111
|
- lib/generators/credere/add_date_upgrade_generator.rb
|
112
112
|
- lib/generators/credere/base_generator.rb
|
113
113
|
- lib/generators/credere/credere_generator.rb
|
114
|
+
- lib/generators/credere/id_to_uuid_generator.rb
|
114
115
|
- lib/generators/credere/templates/add_date_migration.rb
|
116
|
+
- lib/generators/credere/templates/id_to_uuid_migration.rb
|
115
117
|
- lib/generators/credere/templates/migration.rb
|
116
118
|
- lib/generators/credere/templates/tenant_migration.rb
|
117
119
|
- lib/generators/credere/templates/update_migration.rb
|
@@ -145,7 +147,8 @@ files:
|
|
145
147
|
- spec/support/amount_shared_examples.rb
|
146
148
|
- spec/support/factory_girl_helpers.rb
|
147
149
|
homepage: http://github.com/legalshield/credere
|
148
|
-
licenses:
|
150
|
+
licenses:
|
151
|
+
- MIT
|
149
152
|
metadata: {}
|
150
153
|
post_install_message:
|
151
154
|
rdoc_options: []
|