plutus 0.8.1 → 0.9.0

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +64 -41
  3. data/app/controllers/plutus/entries_controller.rb +44 -0
  4. data/app/models/plutus/account.rb +2 -2
  5. data/app/models/plutus/amount.rb +2 -2
  6. data/app/models/plutus/credit_amount.rb +2 -2
  7. data/app/models/plutus/debit_amount.rb +2 -2
  8. data/app/models/plutus/{transaction.rb → entry.rb} +16 -16
  9. data/app/views/plutus/accounts/index.html.erb +1 -1
  10. data/app/views/plutus/accounts/show.html.erb +8 -8
  11. data/app/views/plutus/{transactions → entries}/index.html.erb +8 -8
  12. data/app/views/plutus/{transactions → entries}/show.html.erb +6 -6
  13. data/config/routes.rb +1 -1
  14. data/lib/generators/plutus/USAGE +14 -3
  15. data/lib/generators/plutus/templates/migration.rb +6 -6
  16. data/lib/generators/plutus/templates/update_migration.rb +17 -0
  17. data/lib/generators/plutus/upgrade_plutus_generator.rb +28 -0
  18. data/lib/plutus/version.rb +1 -1
  19. data/spec/controllers/entries_controller_spec.rb +28 -0
  20. data/spec/factories/amount_factory.rb +3 -3
  21. data/spec/factories/entry_factory.rb +11 -0
  22. data/spec/models/account_spec.rb +7 -7
  23. data/spec/models/entry_spec.rb +91 -0
  24. data/spec/routing/{transactions_routing_spec.rb → entries_routing_spec.rb} +7 -7
  25. data/spec/support/account_shared_examples.rb +2 -2
  26. data/spec/support/amount_shared_examples.rb +2 -2
  27. metadata +17 -100
  28. data/app/assets/stylesheets/plutus/main.css.scss +0 -86
  29. data/app/controllers/plutus/transactions_controller.rb +0 -44
  30. data/spec/controllers/transactions_controller_spec.rb +0 -28
  31. data/spec/factories/transaction_factory.rb +0 -11
  32. data/spec/models/transaction_spec.rb +0 -91
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.8.1
4
+ version: 0.9.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-02-14 00:00:00.000000000 Z
11
+ date: 2014-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,76 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
- - !ruby/object:Gem::Dependency
28
- name: sqlite3
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.6'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.6'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec-rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.6'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.6'
69
- - !ruby/object:Gem::Dependency
70
- name: factory_girl
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
- - !ruby/object:Gem::Dependency
84
- name: factory_girl_rails
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.1'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.1'
97
27
  - !ruby/object:Gem::Dependency
98
28
  name: yard
99
29
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +38,6 @@ dependencies:
108
38
  - - ">="
109
39
  - !ruby/object:Gem::Version
110
40
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: redcarpet
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
41
  description: The plutus plugin provides a complete double entry accounting system
126
42
  for use in any Ruby on Rails application. The plugin follows general Double Entry
127
43
  Bookkeeping practices. All calculations are done using BigDecimal in order to prevent
@@ -139,24 +55,23 @@ files:
139
55
  - Rakefile
140
56
  - app/assets/javascripts/plutus/application.js
141
57
  - app/assets/stylesheets/plutus/application.css
142
- - app/assets/stylesheets/plutus/main.css.scss
143
58
  - app/controllers/plutus/accounts_controller.rb
144
- - app/controllers/plutus/transactions_controller.rb
59
+ - app/controllers/plutus/entries_controller.rb
145
60
  - app/models/plutus/account.rb
146
61
  - app/models/plutus/amount.rb
147
62
  - app/models/plutus/amounts_extension.rb
148
63
  - app/models/plutus/asset.rb
149
64
  - app/models/plutus/credit_amount.rb
150
65
  - app/models/plutus/debit_amount.rb
66
+ - app/models/plutus/entry.rb
151
67
  - app/models/plutus/equity.rb
152
68
  - app/models/plutus/expense.rb
153
69
  - app/models/plutus/liability.rb
154
70
  - app/models/plutus/revenue.rb
155
- - app/models/plutus/transaction.rb
156
71
  - app/views/plutus/accounts/index.html.erb
157
72
  - app/views/plutus/accounts/show.html.erb
158
- - app/views/plutus/transactions/index.html.erb
159
- - app/views/plutus/transactions/show.html.erb
73
+ - app/views/plutus/entries/index.html.erb
74
+ - app/views/plutus/entries/show.html.erb
160
75
  - config/backtrace_silencers.rb
