odania_plutus 0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +23 -0
- data/README.markdown +394 -0
- data/Rakefile +11 -0
- data/app/assets/javascripts/plutus/application.js +16 -0
- data/app/assets/javascripts/plutus/reports.js +5 -0
- data/app/assets/stylesheets/bootstrap-theme.min.css +5 -0
- data/app/assets/stylesheets/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/plutus/application.css +19 -0
- data/app/controllers/plutus/accounts_controller.rb +30 -0
- data/app/controllers/plutus/application_controller.rb +4 -0
- data/app/controllers/plutus/entries_controller.rb +34 -0
- data/app/controllers/plutus/reports_controller.rb +40 -0
- data/app/models/plutus/account.rb +170 -0
- data/app/models/plutus/amount.rb +22 -0
- data/app/models/plutus/amounts_extension.rb +42 -0
- data/app/models/plutus/asset.rb +56 -0
- data/app/models/plutus/credit_amount.rb +10 -0
- data/app/models/plutus/debit_amount.rb +10 -0
- data/app/models/plutus/entry.rb +77 -0
- data/app/models/plutus/equity.rb +56 -0
- data/app/models/plutus/expense.rb +56 -0
- data/app/models/plutus/liability.rb +56 -0
- data/app/models/plutus/no_tenancy.rb +9 -0
- data/app/models/plutus/revenue.rb +56 -0
- data/app/models/plutus/tenancy.rb +15 -0
- data/app/views/layouts/plutus/_messages.html.erb +9 -0
- data/app/views/layouts/plutus/_navigation.html.erb +19 -0
- data/app/views/layouts/plutus/_navigation_links.html.erb +5 -0
- data/app/views/layouts/plutus/application.html.erb +19 -0
- data/app/views/plutus/accounts/index.html.erb +26 -0
- data/app/views/plutus/entries/index.html.erb +59 -0
- data/app/views/plutus/reports/_account.html.erb +28 -0
- data/app/views/plutus/reports/balance_sheet.html.erb +21 -0
- data/app/views/plutus/reports/income_statement.html.erb +24 -0
- data/config/backtrace_silencers.rb +7 -0
- data/config/database.yml +5 -0
- data/config/inflections.rb +10 -0
- data/config/mime_types.rb +5 -0
- data/config/routes.rb +9 -0
- data/config/secret_token.rb +7 -0
- data/config/session_store.rb +8 -0
- data/lib/generators/plutus/USAGE +22 -0
- data/lib/generators/plutus/add_date_upgrade_generator.rb +11 -0
- data/lib/generators/plutus/base_generator.rb +19 -0
- data/lib/generators/plutus/plutus_generator.rb +12 -0
- data/lib/generators/plutus/templates/add_date_migration.rb +6 -0
- data/lib/generators/plutus/templates/migration.rb +39 -0
- data/lib/generators/plutus/templates/tenant_migration.rb +6 -0
- data/lib/generators/plutus/templates/update_migration.rb +17 -0
- data/lib/generators/plutus/tenancy_generator.rb +12 -0
- data/lib/generators/plutus/upgrade_plutus_generator.rb +12 -0
- data/lib/plutus.rb +23 -0
- data/lib/plutus/version.rb +3 -0
- data/spec/controllers/accounts_controller_spec.rb +19 -0
- data/spec/controllers/entries_controller_spec.rb +19 -0
- data/spec/controllers/reports_controller_spec.rb +24 -0
- data/spec/factories/account_factory.rb +35 -0
- data/spec/factories/amount_factory.rb +19 -0
- data/spec/factories/entry_factory.rb +11 -0
- data/spec/lib/plutus_spec.rb +0 -0
- data/spec/models/account_spec.rb +133 -0
- data/spec/models/amount_spec.rb +8 -0
- data/spec/models/asset_spec.rb +7 -0
- data/spec/models/credit_amount_spec.rb +7 -0
- data/spec/models/debit_amount_spec.rb +7 -0
- data/spec/models/entry_spec.rb +170 -0
- data/spec/models/equity_spec.rb +7 -0
- data/spec/models/expense_spec.rb +7 -0
- data/spec/models/liability_spec.rb +7 -0
- data/spec/models/revenue_spec.rb +7 -0
- data/spec/models/tenancy_spec.rb +45 -0
- data/spec/rcov.opts +2 -0
- data/spec/routing/accounts_routing_spec.rb +13 -0
- data/spec/routing/entries_routing_spec.rb +13 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/account_shared_examples.rb +60 -0
- data/spec/support/active_support_helpers.rb +13 -0
- data/spec/support/amount_shared_examples.rb +21 -0
- data/spec/support/factory_girl_helpers.rb +8 -0
- metadata +225 -0
data/spec/rcov.opts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Plutus
|
4
|
+
describe AccountsController do
|
5
|
+
routes { Plutus::Engine.routes }
|
6
|
+
|
7
|
+
describe "routing" do
|
8
|
+
it "recognizes and generates #index" do
|
9
|
+
expect(:get => "/accounts").to route_to(:controller => "plutus/accounts", :action => "index")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Plutus
|
4
|
+
describe EntriesController do
|
5
|
+
routes { Plutus::Engine.routes }
|
6
|
+
|
7
|
+
describe "routing" do
|
8
|
+
it "recognizes and generates #index" do
|
9
|
+
expect(:get => "/entries").to route_to(:controller => "plutus/entries", :action => "index")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + "/../fixture_rails_root/config/environment")
|
6
|
+
|
7
|
+
require Rails.root.join('db/schema').to_s
|
8
|
+
require 'rspec/rails'
|
9
|
+
|
10
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
|
11
|
+
require 'plutus'
|
12
|
+
require 'kaminari'
|
13
|
+
|
14
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
15
|
+
|
16
|
+
require 'factory_girl'
|
17
|
+
plutus_definitions = File.expand_path(File.join(File.dirname(__FILE__), 'factories'))
|
18
|
+
FactoryGirl.definition_file_paths << plutus_definitions
|
19
|
+
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.use_transactional_fixtures = true
|
23
|
+
config.infer_spec_type_from_file_location!
|
24
|
+
end
|
25
|
+
|
26
|
+
FactoryGirlHelpers.reload()
|
@@ -0,0 +1,60 @@
|
|
1
|
+
shared_examples_for 'a Plutus::Account subtype' do |elements|
|
2
|
+
let(:contra) { false }
|
3
|
+
let(:account) { FactoryGirl.create(elements[:kind], contra: contra)}
|
4
|
+
subject { account }
|
5
|
+
|
6
|
+
describe "class methods" do
|
7
|
+
subject { account.class }
|
8
|
+
its(:balance) { is_expected.to be_kind_of(BigDecimal) }
|
9
|
+
describe "trial_balance" do
|
10
|
+
it "should raise NoMethodError" do
|
11
|
+
expect { subject.trial_balance }.to raise_error NoMethodError
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "instance methods" do
|
17
|
+
its(:balance) { is_expected.to be_kind_of(BigDecimal) }
|
18
|
+
|
19
|
+
it "reports a balance with date range" do
|
20
|
+
expect(account.balance(:from_date => "2014-01-01", :to_date => Date.today)).to be_kind_of(BigDecimal)
|
21
|
+
end
|
22
|
+
|
23
|
+
it { is_expected.to respond_to(:credit_entries) }
|
24
|
+
it { is_expected.to respond_to(:debit_entries) }
|
25
|
+
end
|
26
|
+
|
27
|
+
it "requires a name" do
|
28
|
+
account.name = nil
|
29
|
+
expect(account).not_to be_valid
|
30
|
+
end
|
31
|
+
|
32
|
+
# Figure out which way credits and debits should apply
|
33
|
+
if elements[:normal_balance] == :debit
|
34
|
+
debit_condition = :>
|
35
|
+
credit_condition = :<
|
36
|
+
else
|
37
|
+
credit_condition = :>
|
38
|
+
debit_condition = :<
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "when given a debit" do
|
42
|
+
before { FactoryGirl.create(:debit_amount, account: account) }
|
43
|
+
its(:balance) { is_expected.to be.send(debit_condition, 0) }
|
44
|
+
|
45
|
+
describe "on a contra account" do
|
46
|
+
let(:contra) { true }
|
47
|
+
its(:balance) { is_expected.to be.send(credit_condition, 0) }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "when given a credit" do
|
52
|
+
before { FactoryGirl.create(:credit_amount, account: account) }
|
53
|
+
its(:balance) { is_expected.to be.send(credit_condition, 0) }
|
54
|
+
|
55
|
+
describe "on a contra account" do
|
56
|
+
let(:contra) { true }
|
57
|
+
its(:balance) { is_expected.to be.send(debit_condition, 0) }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
shared_examples_for 'a Plutus::Amount subtype' do |elements|
|
2
|
+
let(:amount) { FactoryGirl.build(elements[:kind]) }
|
3
|
+
subject { amount }
|
4
|
+
|
5
|
+
it { is_expected.to be_valid }
|
6
|
+
|
7
|
+
it "should require an amount" do
|
8
|
+
amount.amount = nil
|
9
|
+
expect(amount).not_to be_valid
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should require a entry" do
|
13
|
+
amount.entry = nil
|
14
|
+
expect(amount).not_to be_valid
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should require an account" do
|
18
|
+
amount.account = nil
|
19
|
+
expect(amount).not_to be_valid
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: odania_plutus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.13'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Bulat
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jquery-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jquery-ui-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.2.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.2.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: kaminari
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: The plutus plugin provides a complete double entry accounting system
|
84
|
+
for use in any Ruby on Rails application. The plugin follows general Double Entry
|
85
|
+
Bookkeeping practices. All calculations are done using BigDecimal in order to prevent
|
86
|
+
floating point rounding errors. The plugin requires a decimal type on your database
|
87
|
+
as well. Forked from plutus
|
88
|
+
email: o.dania@icloud.com
|
89
|
+
executables: []
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files:
|
92
|
+
- LICENSE
|
93
|
+
- README.markdown
|
94
|
+
files:
|
95
|
+
- LICENSE
|
96
|
+
- README.markdown
|
97
|
+
- Rakefile
|
98
|
+
- app/assets/javascripts/plutus/application.js
|
99
|
+
- app/assets/javascripts/plutus/reports.js
|
100
|
+
- app/assets/stylesheets/bootstrap-theme.min.css
|
101
|
+
- app/assets/stylesheets/bootstrap.min.css
|
102
|
+
- app/assets/stylesheets/plutus/application.css
|
103
|
+
- app/controllers/plutus/accounts_controller.rb
|
104
|
+
- app/controllers/plutus/application_controller.rb
|
105
|
+
- app/controllers/plutus/entries_controller.rb
|
106
|
+
- app/controllers/plutus/reports_controller.rb
|
107
|
+
- app/models/plutus/account.rb
|
108
|
+
- app/models/plutus/amount.rb
|
109
|
+
- app/models/plutus/amounts_extension.rb
|
110
|
+
- app/models/plutus/asset.rb
|
111
|
+
- app/models/plutus/credit_amount.rb
|
112
|
+
- app/models/plutus/debit_amount.rb
|
113
|
+
- app/models/plutus/entry.rb
|
114
|
+
- app/models/plutus/equity.rb
|
115
|
+
- app/models/plutus/expense.rb
|
116
|
+
- app/models/plutus/liability.rb
|
117
|
+
- app/models/plutus/no_tenancy.rb
|
118
|
+
- app/models/plutus/revenue.rb
|
119
|
+
- app/models/plutus/tenancy.rb
|
120
|
+
- app/views/layouts/plutus/_messages.html.erb
|
121
|
+
- app/views/layouts/plutus/_navigation.html.erb
|
122
|
+
- app/views/layouts/plutus/_navigation_links.html.erb
|
123
|
+
- app/views/layouts/plutus/application.html.erb
|
124
|
+
- app/views/plutus/accounts/index.html.erb
|
125
|
+
- app/views/plutus/entries/index.html.erb
|
126
|
+
- app/views/plutus/reports/_account.html.erb
|
127
|
+
- app/views/plutus/reports/balance_sheet.html.erb
|
128
|
+
- app/views/plutus/reports/income_statement.html.erb
|
129
|
+
- config/backtrace_silencers.rb
|
130
|
+
- config/database.yml
|
131
|
+
- config/inflections.rb
|
132
|
+
- config/mime_types.rb
|
133
|
+
- config/routes.rb
|
134
|
+
- config/secret_token.rb
|
135
|
+
- config/session_store.rb
|
136
|
+
- lib/generators/plutus/USAGE
|
137
|
+
- lib/generators/plutus/add_date_upgrade_generator.rb
|
138
|
+
- lib/generators/plutus/base_generator.rb
|
139
|
+
- lib/generators/plutus/plutus_generator.rb
|
140
|
+
- lib/generators/plutus/templates/add_date_migration.rb
|
141
|
+
- lib/generators/plutus/templates/migration.rb
|
142
|
+
- lib/generators/plutus/templates/tenant_migration.rb
|
143
|
+
- lib/generators/plutus/templates/update_migration.rb
|
144
|
+
- lib/generators/plutus/tenancy_generator.rb
|
145
|
+
- lib/generators/plutus/upgrade_plutus_generator.rb
|
146
|
+
- lib/plutus.rb
|
147
|
+
- lib/plutus/version.rb
|
148
|
+
- spec/controllers/accounts_controller_spec.rb
|
149
|
+
- spec/controllers/entries_controller_spec.rb
|
150
|
+
- spec/controllers/reports_controller_spec.rb
|
151
|
+
- spec/factories/account_factory.rb
|
152
|
+
- spec/factories/amount_factory.rb
|
153
|
+
- spec/factories/entry_factory.rb
|
154
|
+
- spec/lib/plutus_spec.rb
|
155
|
+
- spec/models/account_spec.rb
|
156
|
+
- spec/models/amount_spec.rb
|
157
|
+
- spec/models/asset_spec.rb
|
158
|
+
- spec/models/credit_amount_spec.rb
|
159
|
+
- spec/models/debit_amount_spec.rb
|
160
|
+
- spec/models/entry_spec.rb
|
161
|
+
- spec/models/equity_spec.rb
|
162
|
+
- spec/models/expense_spec.rb
|
163
|
+
- spec/models/liability_spec.rb
|
164
|
+
- spec/models/revenue_spec.rb
|
165
|
+
- spec/models/tenancy_spec.rb
|
166
|
+
- spec/rcov.opts
|
167
|
+
- spec/routing/accounts_routing_spec.rb
|
168
|
+
- spec/routing/entries_routing_spec.rb
|
169
|
+
- spec/spec.opts
|
170
|
+
- spec/spec_helper.rb
|
171
|
+
- spec/support/account_shared_examples.rb
|
172
|
+
- spec/support/active_support_helpers.rb
|
173
|
+
- spec/support/amount_shared_examples.rb
|
174
|
+
- spec/support/factory_girl_helpers.rb
|
175
|
+
homepage: https://github.com/junydania/plutus
|
176
|
+
licenses: []
|
177
|
+
metadata: {}
|
178
|
+
post_install_message:
|
179
|
+
rdoc_options: []
|
180
|
+
require_paths:
|
181
|
+
- lib
|
182
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: 1.3.6
|
192
|
+
requirements: []
|
193
|
+
rubyforge_project:
|
194
|
+
rubygems_version: 2.6.11
|
195
|
+
signing_key:
|
196
|
+
specification_version: 3
|
197
|
+
summary: A Plugin providing a Double Entry Accounting Engine for Rails
|
198
|
+
test_files:
|
199
|
+
- spec/controllers/accounts_controller_spec.rb
|
200
|
+
- spec/controllers/entries_controller_spec.rb
|
201
|
+
- spec/controllers/reports_controller_spec.rb
|
202
|
+
- spec/factories/account_factory.rb
|
203
|
+
- spec/factories/amount_factory.rb
|
204
|
+
- spec/factories/entry_factory.rb
|
205
|
+
- spec/lib/plutus_spec.rb
|
206
|
+
- spec/models/account_spec.rb
|
207
|
+
- spec/models/amount_spec.rb
|
208
|
+
- spec/models/asset_spec.rb
|
209
|
+
- spec/models/credit_amount_spec.rb
|
210
|
+
- spec/models/debit_amount_spec.rb
|
211
|
+
- spec/models/entry_spec.rb
|
212
|
+
- spec/models/equity_spec.rb
|
213
|
+
- spec/models/expense_spec.rb
|
214
|
+
- spec/models/liability_spec.rb
|
215
|
+
- spec/models/revenue_spec.rb
|
216
|
+
- spec/models/tenancy_spec.rb
|
217
|
+
- spec/rcov.opts
|
218
|
+
- spec/routing/accounts_routing_spec.rb
|
219
|
+
- spec/routing/entries_routing_spec.rb
|
220
|
+
- spec/spec.opts
|
221
|
+
- spec/spec_helper.rb
|
222
|
+
- spec/support/account_shared_examples.rb
|
223
|
+
- spec/support/active_support_helpers.rb
|
224
|
+
- spec/support/amount_shared_examples.rb
|
225
|
+
- spec/support/factory_girl_helpers.rb
|