plutus 0.10.1 → 0.15

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.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/README.markdown +172 -99
  3. data/app/assets/javascripts/plutus/application.js +5 -4
  4. data/app/assets/javascripts/plutus/reports.js +5 -0
  5. data/app/assets/stylesheets/bootstrap-theme.min.css +5 -0
  6. data/app/assets/stylesheets/bootstrap.min.css +5 -0
  7. data/app/assets/stylesheets/plutus/application.css +11 -5
  8. data/app/controllers/plutus/accounts_controller.rb +1 -16
  9. data/app/controllers/plutus/application_controller.rb +4 -0
  10. data/app/controllers/plutus/entries_controller.rb +7 -17
  11. data/app/controllers/plutus/reports_controller.rb +40 -0
  12. data/app/models/plutus/account.rb +92 -7
  13. data/app/models/plutus/amount.rb +11 -1
  14. data/app/models/plutus/amounts_extension.rb +31 -6
  15. data/app/models/plutus/asset.rb +21 -18
  16. data/app/models/plutus/entry.rb +28 -26
  17. data/app/models/plutus/equity.rb +22 -19
  18. data/app/models/plutus/expense.rb +21 -18
  19. data/app/models/plutus/liability.rb +27 -19
  20. data/app/models/plutus/revenue.rb +22 -19
  21. data/app/models/plutus/tenancy.rb +5 -1
  22. data/app/views/layouts/plutus/_messages.html.erb +9 -0
  23. data/app/views/layouts/plutus/_navigation.html.erb +19 -0
  24. data/app/views/layouts/plutus/_navigation_links.html.erb +5 -0
  25. data/app/views/layouts/plutus/application.html.erb +19 -0
  26. data/app/views/plutus/accounts/index.html.erb +9 -12
  27. data/app/views/plutus/entries/index.html.erb +22 -11
  28. data/app/views/plutus/reports/_account.html.erb +28 -0
  29. data/app/views/plutus/reports/balance_sheet.html.erb +21 -0
  30. data/app/views/plutus/reports/income_statement.html.erb +24 -0
  31. data/config/routes.rb +6 -3
  32. data/{lib/generators/plutus/templates/migration.rb → db/migrate/20160422010135_create_plutus_tables.rb} +6 -10
  33. data/lib/generators/plutus/add_date_upgrade_generator.rb +11 -0
  34. data/lib/generators/plutus/base_generator.rb +19 -0
  35. data/lib/generators/plutus/plutus_generator.rb +8 -22
  36. data/lib/generators/plutus/templates/add_date_migration.rb +12 -0
  37. data/lib/generators/plutus/templates/tenant_migration.rb +1 -1
  38. data/lib/generators/plutus/templates/update_migration.rb +2 -2
  39. data/lib/generators/plutus/tenancy_generator.rb +2 -17
  40. data/lib/generators/plutus/upgrade_plutus_generator.rb +6 -22
  41. data/lib/plutus.rb +2 -5
  42. data/lib/plutus/engine.rb +5 -0
  43. data/lib/plutus/version.rb +1 -1
  44. data/spec/controllers/accounts_controller_spec.rb +11 -20
  45. data/spec/controllers/entries_controller_spec.rb +11 -20
  46. data/spec/controllers/reports_controller_spec.rb +24 -0
  47. data/spec/factories/tenant_factory.rb +12 -0
  48. data/spec/models/account_spec.rb +79 -16
  49. data/spec/models/amount_spec.rb +6 -1
  50. data/spec/models/debit_amount_spec.rb +1 -1
  51. data/spec/models/entry_spec.rb +108 -29
  52. data/spec/models/tenancy_spec.rb +26 -8
  53. data/spec/routing/accounts_routing_spec.rb +6 -25
  54. data/spec/routing/entries_routing_spec.rb +6 -25
  55. data/spec/spec_helper.rb +5 -0
  56. data/spec/support/account_shared_examples.rb +14 -10
  57. data/spec/support/amount_shared_examples.rb +7 -7
  58. data/spec/support/shoulda_matchers.rb +8 -0
  59. metadata +100 -27
  60. data/app/views/plutus/accounts/show.html.erb +0 -59
  61. data/app/views/plutus/entries/show.html.erb +0 -46
  62. data/spec/schema.rb +0 -31
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  ENV["RAILS_ENV"] ||= 'test'
2
5
  require File.expand_path(File.dirname(__FILE__) + "/../fixture_rails_root/config/environment")