161
76
  - config/database.yml
162
77
  - config/inflections.rb
@@ -167,27 +82,29 @@ files:
167
82
  - lib/generators/plutus/USAGE
168
83
  - lib/generators/plutus/plutus_generator.rb
169
84
  - lib/generators/plutus/templates/migration.rb
85
+ - lib/generators/plutus/templates/update_migration.rb
86
+ - lib/generators/plutus/upgrade_plutus_generator.rb
170
87
  - lib/plutus.rb
171
88
  - lib/plutus/version.rb
172
89
  - spec/controllers/accounts_controller_spec.rb
173
- - spec/controllers/transactions_controller_spec.rb
90
+ - spec/controllers/entries_controller_spec.rb
174
91
  - spec/factories/account_factory.rb
175
92
  - spec/factories/amount_factory.rb
176
- - spec/factories/transaction_factory.rb
93
+ - spec/factories/entry_factory.rb
177
94
  - spec/lib/plutus_spec.rb
178
95
  - spec/models/account_spec.rb
179
96
  - spec/models/amount_spec.rb
180
97
  - spec/models/asset_spec.rb
181
98
  - spec/models/credit_amount_spec.rb
182
99
  - spec/models/debit_amount_spec.rb
100
+ - spec/models/entry_spec.rb
183
101
  - spec/models/equity_spec.rb
184
102
  - spec/models/expense_spec.rb
185
103
  - spec/models/liability_spec.rb
186
104
  - spec/models/revenue_spec.rb
187
- - spec/models/transaction_spec.rb
188
105
  - spec/rcov.opts
189
106
  - spec/routing/accounts_routing_spec.rb
190
- - spec/routing/transactions_routing_spec.rb
107
+ - spec/routing/entries_routing_spec.rb
191
108
  - spec/schema.rb
192
109
  - spec/spec.opts
193
110
  - spec/spec_helper.rb
@@ -212,19 +129,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
129
  version: 1.3.6
213
130
  requirements: []
214
131
  rubyforge_project:
215
- rubygems_version: 2.2.0
132
+ rubygems_version: 2.2.2
216
133
  signing_key:
217
134
  specification_version: 3
218
135
  summary: A Plugin providing a Double Entry Accounting Engine for Rails
219
136
  test_files:
220
- - spec/routing/transactions_routing_spec.rb
137
+ - spec/routing/entries_routing_spec.rb
221
138
  - spec/routing/accounts_routing_spec.rb
222
139
  - spec/schema.rb
223
140
  - spec/support/account_shared_examples.rb
224
141
  - spec/support/amount_shared_examples.rb
225
142
  - spec/factories/amount_factory.rb
226
- - spec/factories/transaction_factory.rb
227
143
  - spec/factories/account_factory.rb
144
+ - spec/factories/entry_factory.rb
228
145
  - spec/spec.opts
229
146
  - spec/models/amount_spec.rb
230
147
  - spec/models/liability_spec.rb
@@ -232,13 +149,13 @@ test_files:
232
149
  - spec/models/credit_amount_spec.rb
233
150
  - spec/models/expense_spec.rb
234
151
  - spec/models/asset_spec.rb
235
- - spec/models/transaction_spec.rb
152
+ - spec/models/entry_spec.rb
236
153
  - spec/models/account_spec.rb
237
154
  - spec/models/debit_amount_spec.rb
238
155
  - spec/models/revenue_spec.rb
239
156
  - spec/rcov.opts
240
157
  - spec/lib/plutus_spec.rb
241
- - spec/controllers/transactions_controller_spec.rb
158
+ - spec/controllers/entries_controller_spec.rb
242
159
  - spec/controllers/accounts_controller_spec.rb
243
160
  - spec/spec_helper.rb
244
161
  has_rdoc:
