plutus 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +82 -44
- data/app/models/plutus/account.rb +7 -2
- data/app/models/plutus/no_tenancy.rb +9 -0
- data/app/models/plutus/tenancy.rb +11 -0
- data/lib/generators/plutus/templates/tenant_migration.rb +6 -0
- data/lib/generators/plutus/tenancy_generator.rb +27 -0
- data/lib/plutus.rb +15 -0
- data/lib/plutus/version.rb +1 -1
- data/spec/models/tenancy_spec.rb +45 -0
- data/spec/spec_helper.rb +8 -3
- data/spec/support/active_support_helpers.rb +13 -0
- data/spec/support/factory_girl_helpers.rb +8 -0
- metadata +29 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5850f1e4f86a57e483ca5a836902f7bf9878834c
|
4
|
+
data.tar.gz: 79269ad5a37bedbd9b9d0f6a357c048b842016aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d1fdde28fb5f79f02420ab3def009c21fe665e9d428305b1c5427c37c797218ec89d81e3827894860d4d4f6e14f0f654d6a6cee169798613ddecb6179bf712
|
7
|
+
data.tar.gz: 2626117c0674a588f6f4213e548d47dbaf6865fcff4e49485fcad1490b1d25f9b411738a34e1b7a6ecf9a0ece691bbf39c8806fa673536bca041e75108d89ce3
|
data/README.markdown
CHANGED
@@ -7,20 +7,10 @@ The Plutus plugin is a Ruby on Rails Engine which provides a double entry accoun
|
|
7
7
|
Compatibility
|
8
8
|
=============
|
9
9
|
|
10
|
-
* Ruby versions: MRI 1.9.3, MRI 2.0, MRI 2.1, Rubinius 2.2, JRuby 1.7
|
10
|
+
* Ruby versions: MRI 1.9.3, MRI 2.0, MRI 2.1, Rubinius 2.2, JRuby 1.7+
|
11
11
|
* Rails versions: ~> 4.0
|
12
12
|
|
13
|
-
For
|
14
|
-
|
15
|
-
[https://github.com/mbulat/plutus](https://github.com/mbulat/plutus/tree/rails3)
|
16
|
-
|
17
|
-
For the rails 2 version, you can go here:
|
18
|
-
|
19
|
-
[https://github.com/mbulat/plutus/tree/rails2](https://github.com/mbulat/plutus/tree/rails2)
|
20
|
-
|
21
|
-
* Gems in RubyGems.org >= 0.5.0 support Rails 3
|
22
|
-
* Gems in RubyGems.org >= 0.8.0 support Rails 4
|
23
|
-
* Gems in RubyGems.org >= 0.9.0 support Rails ~> 4.1
|
13
|
+
For earlier versions, and upgrading, please see the section titled [Previous Versions](https://github.com/mbulat/plutus#previous-versions)
|
24
14
|
|
25
15
|
Installation
|
26
16
|
============
|
@@ -31,23 +21,12 @@ Installation
|
|
31
21
|
|
32
22
|
- run migrations `rake db:migrate`
|
33
23
|
|
34
|
-
Upgrading from < 0.9
|
35
|
-
=====================
|
36
|
-
|
37
|
-
Versions of Plutus prior to 0.9 used a "Transaction" class to keep track of entries. Rails 4.1 introduced a change that
|
38
|
-
raises an error with Plutus due to an ActiveRecord method conflict with "transaction". Therefore the Transaction class
|
39
|
-
has been renamed "Entry". To generate a migration which will update your database run the following:
|
40
|
-
|
41
|
-
- `rails g plutus:upgrade_plutus`
|
42
|
-
|
43
|
-
You only need to do this when upgrading a previously installed version of Plutus.
|
44
|
-
|
45
24
|
Overview
|
46
25
|
========
|
47
26
|
|
48
|
-
The plutus plugin provides a complete double entry accounting system for use in any Ruby on Rails application. The plugin follows general [Double Entry Bookkeeping](http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system) practices. All calculations are done using [BigDecimal](http://www.
|
27
|
+
The plutus plugin provides a complete double entry accounting system for use in any Ruby on Rails application. The plugin follows general [Double Entry Bookkeeping](http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system) practices. All calculations are done using [BigDecimal](http://www.ruby-doc.org/stdlib-2.1.0/libdoc/bigdecimal/rdoc/BigDecimal.html) in order to prevent floating point rounding errors. The plugin requires a decimal type on your database as well.
|
49
28
|
|
50
|
-
|
29
|
+
Plutus consists of tables that maintain your accounts, entries and debits and credits. Each entry can have many debits and credits. The entry table, which records your business transactions is, essentially, your accounting [Journal](http://en.wikipedia.org/wiki/Journal_entry).
|
51
30
|
|
52
31
|
Posting to a [Ledger](http://en.wikipedia.org/wiki/General_ledger) can be considered to happen automatically, since Accounts have the reverse `has_many` relationship to either its credit or debit entries.
|
53
32
|
|
@@ -64,7 +43,7 @@ The Account class represents accounts in the system. The Account table uses sing
|
|
64
43
|
Revenue | Credit | Increases in owners equity
|
65
44
|
Expense | Debit | Assets or services consumed in the generation of revenue
|
66
45
|
|
67
|
-
Your Book of Accounts needs to be created prior to recording any entries. The simplest method is to have a number of create methods in your db/seeds.rb file like so:
|
46
|
+
Your Book of Accounts needs to be created prior to recording any entries. The simplest method is to have a number of `create` methods in your db/seeds.rb file like so:
|
68
47
|
|
69
48
|
Plutus::Asset.create(:name => "Accounts Receivable")
|
70
49
|
Plutus::Asset.create(:name => "Cash")
|
@@ -84,9 +63,9 @@ Equation](http://en.wikipedia.org/wiki/Accounting_equation)
|
|
84
63
|
|
85
64
|
Assets = Liabilities + Owner's Equity
|
86
65
|
|
87
|
-
Every account object has a `has_many` association of credit and debit entries, which means that each account object also acts as its own [Ledger](http://en.wikipedia.org/wiki/General_ledger), and exposes a method to calculate the balance of the account.
|
66
|
+
Every account object has a `has_many` association of credit and debit entries, which means that each account object also acts as its own [Ledger](http://en.wikipedia.org/wiki/General_ledger), and exposes a method to calculate the balance of the account.
|
88
67
|
|
89
|
-
See the
|
68
|
+
See the `Plutus::Account`, `Plutus::Entry`, and `Plutus::Amount` classes for more information.
|
90
69
|
|
91
70
|
Examples
|
92
71
|
========
|
@@ -99,16 +78,16 @@ Let's assume we're accounting on an [Accrual basis](http://en.wikipedia.org/wiki
|
|
99
78
|
>> Plutus::Asset.create(:name => "Cash")
|
100
79
|
>> Plutus::Liability.create(:name => "Unearned Revenue")
|
101
80
|
|
102
|
-
Next we'll build the entry we want to record. Plutus provides a simple interface to build the entry.
|
81
|
+
Next we'll build the entry we want to record. Plutus provides a simple interface to build the entry.
|
103
82
|
|
104
83
|
entry = Plutus::Entry.build(
|
105
84
|
:description => "Order placed for widgets",
|
106
85
|
:debits => [
|
107
|
-
{:account => "Cash", :amount => 100.00}],
|
86
|
+
{:account => "Cash", :amount => 100.00}],
|
108
87
|
:credits => [
|
109
88
|
{:account => "Unearned Revenue", :amount => 100.00}])
|
110
89
|
|
111
|
-
The build method takes a hash consisting of a description, and an array of debits and credits. Each debit and credit item is a hash that specifies the amount, and the account to be debited or credited. Simply pass in the string name you used when you created the account.
|
90
|
+
The build method takes a hash consisting of a description, and an array of debits and credits. Each debit and credit item is a hash that specifies the amount, and the account to be debited or credited. Simply pass in the string name you used when you created the account.
|
112
91
|
|
113
92
|
Finally, save the entry.
|
114
93
|
|
@@ -130,12 +109,12 @@ And here's the entry:
|
|
130
109
|
entry = Plutus::Entry.build(
|
131
110
|
:description => "Sold some widgets",
|
132
111
|
:debits => [
|
133
|
-
{:account => "Accounts Receivable", :amount => 50}],
|
112
|
+
{:account => "Accounts Receivable", :amount => 50}],
|
134
113
|
:credits => [
|
135
114
|
{:account => "Sales Revenue", :amount => 45},
|
136
115
|
{:account => "Sales Tax Payable", :amount => 5}])
|
137
116
|
entry.save
|
138
|
-
|
117
|
+
|
139
118
|
Associating Documents
|
140
119
|
---------------------
|
141
120
|
|
@@ -151,7 +130,7 @@ Let's assume we're using the same entry from the last example
|
|
151
130
|
:description => "Sold some widgets",
|
152
131
|
:commercial_document => invoice,
|
153
132
|
:debits => [
|
154
|
-
{:account => "Accounts Receivable", :amount => invoice.total_amount}],
|
133
|
+
{:account => "Accounts Receivable", :amount => invoice.total_amount}],
|
155
134
|
:credits => [
|
156
135
|
{:account => "Sales Revenue", :amount => invoice.sales_amount},
|
157
136
|
{:account => "Sales Tax Payable", :amount => invoice.tax_amount}])
|
@@ -161,22 +140,22 @@ The commercial document attribute on the entry is a polymorphic association allo
|
|
161
140
|
|
162
141
|
Checking the Balance of an Individual Account
|
163
142
|
----------------------------------------------
|
164
|
-
|
143
|
+
|
165
144
|
Each account can report on its own balance. This number should normally be positive. If the number is negative, you may have a problem.
|
166
145
|
|
167
146
|
>> cash = Plutus::Asset.find_by_name("Cash")
|
168
147
|
>> cash.balance
|
169
148
|
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
170
149
|
|
171
|
-
|
150
|
+
|
172
151
|
Checking the Balance of an Account Type
|
173
152
|
---------------------------------------
|
174
153
|
|
175
154
|
Each subclass of accounts can report on the total balance of all the accounts of that type. This number should normally be positive. If the number is negative, you may have a problem.
|
176
155
|
|
177
156
|
>> Plutus::Asset.balance
|
178
|
-
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
179
|
-
|
157
|
+
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
158
|
+
|
180
159
|
Calculating the Trial Balance
|
181
160
|
-----------------------------
|
182
161
|
|
@@ -192,7 +171,7 @@ For complex entries, you should always ensure that you are balancing your accoun
|
|
192
171
|
|
193
172
|
Assets = Liabilities + Owner's Equity
|
194
173
|
|
195
|
-
For example, let's assume the owner of a business wants to withdraw cash. First we'll assume that we have an asset account for "Cash" which the funds will be drawn from. We'll then need an Equity account to record where the funds are going, however, in this case, we can't simply create a regular Equity account. The "Cash" account must be credited for the decrease in its balance since it's an Asset. Likewise, Equity accounts are typically credited when there is an increase in their balance. Equity is considered an owner's rights to Assets in the business. In this case however, we are not simply increasing the owner's rights to assets within the business; we are actually removing capital from the business altogether. Hence both sides of our accounting equation will see a decrease. In order to accomplish this, we need to create a Contra-Equity account we'll call "Drawings". Since Equity accounts normally have credit balances, a Contra-Equity account will have a debit balance, which is what we need for our entry.
|
174
|
+
For example, let's assume the owner of a business wants to withdraw cash. First we'll assume that we have an asset account for "Cash" which the funds will be drawn from. We'll then need an Equity account to record where the funds are going, however, in this case, we can't simply create a regular Equity account. The "Cash" account must be credited for the decrease in its balance since it's an Asset. Likewise, Equity accounts are typically credited when there is an increase in their balance. Equity is considered an owner's rights to Assets in the business. In this case however, we are not simply increasing the owner's rights to assets within the business; we are actually removing capital from the business altogether. Hence both sides of our accounting equation will see a decrease. In order to accomplish this, we need to create a Contra-Equity account we'll call "Drawings". Since Equity accounts normally have credit balances, a Contra-Equity account will have a debit balance, which is what we need for our entry.
|
196
175
|
|
197
176
|
>> Plutus::Equity.create(:name => "Drawing", :contra => true)
|
198
177
|
>> Plutus::Asset.create(:name => "Cash")
|
@@ -202,7 +181,7 @@ We would then create the following entry:
|
|
202
181
|
entry = Plutus::Entry.build(
|
203
182
|
:description => "Owner withdrawing cash",
|
204
183
|
:debits => [
|
205
|
-
{:account => "Drawing", :amount => 1000}],
|
184
|
+
{:account => "Drawing", :amount => 1000}],
|
206
185
|
:credits => [
|
207
186
|
{:account => "Cash", :amount => 1000}])
|
208
187
|
entry.save
|
@@ -217,7 +196,7 @@ And out entry would be:
|
|
217
196
|
entry = Plutus::Entry.build(
|
218
197
|
:description => "Owner investing cash",
|
219
198
|
:debits => [
|
220
|
-
{:account => "Cash", :amount => 1000}],
|
199
|
+
{:account => "Cash", :amount => 1000}],
|
221
200
|
:credits => [
|
222
201
|
{:account => "Common Stock", :amount => 1000}])
|
223
202
|
entry.save
|
@@ -225,10 +204,36 @@ And out entry would be:
|
|
225
204
|
In this case, we've increase our cash Asset, and simultaneously increased the other side of our accounting equation in
|
226
205
|
Equity, keeping everything balanced.
|
227
206
|
|
207
|
+
Multitenancy Support
|
208
|
+
=====================
|
209
|
+
|
210
|
+
Plutus supports multitenant applications. Multitenancy is acheived by associating all Accounts under `Plutus::Account` with a "Tenant" object (typically some model in your Rails application). To add multi-tenancy support to Plutus, you must do the following:
|
211
|
+
|
212
|
+
- Generate the migration which will add `tenant_id` to the plutus accounts table
|
213
|
+
|
214
|
+
```sh
|
215
|
+
bundle exec rails g plutus:tenancy
|
216
|
+
```
|
217
|
+
|
218
|
+
- Run the migration
|
219
|
+
|
220
|
+
```sh
|
221
|
+
rake db:migrate
|
222
|
+
```
|
223
|
+
|
224
|
+
- Add an initializer to your Rails application, i.e. `config/initializers/plutus.rb`
|
225
|
+
|
226
|
+
```ruby
|
227
|
+
Plutus.config do |config|
|
228
|
+
config.enable_tenancy = true
|
229
|
+
config.tenant_class = 'Tenant'
|
230
|
+
end
|
231
|
+
```
|
232
|
+
|
228
233
|
Access & Security
|
229
234
|
=================
|
230
235
|
|
231
|
-
The Engine provides controllers and views for viewing Accounts and Entries via the
|
236
|
+
The Engine provides controllers and views for viewing Accounts and Entries via the `Plutus::AccountsController` and `Plutus::EntriesController` classes. The controllers will render HTML, XML and JSON.
|
232
237
|
|
233
238
|
These controllers are read-only for reporting purposes. It is assumed entry creation will occur within your applications code.
|
234
239
|
|
@@ -242,10 +247,43 @@ Sample stylesheets can also be applied by adding the following to your applicati
|
|
242
247
|
|
243
248
|
<%= stylesheet_link_tag "plutus/application" %>
|
244
249
|
|
250
|
+
Previous Versions
|
251
|
+
=================
|
252
|
+
|
253
|
+
For the rails 3 version, you can go here:
|
254
|
+
|
255
|
+
[https://github.com/mbulat/plutus](https://github.com/mbulat/plutus/tree/rails3)
|
256
|
+
|
257
|
+
For the rails 2 version, you can go here:
|
258
|
+
|
259
|
+
[https://github.com/mbulat/plutus/tree/rails2](https://github.com/mbulat/plutus/tree/rails2)
|
260
|
+
|
261
|
+
* Gems in RubyGems.org >= 0.5.0 support Rails 3
|
262
|
+
* Gems in RubyGems.org >= 0.8.0 support Rails 4
|
263
|
+
* Gems in RubyGems.org >= 0.9.0 support Rails ~> 4.1
|
264
|
+
|
265
|
+
Upgrading from < 0.9
|
266
|
+
--------------------
|
267
|
+
|
268
|
+
Versions of Plutus prior to 0.9 used a "Transaction" class to keep track of entries. Rails 4.1 introduced a change that
|
269
|
+
raises an error with Plutus due to an ActiveRecord method conflict with "transaction". Therefore the Transaction class
|
270
|
+
has been renamed "Entry". To generate a migration which will update your database run the following:
|
271
|
+
|
272
|
+
- `rails g plutus:upgrade_plutus`
|
273
|
+
|
274
|
+
You only need to do this when upgrading a previously installed version of Plutus.
|
275
|
+
|
245
276
|
Testing
|
246
277
|
=======
|
247
278
|
|
248
|
-
[Rspec](http://rspec.info/) tests are provided. Run `bundle install` then `rake`.
|
279
|
+
[Rspec](http://rspec.info/) tests are provided. Run `bundle install` then `rake`.
|
280
|
+
|
281
|
+
Contributors
|
282
|
+
============
|
283
|
+
|
284
|
+
Many thanks to all our contributors! Check them all at:
|
285
|
+
|
286
|
+
https://github.com/mbulat/plutus/graphs/contributors
|
249
287
|
|
250
288
|
Community and where to get help
|
251
289
|
===============================
|
@@ -272,7 +310,7 @@ ToDo
|
|
272
310
|
Reference
|
273
311
|
=========
|
274
312
|
|
275
|
-
For a complete reference on Accounting principles, we recommend the following textbook
|
313
|
+
For a complete reference on Accounting principles, we recommend the following textbook
|
276
314
|
|
277
315
|
[http://amzn.com/0324662963](http://amzn.com/0324662963)
|
278
316
|
|
@@ -35,8 +35,13 @@ module Plutus
|
|
35
35
|
has_many :credit_entries, :through => :credit_amounts, :source => :entry, :class_name => 'Plutus::Entry'
|
36
36
|
has_many :debit_entries, :through => :debit_amounts, :source => :entry, :class_name => 'Plutus::Entry'
|
37
37
|
|
38
|
-
validates_presence_of :type
|
39
|
-
|
38
|
+
validates_presence_of :type
|
39
|
+
|
40
|
+
if Plutus.enable_tenancy
|
41
|
+
include Tenancy
|
42
|
+
else
|
43
|
+
include NoTenancy
|
44
|
+
end
|
40
45
|
|
41
46
|
# The credit balance for the account.
|
42
47
|
#
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# lib/generators/plutus/plutus_generator.rb
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
module Plutus
|
6
|
+
class TenancyGenerator < Rails::Generators::Base
|
7
|
+
include Rails::Generators::Migration
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
11
|
+
end
|
12
|
+
|
13
|
+
# Implement the required interface for Rails::Generators::Migration.
|
14
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
15
|
+
def self.next_migration_number(dirname)
|
16
|
+
if ActiveRecord::Base.timestamped_migrations
|
17
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
18
|
+
else
|
19
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_migration_file
|
24
|
+
migration_template 'tenant_migration.rb', 'db/migrate/tenant_plutus_tables.rb'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/plutus.rb
CHANGED
@@ -5,4 +5,19 @@ module Plutus
|
|
5
5
|
class Engine < Rails::Engine
|
6
6
|
isolate_namespace Plutus
|
7
7
|
end
|
8
|
+
|
9
|
+
|
10
|
+
# ------------------------------ tenancy ------------------------------
|
11
|
+
# configuration to enable or disable tenancy
|
12
|
+
mattr_accessor :enable_tenancy
|
13
|
+
enable_tenancy = false
|
14
|
+
|
15
|
+
mattr_accessor :tenant_class
|
16
|
+
tenant_class = nil
|
17
|
+
|
18
|
+
|
19
|
+
# provide hook to configure attributes
|
20
|
+
def self.config
|
21
|
+
yield(self)
|
22
|
+
end
|
8
23
|
end
|
data/lib/plutus/version.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Plutus
|
4
|
+
describe Account do
|
5
|
+
describe 'tenancy support' do
|
6
|
+
before(:each) do
|
7
|
+
ActiveSupportHelpers.clear_model('Account')
|
8
|
+
ActiveSupportHelpers.clear_model('Asset')
|
9
|
+
|
10
|
+
Plutus.enable_tenancy = true
|
11
|
+
Plutus.tenant_class = 'Plutus::Entry'
|
12
|
+
|
13
|
+
FactoryGirlHelpers.reload()
|
14
|
+
Plutus::Asset.new
|
15
|
+
end
|
16
|
+
|
17
|
+
after(:each) do
|
18
|
+
if Plutus.const_defined?(:Asset)
|
19
|
+
ActiveSupportHelpers.clear_model('Account')
|
20
|
+
ActiveSupportHelpers.clear_model('Asset')
|
21
|
+
end
|
22
|
+
|
23
|
+
Plutus.enable_tenancy = false
|
24
|
+
Plutus.tenant_class = nil
|
25
|
+
|
26
|
+
FactoryGirlHelpers.reload()
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'validate uniqueness of name scoped to tenant' do
|
30
|
+
account = FactoryGirl.create(:asset, tenant_id: 10)
|
31
|
+
|
32
|
+
record = FactoryGirl.build(:asset, name: account.name, tenant_id: 10)
|
33
|
+
record.should_not be_valid
|
34
|
+
record.errors[:name].should == ['has already been taken']
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'allows same name scoped under a different tenant' do
|
38
|
+
account = FactoryGirl.create(:asset, tenant_id: 10)
|
39
|
+
|
40
|
+
record = FactoryGirl.build(:asset, name: account.name, tenant_id: 11)
|
41
|
+
record.should be_valid
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
-
require 'factory_girl'
|
2
|
-
|
3
1
|
ENV["RAILS_ENV"] ||= 'test'
|
4
2
|
require File.expand_path(File.dirname(__FILE__) + "/../fixture_rails_root/config/environment")
|
3
|
+
|
5
4
|
require Rails.root.join('db/schema').to_s
|
6
5
|
require 'rspec/rails'
|
7
6
|
|
8
7
|
$: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
|
9
8
|
require 'plutus'
|
10
9
|
|
11
|
-
Dir[File.expand_path(File.join(File.dirname(__FILE__),'factories','**','*.rb'))].each {|f| require f}
|
12
10
|
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
13
11
|
|
12
|
+
require 'factory_girl'
|
13
|
+
plutus_definitions = File.expand_path(File.join(File.dirname(__FILE__), 'factories'))
|
14
|
+
FactoryGirl.definition_file_paths << plutus_definitions
|
15
|
+
|
16
|
+
|
14
17
|
RSpec.configure do |config|
|
15
18
|
config.use_transactional_fixtures = true
|
16
19
|
end
|
20
|
+
|
21
|
+
FactoryGirlHelpers.reload()
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ActiveSupportHelpers
|
2
|
+
# Helps in removing model, and force-reloading it next time This helper does 2
|
3
|
+
# things:
|
4
|
+
# * remove from $LOADED_FEATURES so that ruby 'require' reloads file again
|
5
|
+
# * remove the constant from active support dependencies
|
6
|
+
def self.clear_model(model_name)
|
7
|
+
ActiveSupport::Dependencies.remove_constant('Plutus::' + model_name)
|
8
|
+
|
9
|
+
models_dir = File.dirname(__FILE__) + '/../../app/models/plutus/'
|
10
|
+
path = File.expand_path(models_dir + model_name.downcase + '.rb')
|
11
|
+
$LOADED_FEATURES.delete(path)
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plutus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bulat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -67,7 +67,9 @@ files:
|
|
67
67
|
- app/models/plutus/equity.rb
|
68
68
|
- app/models/plutus/expense.rb
|
69
69
|
- app/models/plutus/liability.rb
|
70
|
+
- app/models/plutus/no_tenancy.rb
|
70
71
|
- app/models/plutus/revenue.rb
|
72
|
+
- app/models/plutus/tenancy.rb
|
71
73
|
- app/views/plutus/accounts/index.html.erb
|
72
74
|
- app/views/plutus/accounts/show.html.erb
|
73
75
|
- app/views/plutus/entries/index.html.erb
|
@@ -82,7 +84,9 @@ files:
|
|
82
84
|
- lib/generators/plutus/USAGE
|
83
85
|
- lib/generators/plutus/plutus_generator.rb
|
84
86
|
- lib/generators/plutus/templates/migration.rb
|
87
|
+
- lib/generators/plutus/templates/tenant_migration.rb
|
85
88
|
- lib/generators/plutus/templates/update_migration.rb
|
89
|
+
- lib/generators/plutus/tenancy_generator.rb
|
86
90
|
- lib/generators/plutus/upgrade_plutus_generator.rb
|
87
91
|
- lib/plutus.rb
|
88
92
|
- lib/plutus/version.rb
|
@@ -102,6 +106,7 @@ files:
|
|
102
106
|
- spec/models/expense_spec.rb
|
103
107
|
- spec/models/liability_spec.rb
|
104
108
|
- spec/models/revenue_spec.rb
|
109
|
+
- spec/models/tenancy_spec.rb
|
105
110
|
- spec/rcov.opts
|
106
111
|
- spec/routing/accounts_routing_spec.rb
|
107
112
|
- spec/routing/entries_routing_spec.rb
|
@@ -109,7 +114,9 @@ files:
|
|
109
114
|
- spec/spec.opts
|
110
115
|
- spec/spec_helper.rb
|
111
116
|
- spec/support/account_shared_examples.rb
|
117
|
+
- spec/support/active_support_helpers.rb
|
112
118
|
- spec/support/amount_shared_examples.rb
|
119
|
+
- spec/support/factory_girl_helpers.rb
|
113
120
|
homepage: http://github.com/mbulat/plutus
|
114
121
|
licenses: []
|
115
122
|
metadata: {}
|
@@ -129,33 +136,36 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
136
|
version: 1.3.6
|
130
137
|
requirements: []
|
131
138
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.4.2
|
133
140
|
signing_key:
|
134
141
|
specification_version: 3
|
135
142
|
summary: A Plugin providing a Double Entry Accounting Engine for Rails
|
136
143
|
test_files:
|
137
|
-
- spec/
|
138
|
-
- spec/routing/accounts_routing_spec.rb
|
144
|
+
- spec/lib/plutus_spec.rb
|
139
145
|
- spec/schema.rb
|
140
|
-
- spec/
|
141
|
-
- spec/support/amount_shared_examples.rb
|
146
|
+
- spec/spec.opts
|
142
147
|
- spec/factories/amount_factory.rb
|
143
|
-
- spec/factories/account_factory.rb
|
144
148
|
- spec/factories/entry_factory.rb
|
145
|
-
- spec/
|
146
|
-
- spec/
|
147
|
-
- spec/
|
148
|
-
- spec/
|
149
|
+
- spec/factories/account_factory.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
- spec/support/factory_girl_helpers.rb
|
152
|
+
- spec/support/amount_shared_examples.rb
|
153
|
+
- spec/support/active_support_helpers.rb
|
154
|
+
- spec/support/account_shared_examples.rb
|
155
|
+
- spec/routing/accounts_routing_spec.rb
|
156
|
+
- spec/routing/entries_routing_spec.rb
|
157
|
+
- spec/rcov.opts
|
158
|
+
- spec/controllers/entries_controller_spec.rb
|
159
|
+
- spec/controllers/accounts_controller_spec.rb
|
160
|
+
- spec/models/account_spec.rb
|
149
161
|
- spec/models/credit_amount_spec.rb
|
150
162
|
- spec/models/expense_spec.rb
|
163
|
+
- spec/models/tenancy_spec.rb
|
164
|
+
- spec/models/liability_spec.rb
|
151
165
|
- spec/models/asset_spec.rb
|
152
|
-
- spec/models/entry_spec.rb
|
153
|
-
- spec/models/account_spec.rb
|
154
166
|
- spec/models/debit_amount_spec.rb
|
155
167
|
- spec/models/revenue_spec.rb
|
156
|
-
- spec/
|
157
|
-
- spec/
|
158
|
-
- spec/
|
159
|
-
- spec/controllers/accounts_controller_spec.rb
|
160
|
-
- spec/spec_helper.rb
|
168
|
+
- spec/models/amount_spec.rb
|
169
|
+
- spec/models/equity_spec.rb
|
170
|
+
- spec/models/entry_spec.rb
|
161
171
|
has_rdoc:
|