3
6
 
@@ -6,6 +9,7 @@ require 'rspec/rails'
6
9
 
7
10
  $: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
8
11
  require 'plutus'
12
+ require 'kaminari'
9
13
 
10
14
  Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
11
15
 
@@ -16,6 +20,7 @@ FactoryGirl.definition_file_paths << plutus_definitions
16
20
 
17
21
  RSpec.configure do |config|
18
22
  config.use_transactional_fixtures = true
23
+ config.infer_spec_type_from_file_location!
19
24
  end
20
25
 
21
26
  FactoryGirlHelpers.reload()
@@ -5,24 +5,28 @@ shared_examples_for 'a Plutus::Account subtype' do |elements|
5
5
 
6
6
  describe "class methods" do
7
7
  subject { account.class }
8
- its(:balance) { should be_kind_of(BigDecimal) }
8
+ its(:balance) { is_expected.to be_kind_of(BigDecimal) }
9
9
  describe "trial_balance" do
10
10
  it "should raise NoMethodError" do
11
- lambda { subject.trial_balance }.should raise_error NoMethodError
11
+ expect { subject.trial_balance }.to raise_error NoMethodError
12
12
  end
13
13
  end
14
14
  end
15
15
 
16
16
  describe "instance methods" do
17
- its(:balance) { should be_kind_of(BigDecimal) }
17
+ its(:balance) { is_expected.to be_kind_of(BigDecimal) }
18
18
 
19
- it { should respond_to(:credit_entries) }
20
- it { should respond_to(:debit_entries) }
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) }
21
25
  end
22
26
 
23
27
  it "requires a name" do
24
28
  account.name = nil
25
- account.should_not be_valid
29
+ expect(account).not_to be_valid
26
30
  end
27
31
 
28
32
  # Figure out which way credits and debits should apply
@@ -36,21 +40,21 @@ shared_examples_for 'a Plutus::Account subtype' do |elements|
36
40
 
37
41
  describe "when given a debit" do
38
42
  before { FactoryGirl.create(:debit_amount, account: account) }
39
- its(:balance) { should be.send(debit_condition, 0) }
43
+ its(:balance) { is_expected.to be.send(debit_condition, 0) }
40
44
 
41
45
  describe "on a contra account" do
42
46
  let(:contra) { true }
43
- its(:balance) { should be.send(credit_condition, 0) }
47
+ its(:balance) { is_expected.to be.send(credit_condition, 0) }
44
48
  end
45
49
  end
46
50
 
47
51
  describe "when given a credit" do
48
52
  before { FactoryGirl.create(:credit_amount, account: account) }
49
- its(:balance) { should be.send(credit_condition, 0) }
53
+ its(:balance) { is_expected.to be.send(credit_condition, 0) }
50
54
 
51
55
  describe "on a contra account" do
52
56
  let(:contra) { true }
53
- its(:balance) { should be.send(debit_condition, 0) }
57
+ its(:balance) { is_expected.to be.send(debit_condition, 0) }
54
58
  end
55
59
  end
56
60
  end
@@ -1,21 +1,21 @@
1
1
  shared_examples_for 'a Plutus::Amount subtype' do |elements|
2
2
  let(:amount) { FactoryGirl.build(elements[:kind]) }
3
3
  subject { amount }
4
-
5
- it { should be_valid }
6
-
4
+
5
+ it { is_expected.to be_valid }
6
+
7
7
  it "should require an amount" do
8
8
  amount.amount = nil
