diff --git a/.travis.yml b/.travis.yml index 337d7f87..b33f8075 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: ruby rvm: - - 1.9.2 - 1.9.3 + - 2.0 + - 2.1 script: rake diff --git a/Gemfile.lock b/Gemfile.lock index cabf0c27..e788e5ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,114 +1,108 @@ PATH remote: . specs: - plutus (0.7.4) - rails (~> 3.1) + plutus (0.8.0) + rails (~> 4.0) GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.0) - actionpack (= 3.1.0) - mail (~> 2.3.0) - actionpack (3.1.0) - activemodel (= 3.1.0) - activesupport (= 3.1.0) - builder (~> 3.0.0) + actionmailer (4.0.2) + actionpack (= 4.0.2) + mail (~> 2.5.4) + actionpack (4.0.2) + activesupport (= 4.0.2) + builder (~> 3.1.0) erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.2) - rack-cache (~> 1.0.3) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.0) - activemodel (3.1.0) - activesupport (= 3.1.0) - bcrypt-ruby (~> 3.0.0) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.0) - activemodel (= 3.1.0) - activesupport (= 3.1.0) - arel (~> 2.2.1) - tzinfo (~> 0.3.29) - activeresource (3.1.0) - activemodel (= 3.1.0) - activesupport (= 3.1.0) - activesupport (3.1.0) - multi_json (~> 1.0) - arel (2.2.3) - bcrypt-ruby (3.0.1) - builder (3.0.0) - diff-lcs (1.1.3) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.2) + activesupport (= 4.0.2) + builder (~> 3.1.0) + activerecord (4.0.2) + activemodel (= 4.0.2) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.2) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.2) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + arel (4.0.1) + atomic (1.1.14) + builder (3.1.4) + diff-lcs (1.2.5) erubis (2.7.0) factory_girl (2.6.4) activesupport (>= 2.3.9) factory_girl_rails (1.7.0) factory_girl (~> 2.6.0) railties (>= 3.0.0) - hike (1.2.1) - i18n (0.6.0) - json (1.7.3) - mail (2.3.3) - i18n (>= 0.4.0) + hike (1.2.3) + i18n (0.6.9) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.22) - multi_json (1.3.5) + mime-types (1.25.1) + minitest (4.7.5) + multi_json (1.8.4) polyglot (0.3.3) - rack (1.3.6) - rack-cache (1.0.3) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) + rack (1.5.2) + rack-test (0.6.2) rack (>= 1.0) - rails (3.1.0) - actionmailer (= 3.1.0) - actionpack (= 3.1.0) - activerecord (= 3.1.0) - activeresource (= 3.1.0) - activesupport (= 3.1.0) - bundler (~> 1.0) - railties (= 3.1.0) - railties (3.1.0) - actionpack (= 3.1.0) - activesupport (= 3.1.0) - rack-ssl (~> 1.3.2) + rails (4.0.2) + actionmailer (= 4.0.2) + actionpack (= 4.0.2) + activerecord (= 4.0.2) + activesupport (= 4.0.2) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.2) + sprockets-rails (~> 2.0.0) + railties (4.0.2) + actionpack (= 4.0.2) + activesupport (= 4.0.2) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (0.9.2.2) - rdoc (3.12) - json (~> 1.4) - redcarpet (2.1.1) - rspec (2.10.0) - rspec-core (~> 2.10.0) - rspec-expectations (~> 2.10.0) - rspec-mocks (~> 2.10.0) - rspec-core (2.10.0) - rspec-expectations (2.10.0) - diff-lcs (~> 1.1.3) - rspec-mocks (2.10.1) - rspec-rails (2.10.1) + thor (>= 0.18.1, < 2.0) + rake (10.1.1) + redcarpet (3.0.0) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.7) + rspec-expectations (2.14.4) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.4) + rspec-rails (2.14.1) actionpack (>= 3.0) + activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec (~> 2.10.0) - sprockets (2.0.4) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + sprockets (2.10.1) hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.6) - thor (0.14.6) - tilt (1.3.3) - treetop (1.4.12) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + sqlite3 (1.3.8) + thor (0.18.1) + thread_safe (0.1.3) + atomic + tilt (1.4.1) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.37) - yard (0.8.1) + tzinfo (0.3.38) + yard (0.8.7.3) PLATFORMS ruby diff --git a/README.markdown b/README.markdown index 300a711b..cea23d3c 100644 --- a/README.markdown +++ b/README.markdown @@ -4,13 +4,22 @@ Plutus The Plutus plugin is a Ruby on Rails Engine which provides a double entry accounting system for your application. -### NOTE: This version of Plutus is compatible with RAILS 3.1 +Compatibility +============= + +* Ruby versions: MRI 1.9.3, MRI 2.0, MRI 2.1 +* Rails versions: ~> 4.0 + +For the rails 3 version, you can go here: + +[https://github.com/mbulat/plutus](https://github.com/mbulat/plutus/tree/rails3) For the rails 2 version, you can go here: [https://github.com/mbulat/plutus/tree/rails2](https://github.com/mbulat/plutus/tree/rails2) Gems in RubyGems.org >= 0.5.0 support Rails 3 +Gems in RubyGems.org >= 0.8.0 support Rails 4 Installation ============ diff --git a/app/models/plutus/account.rb b/app/models/plutus/account.rb index 73c08c2e..9a8fceef 100644 --- a/app/models/plutus/account.rb +++ b/app/models/plutus/account.rb @@ -30,8 +30,6 @@ module Plutus # # @author Michael Bulat class Account < ActiveRecord::Base - attr_accessible :name, :contra - has_many :credit_amounts, :extend => AmountsExtension has_many :debit_amounts, :extend => AmountsExtension has_many :credit_transactions, :through => :credit_amounts, :source => :transaction diff --git a/app/models/plutus/amount.rb b/app/models/plutus/amount.rb index faa6201b..bb9193a0 100644 --- a/app/models/plutus/amount.rb +++ b/app/models/plutus/amount.rb @@ -6,8 +6,6 @@ module Plutus # # @author Michael Bulat class Amount < ActiveRecord::Base - attr_accessible :account, :amount, :transaction - belongs_to :transaction belongs_to :account diff --git a/app/models/plutus/asset.rb b/app/models/plutus/asset.rb index eabeb4c6..e7259632 100644 --- a/app/models/plutus/asset.rb +++ b/app/models/plutus/asset.rb @@ -39,7 +39,7 @@ def balance # @return [BigDecimal] The decimal value balance def self.balance accounts_balance = BigDecimal.new('0') - accounts = self.find(:all) + accounts = self.all accounts.each do |asset| unless asset.contra accounts_balance += asset.balance diff --git a/app/models/plutus/equity.rb b/app/models/plutus/equity.rb index 8717e631..99bd97af 100644 --- a/app/models/plutus/equity.rb +++ b/app/models/plutus/equity.rb @@ -39,7 +39,7 @@ def balance # @return [BigDecimal] The decimal value balance def self.balance accounts_balance = BigDecimal.new('0') - accounts = self.find(:all) + accounts = self.all accounts.each do |equity| unless equity.contra accounts_balance += equity.balance diff --git a/app/models/plutus/expense.rb b/app/models/plutus/expense.rb index 54a17089..664cdaf6 100644 --- a/app/models/plutus/expense.rb +++ b/app/models/plutus/expense.rb @@ -39,7 +39,7 @@ def balance # @return [BigDecimal] The decimal value balance def self.balance accounts_balance = BigDecimal.new('0') - accounts = self.find(:all) + accounts = self.all accounts.each do |expense| unless expense.contra accounts_balance += expense.balance diff --git a/app/models/plutus/liability.rb b/app/models/plutus/liability.rb index 7ff8f418..7a171cd3 100644 --- a/app/models/plutus/liability.rb +++ b/app/models/plutus/liability.rb @@ -34,7 +34,7 @@ def balance # => # def self.balance accounts_balance = BigDecimal.new('0') - accounts = self.find(:all) + accounts = self.all accounts.each do |liability| unless liability.contra accounts_balance += liability.balance diff --git a/app/models/plutus/revenue.rb b/app/models/plutus/revenue.rb index f4b783e6..06859c53 100644 --- a/app/models/plutus/revenue.rb +++ b/app/models/plutus/revenue.rb @@ -39,7 +39,7 @@ def balance # @return [BigDecimal] The decimal value balance def self.balance accounts_balance = BigDecimal.new('0') - accounts = self.find(:all) + accounts = self.all accounts.each do |revenue| unless revenue.contra accounts_balance += revenue.balance diff --git a/app/models/plutus/transaction.rb b/app/models/plutus/transaction.rb index 28cdb4cf..2f4fc385 100644 --- a/app/models/plutus/transaction.rb +++ b/app/models/plutus/transaction.rb @@ -22,8 +22,6 @@ module Plutus # # @author Michael Bulat class Transaction < ActiveRecord::Base - attr_accessible :description, :commercial_document - belongs_to :commercial_document, :polymorphic => true has_many :credit_amounts, :extend => AmountsExtension has_many :debit_amounts, :extend => AmountsExtension diff --git a/doc/Plutus.html b/doc/Plutus.html index c9db46a1..a71a9075 100644 --- a/doc/Plutus.html +++ b/doc/Plutus.html @@ -6,13 +6,13 @@ Module: Plutus - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.7.3 - + - + + + + + + + + + + + + + + +