@@ -1,86 +0,0 @@
1
- .plutus_container {
2
-
3
- /* CSS from http://wptheming.com/2011/01/simple-table-css3/ */
4
-
5
- margin:0;
6
- padding:0;
7
- border:0;
8
- font-family: "Helvetica Neue",Arial, Helvetica, sans-serif;
9
-
10
- /*
11
- Pretty Table Styling
12
- CSS Tricks also has a nice writeup: http://css-tricks.com/feature-table-design/
13
- */
14
-
15
- table {
16
- overflow:hidden;
17
- border:1px solid #d3d3d3;
18
- background:#fefefe;
19
- width:70%;
20
- margin:5% auto 0;
21
- -moz-border-radius:5px; /* FF1+ */
22
- -webkit-border-radius:5px; /* Saf3-4 */
23
- border-radius:5px;
24
- -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
25
- -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
26
- }
27
-
28
- th, td {padding:10px 18px 10px; }
29
-
30
- th {padding-top:22px; text-shadow: 1px 1px 1px #fff; background:#e8eaeb;}
31
-
32
- td {border-top:1px solid #e0e0e0; border-right:1px solid #e0e0e0;}
33
-
34
- tr.even td {background:#f6f6f6;}
35
-
36
- td.first, th.first {text-align:left}
37
-
38
- td.last {border-right:none;}
39
-
40
- /*
41
- Background gradients are completely unnessary but a neat effect.
42
- */
43
-
44
- td {
45
- background: -moz-linear-gradient(100% 25% 90deg, #fefefe, #f9f9f9);
46
- background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f9f9f9), to(#fefefe));
47
- }
48
-
49
- tr.even td {
50
- background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
51
- background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
52
- }
53
-
54
- th {
55
- background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
56
- background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
57
- }
58
-
59
- /*
60
- I know this is annoying, but we need dditional styling so webkit will recognize rounded corners on background elements.
61
- Nice write up of this issue: http://www.onenaught.com/posts/266/css-inner-elements-breaking-border-radius
62
-
63
- And, since we've applied the background colors to td/th element because of IE, Gecko browsers also need it.
64
- */
65
-
66
- tr:first-child th.first {
67
- -moz-border-radius-topleft:5px;
68
- -webkit-border-top-left-radius:5px; /* Saf3-4 */
69
- }
70
-
71
- tr:first-child th.last {
72
- -moz-border-radius-topright:5px;
73
- -webkit-border-top-right-radius:5px; /* Saf3-4 */
74
- }
75
-
76
- tr:last-child td.first {
77
- -moz-border-radius-bottomleft:5px;
78
- -webkit-border-bottom-left-radius:5px; /* Saf3-4 */
79
- }
80
-
81
- tr:last-child td.last {
82
- -moz-border-radius-bottomright:5px;
83
- -webkit-border-bottom-right-radius:5px; /* Saf3-4 */
84
- }
85
-
86
- }
@@ -1,44 +0,0 @@
1
- module Plutus
2
- # This controller provides restful route handling for Transactions.
3
- #
4
- # The controller supports ActiveResource, and provides for
5
- # HMTL, XML, and JSON presentation.
6
- #
7
- # == Security:
8
- # Only GET requests are supported. You should ensure that your application
9
- # controller enforces its own authentication and authorization, which this
10
- # controller will inherit.
11
- #
12
- # @author Michael Bulat
13
- class TransactionsController < ApplicationController
14
- unloadable
15
- # @example
16
- # GET /transactions
17
- # GET /transactions.xml
18
- # GET /transactions.json
19
- def index
20
- @transactions = Transaction.all
21
-
22
- respond_to do |format|
23
- format.html # index.html.erb
24
- format.xml { render :xml => @transactions }
25
- format.json { render :json => @transactions }
26
- end
27
- end
28
-
29
- # @example
30
- # GET /transactions/1
31
- # GET /transactions/1.xml
32
- # GET /transactions/1.json
33
- def show
34
- @transaction = Transaction.find(params[:id])
35
-
36
- respond_to do |format|
37
- format.html # show.html.erb
38
- format.xml { render :xml => @transaction }
39
- format.json { render :json => @transaction }
40
- end
41
- end
42
-
43
- end
44
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Plutus
4
- describe TransactionsController do
5
- # Run these tests if you enable routing in your rails app. See README
6
-
7
- #def mock_transaction(stubs={})
8
- #@mock_transaction ||= mock_model(Transaction, stubs)
9
- #end
10
-
11
- #describe "GET index" do
12
- #it "assigns all transactions as @transactions" do
13
- #Transaction.stub(:find).with(:all).and_return([mock_transaction])
14
- #get :index
15
- #assigns[:transactions].should == [mock_transaction]
16
- #end
17
- #end
18
-
19
- #describe "GET show" do
20
- #it "assigns the requested transaction as @transaction" do
21
- #Transaction.stub(:find).with("37").and_return(mock_transaction)
22
- #get :show, :id => "37"
23
- #assigns[:transaction].should equal(mock_transaction)
24
- #end
25
- #end
26
-
27
- end
28
- end
@@ -1,11 +0,0 @@
1
- FactoryGirl.define do
2
- factory :transaction, :class => Plutus::Transaction do |transaction|
3
- transaction.description 'factory description'
4
- factory :transaction_with_credit_and_debit, :class => Plutus::Transaction do |transaction_cd|
5
- transaction_cd.after_build do |t|
6
- t.credit_amounts << FactoryGirl.build(:credit_amount, :transaction => t)
7
- t.debit_amounts << FactoryGirl.build(:debit_amount, :transaction => t)
8
- end
9
- end
10
- end
11
- end
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Plutus
4
- describe Transaction do
5
- let(:transaction) { FactoryGirl.build(:transaction) }
6
- subject { transaction }
7
-
8
- it { should_not be_valid }
9
-
10
- context "with credit and debit" do
11
- let(:transaction) { FactoryGirl.build(:transaction_with_credit_and_debit) }
12
- it { should be_valid }
13
-
14
- it "should require a description" do
15
- transaction.description = nil
16
- transaction.should_not be_valid
17
- end
18
- end
19
-
20
- context "with a debit" do
21
- before {
22
- transaction.debit_amounts << FactoryGirl.build(:debit_amount, transaction: transaction)
23
- }
24
- it { should_not be_valid }
25
-
26
- context "with an invalid credit" do
27
- before {
28
- transaction.credit_amounts << FactoryGirl.build(:credit_amount, transaction: transaction, amount: nil)
29
- }
30
- it { should_not be_valid }
31
- end
32
- end
33
-
34
- context "with a credit" do
35
- before {
36
- transaction.credit_amounts << FactoryGirl.build(:credit_amount, transaction: transaction)
37
- }
38
- it { should_not be_valid }
39
-
40
- context "with an invalid debit" do
41
- before {
42
- transaction.debit_amounts << FactoryGirl.build(:debit_amount, transaction: transaction, amount: nil)
43
- }
44
- it { should_not be_valid }
45
- end
46
- end
47
-
48
- it "should require the debit and credit amounts to cancel" do
49
- transaction.credit_amounts << FactoryGirl.build(:credit_amount, :amount => 100, :transaction => transaction)
50
- transaction.debit_amounts << FactoryGirl.build(:debit_amount, :amount => 200, :transaction => transaction)
51
- transaction.should_not be_valid
52
- transaction.errors['base'].should == ["The credit and debit amounts are not equal"]
53
- end
54
-
55
- it "should require the debit and credit amounts to cancel even with fractions" do
56
- transaction = FactoryGirl.build(:transaction)
57
- transaction.credit_amounts << FactoryGirl.build(:credit_amount, :amount => 100.1, :transaction => transaction)
58
- transaction.debit_amounts << FactoryGirl.build(:debit_amount, :amount => 100.2, :transaction => transaction)
59
- transaction.should_not be_valid
60
- transaction.errors['base'].should == ["The credit and debit amounts are not equal"]
61
- end
62
-
63
- it "should have a polymorphic commercial document associations" do
64
- mock_document = FactoryGirl.create(:asset) # one would never do this, but it allows us to not require a migration for the test
65
- transaction = FactoryGirl.build(:transaction_with_credit_and_debit, commercial_document: mock_document)
66
- transaction.save!
67
- saved_transaction = Transaction.find(transaction.id)
68
- saved_transaction.commercial_document.should == mock_document
69
- end
70
-
71
- it "should allow building a transaction and credit and debits with a hash" do
72
- FactoryGirl.create(:asset, name: "Accounts Receivable")
73
- FactoryGirl.create(:revenue, name: "Sales Revenue")
74
- FactoryGirl.create(:liability, name: "Sales Tax Payable")
75
- mock_document = FactoryGirl.create(:asset)
76
- transaction = Transaction.build(
77
- description: "Sold some widgets",
78
- commercial_document: mock_document,
79
- debits: [
80
- {account: "Accounts Receivable", amount: 50}],
81
- credits: [
82
- {account: "Sales Revenue", amount: 45},
83
- {account: "Sales Tax Payable", amount: 5}])
84
- transaction.save!
85
-
86
- saved_transaction = Transaction.find(transaction.id)
87
- saved_transaction.commercial_document.should == mock_document
88
- end
89
-
90
- end
91
- end