9
- amount.should_not be_valid
9
+ expect(amount).not_to be_valid
10
10
  end
11
11
 
12
12
  it "should require a entry" do
13
13
  amount.entry = nil
14
- amount.should_not be_valid
14
+ expect(amount).not_to be_valid
15
15
  end
16
-
16
+
17
17
  it "should require an account" do
18
18
  amount.account = nil
19
- amount.should_not be_valid
19
+ expect(amount).not_to be_valid
20
20
  end
21
21
  end
@@ -0,0 +1,8 @@
1
+ require 'shoulda-matchers'
2
+
3
+ Shoulda::Matchers.configure do |config|
4
+ config.integrate do |with|
5
+ with.test_framework :rspec
6
+ with.library :active_record
7
+ end
8
+ end
metadata CHANGED
@@ -1,29 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: '0.15'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bulat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2020-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
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
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'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: yard
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +80,20 @@ dependencies:
38
80
  - - ">="
39
81
  - !ruby/object:Gem::Version
40
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: shoulda-matchers
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.1'
41
97
  description: The plutus plugin provides a complete double entry accounting system
42
98
  for use in any Ruby on Rails application. The plugin follows general Double Entry
43
99
  Bookkeeping practices. All calculations are done using BigDecimal in order to prevent
@@ -54,9 +110,14 @@ files:
54
110
  - README.markdown
55
111
  - Rakefile
56
112
  - app/assets/javascripts/plutus/application.js
113
+ - app/assets/javascripts/plutus/reports.js
114
+ - app/assets/stylesheets/bootstrap-theme.min.css
115
+ - app/assets/stylesheets/bootstrap.min.css
57
116
  - app/assets/stylesheets/plutus/application.css
58
117
  - app/controllers/plutus/accounts_controller.rb
118
+ - app/controllers/plutus/application_controller.rb
59
119
  - app/controllers/plutus/entries_controller.rb
120
+ - app/controllers/plutus/reports_controller.rb
60
121
  - app/models/plutus/account.rb
61
122
  - app/models/plutus/amount.rb
62
123
  - app/models/plutus/amounts_extension.rb
@@ -70,10 +131,15 @@ files:
70
131
  - app/models/plutus/no_tenancy.rb
71
132
  - app/models/plutus/revenue.rb
72
133
  - app/models/plutus/tenancy.rb
134
+ - app/views/layouts/plutus/_messages.html.erb
135
+ - app/views/layouts/plutus/_navigation.html.erb
136
+ - app/views/layouts/plutus/_navigation_links.html.erb
137
+ - app/views/layouts/plutus/application.html.erb
73
138
  - app/views/plutus/accounts/index.html.erb
74
- - app/views/plutus/accounts/show.html.erb
75
139
  - app/views/plutus/entries/index.html.erb
76
- - app/views/plutus/entries/show.html.erb
140
+ - app/views/plutus/reports/_account.html.erb
141
+ - app/views/plutus/reports/balance_sheet.html.erb
142
+ - app/views/plutus/reports/income_statement.html.erb
77
143
  - config/backtrace_silencers.rb
78
144
  - config/database.yml
79
145
  - config/inflections.rb
@@ -81,20 +147,26 @@ files:
81
147
  - config/routes.rb
82
148
  - config/secret_token.rb
83
149
  - config/session_store.rb
150
+ - db/migrate/20160422010135_create_plutus_tables.rb
84
151
  - lib/generators/plutus/USAGE
152
+ - lib/generators/plutus/add_date_upgrade_generator.rb
153
+ - lib/generators/plutus/base_generator.rb
85
154
  - lib/generators/plutus/plutus_generator.rb
86
- - lib/generators/plutus/templates/migration.rb
155
+ - lib/generators/plutus/templates/add_date_migration.rb
87
156
  - lib/generators/plutus/templates/tenant_migration.rb
88
157
  - lib/generators/plutus/templates/update_migration.rb
89
158
  - lib/generators/plutus/tenancy_generator.rb