Module: Plutus::AmountsExtension + + + +

+ +
+ + + + + + + + +
Defined in:
+
app/models/plutus/amounts_extension.rb
+ +
+
+ +

Overview

+
+ +

Association extension for has_many :amounts relations. Internal.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) balance + + + + + +

+
+ +

Returns a sum of the referenced Amount objects.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
+
# File 'app/models/plutus/amounts_extension.rb', line 5
+
+def balance
+  balance = BigDecimal.new('0')
+  each do |amount_record|
+    if amount_record.amount
+      balance += amount_record.amount
+    else
+      balance = nil
+    end
+  end
+  return balance
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Plutus/Asset.html b/doc/Plutus/Asset.html index 42ed2352..5093d3c3 100644 --- a/doc/Plutus/Asset.html +++ b/doc/Plutus/Asset.html @@ -6,13 +6,13 @@ Class: Plutus::Asset - — Documentation by YARD 0.8.1 + — Documentation by YARD 0.8.7.3 - + - + + Class List @@ -44,8 +45,8 @@

Class List

diff --git a/doc/css/style.css b/doc/css/style.css index ca54c2b8..56a1ba8a 100644 --- a/doc/css/style.css +++ b/doc/css/style.css @@ -27,6 +27,16 @@ h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; .rdoc-term { padding-right: 25px; font-weight: bold; } .rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + /* style for