90
159
  - lib/generators/plutus/upgrade_plutus_generator.rb
91
160
  - lib/plutus.rb
161
+ - lib/plutus/engine.rb
92
162
  - lib/plutus/version.rb
93
163
  - spec/controllers/accounts_controller_spec.rb
94
164
  - spec/controllers/entries_controller_spec.rb
165
+ - spec/controllers/reports_controller_spec.rb
95
166
  - spec/factories/account_factory.rb
96
167
  - spec/factories/amount_factory.rb
97
168
  - spec/factories/entry_factory.rb
169
+ - spec/factories/tenant_factory.rb
98
170
  - spec/lib/plutus_spec.rb
99
171
  - spec/models/account_spec.rb
100
172
  - spec/models/amount_spec.rb
@@ -110,13 +182,13 @@ files:
110
182
  - spec/rcov.opts
111
183
  - spec/routing/accounts_routing_spec.rb
112
184
  - spec/routing/entries_routing_spec.rb
113
- - spec/schema.rb
114
185
  - spec/spec.opts
115
186
  - spec/spec_helper.rb
116
187
  - spec/support/account_shared_examples.rb
117
188
  - spec/support/active_support_helpers.rb
118
189
  - spec/support/amount_shared_examples.rb
119
190
  - spec/support/factory_girl_helpers.rb
191
+ - spec/support/shoulda_matchers.rb
120
192
  homepage: http://github.com/mbulat/plutus
121
193
  licenses: []
122
194
  metadata: {}
@@ -136,36 +208,37 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
208
  version: 1.3.6
137
209
  requirements: []
138
210
  rubyforge_project:
139
- rubygems_version: 2.4.2
211
+ rubygems_version: 2.7.6
140
212
  signing_key:
141
213
  specification_version: 3
142
214
  summary: A Plugin providing a Double Entry Accounting Engine for Rails
143
215
  test_files:
216
+ - spec/routing/entries_routing_spec.rb
217
+ - spec/routing/accounts_routing_spec.rb
144
218
  - spec/lib/plutus_spec.rb
145
- - spec/schema.rb
146
- - spec/spec.opts
147
- - spec/factories/amount_factory.rb
219
+ - spec/spec_helper.rb
220
+ - spec/controllers/entries_controller_spec.rb
221
+ - spec/controllers/accounts_controller_spec.rb
222
+ - spec/controllers/reports_controller_spec.rb
148
223
  - spec/factories/entry_factory.rb
149
224
  - spec/factories/account_factory.rb
150
- - spec/spec_helper.rb
151
- - spec/support/factory_girl_helpers.rb
152
- - spec/support/amount_shared_examples.rb
225
+ - spec/factories/amount_factory.rb
226
+ - spec/factories/tenant_factory.rb
153
227
  - spec/support/active_support_helpers.rb
228
+ - spec/support/shoulda_matchers.rb
154
229
  - spec/support/account_shared_examples.rb
155
- - spec/routing/accounts_routing_spec.rb
156
- - spec/routing/entries_routing_spec.rb
230
+ - spec/support/factory_girl_helpers.rb
231
+ - spec/support/amount_shared_examples.rb
232
+ - spec/spec.opts
157
233
  - spec/rcov.opts
158
- - spec/controllers/entries_controller_spec.rb
159
- - spec/controllers/accounts_controller_spec.rb
160
- - spec/models/account_spec.rb
161
- - spec/models/credit_amount_spec.rb
162
- - spec/models/expense_spec.rb
163
- - spec/models/tenancy_spec.rb
164
234
  - spec/models/liability_spec.rb
165
- - spec/models/asset_spec.rb
166
- - spec/models/debit_amount_spec.rb
235
+ - spec/models/credit_amount_spec.rb
236
+ - spec/models/equity_spec.rb
167
237
  - spec/models/revenue_spec.rb
238
+ - spec/models/debit_amount_spec.rb
239
+ - spec/models/account_spec.rb
168
240
  - spec/models/amount_spec.rb
169
- - spec/models/equity_spec.rb
241
+ - spec/models/tenancy_spec.rb
170
242
  - spec/models/entry_spec.rb
171
- has_rdoc:
243
+ - spec/models/asset_spec.rb
244
+ - spec/models/expense_spec.rb
@@ -1,59 +0,0 @@
1
- <div class="plutus_container">
2
- <h1><%=h @account.name %> Account</h1>
3
-
4
- <table>
5
- <tr>
6
- <th class="nobg">ID</th>
7
- <th>Name</th>
8
- <th>Type</th>
9
- <th>Credit Balance</th>
10
- <th>Debit Balance</th>
11
- <th>Balance</td>
12
- </tr>
13
-
14
- <tr class="odd">
15
- <td><%=h @account.id %></td>
16
- <td><%=h @account.name %></td>
17
- <td><%=h @account.type.sub('Plutus::','') %></td>
18
- <td><%=h @account.credits_balance %></td>
19
- <td><%=h @account.debits_balance %></td>
20
- <td><%=h @account.balance %></td>
21
- </tr>
22
- </table>
23
-
24
- <h1>Credit Entries</h1>
25
-
26
- <table>
27
- <tr>
28
- <th class="nobg">ID</th>
29
- <th>Description</th>
30
- <th>Date</th>
31
- </tr>
32
-
33
- <% @account.credit_entries.each do |entry| %>
34
- <tr class="<%= cycle("even", "odd") -%>">
35
- <td><%=h entry.id %></td>
36
- <td><%=h entry.description %></td>
37
- <td><%=h entry.created_at %></td>
38
- </tr>
39
- <% end %>
40
- </table>
41
-
42
- <h1>Debit Entries</h1>
43
-
44
- <table>
45
- <tr>
46
- <th class="nobg">ID</th>
47
- <th>Description</th>
48
- <th>Date</th>
49
- </tr>
50
-
51
- <% @account.debit_entries.each do |tr| %>
52
- <tr class="<%= cycle("even", "odd") -%>">
53
- <td><%=h tr.id %></td>
54
- <td><%=h tr.description %></td>
55
- <td><%=h tr.created_at %></td>
56
- </tr>
57
- <% end %>
58
- </table>
59
- </div>
@@ -1,46 +0,0 @@
1
- <div class="plutus_container">
2
- <h1><%=h @entry.description %> Entry</h1>
3
-
4
- <table cellspacing="0">
5
- <thead>
6
- <tr>
7
- <th class="nobg">ID</th>
8
- <th>Description</th>
9
- <th>Debits</th>
10
- <th>Credits</th>
11
- <th>Date</th>
12
- </tr>
13
- </thead>
14
- <tbody>
15
- <tr class="<%= cycle("even", "odd") -%>">
16
- <td><%=link_to(@entry.id, entry_path(@entry)) %></td>
17
- <td><%=h @entry.description %></td>
18
- <td></td>
19
- <td></td>
20
- <td><%=h @entry.created_at %></td>
21
- </tr>
22
- <% @entry.debit_amounts.each do |debit_amount| %>
23
- <tr class="<%= cycle("odd", "odd") -%>">
24
- <td></td>
25
- <td>&nbsp;&nbsp;&nbsp;&nbsp;<%=h "#{debit_amount.account.name}" %></td>
26
- <td><%=h debit_amount.amount %></td>
27
- <td></td>
28
- <td></td>
29
- </tr>
30
- <% end %>
31
- <% @entry.credit_amounts.each do |credit_amount| %>
32
- <tr class="<%= cycle("odd", "odd") -%>">
33
- <td></td>
34
- <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=h "#{credit_amount.account.name}" %></td>
35
- <td></td>
36
- <td><%=h credit_amount.amount %></td>
37
- <td></td>
38
- </tr>
39
- <% end %>
40
- </tbody>
41
- </table>
42
-
43
- <br />
44
-
45
- <h3>Go to <%= link_to 'Accounts', accounts_path %></h3>
46
- </div>