deb 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.markdown +2 -0
- data/app/models/deb/account.rb +2 -2
- data/app/models/deb/{transaction.rb → entry.rb} +8 -6
- data/app/models/deb/item.rb +2 -2
- data/lib/deb/builder.rb +1 -1
- data/lib/deb/version.rb +1 -1
- metadata +32 -31
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YzM2OWExY2MzNDZiNmMwMDZkNDU3YjFiZGUxMjYyYmFlOThjYjMyOQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 00f5f131d0fab002694de6921668bd87a42e57d4
|
4
|
+
data.tar.gz: 7b83f540e406e4f73154dedc46b4e80a07f1bdf1
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MmFjMmI4ODZmZjM4NGY3OTg1MjIyODE3YmMzZWMxMzM0YzQ2NDM3NTVmZGZh
|
11
|
-
ZDJmMzk4OThjYzI4M2Y2ZTQwN2RjYjU0ZjM5Nzk5MjQ4MGM5NmM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODlhZWViYzdkOTFkNTYwOWEzYmUzN2MyMTI1NDhiZjdjNDQ4MjY3NzQ2MGE2
|
14
|
-
MTMzMGUyYzg2ZDQ2MzM4YjRmNDVjYjg2YjdlOGExM2NkMzM2NzU4ZGRkYTI2
|
15
|
-
MzFjZDdiMjQzNTEwMzBmNjgyNDZmNDQxYjU3ZjZiYzMyZTJlZDE=
|
6
|
+
metadata.gz: 81bad13af867c4e4bacc6b713f39682000a969ce107bca8f6fa571b43b604ad6aa1796d5bfe5683e88334cf741d689c8c2d89b327f48438327ff20096d7a9b2f
|
7
|
+
data.tar.gz: 8c90a65a055b9f6c8456715d7928291735fa55c261944172310f8451342bc9e611dd88b6803b5cf227720f11191fab088c1e3adb13c4269487a7b5f08d5ffaa9
|
data/README.markdown
CHANGED
data/app/models/deb/account.rb
CHANGED
@@ -2,11 +2,11 @@ module Deb
|
|
2
2
|
class Account < ActiveRecord::Base
|
3
3
|
belongs_to :accountable, polymorphic: true
|
4
4
|
has_many :items
|
5
|
-
has_many :
|
5
|
+
has_many :entries, through: :items
|
6
6
|
|
7
7
|
validates :kind, inclusion: {in: %w(asset liability equity revenue expense)}
|
8
8
|
|
9
|
-
attr_accessible :name, :kind, :short_name, :contra
|
9
|
+
#attr_accessible :name, :kind, :short_name, :contra
|
10
10
|
|
11
11
|
def self.[](some_shot_name)
|
12
12
|
where(short_name: some_shot_name).first
|
@@ -1,19 +1,21 @@
|
|
1
1
|
module Deb
|
2
|
-
class
|
2
|
+
class Entry < ActiveRecord::Base
|
3
3
|
belongs_to :transactionable, polymorphic: true
|
4
|
-
has_many :items
|
4
|
+
has_many :items, foreign_key: :transaction_id
|
5
5
|
has_many :accounts, through: :items
|
6
|
-
has_many :debit_items, class_name: "Deb::Item",
|
6
|
+
has_many :debit_items, -> { where(kind: "debit") }, class_name: "Deb::Item", foreign_key: :transaction_id
|
7
7
|
has_many :debit_accounts, through: :debit_items, source: :account
|
8
|
-
has_many :credit_items, class_name: "Deb::Item",
|
8
|
+
has_many :credit_items, -> { where(kind: "credit") }, class_name: "Deb::Item", foreign_key: :transaction_id
|
9
9
|
has_many :credit_accounts, through: :credit_items, source: :account
|
10
|
-
belongs_to :rollback_transaction, class_name: "Deb::
|
10
|
+
belongs_to :rollback_transaction, class_name: "Deb::Item"
|
11
11
|
|
12
12
|
validate :debit_items_presence
|
13
13
|
validate :credit_items_presence
|
14
14
|
validate :proper_amounts
|
15
15
|
|
16
|
-
|
16
|
+
self.table_name = "deb_transactions"
|
17
|
+
|
18
|
+
#attr_accessible :transactionable, :description, :kind
|
17
19
|
|
18
20
|
def self.start(&block)
|
19
21
|
Docile.dsl_eval(Deb::Builder.new, &block).build
|
data/app/models/deb/item.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Deb
|
2
2
|
class Item < ActiveRecord::Base
|
3
3
|
belongs_to :account
|
4
|
-
belongs_to :
|
4
|
+
belongs_to :entry, foreign_key: :transaction_id
|
5
5
|
validates :kind, inclusion: {in: %w(debit credit)}
|
6
6
|
validates :account_id, presence: true
|
7
7
|
validate :positive_amount
|
8
8
|
|
9
9
|
after_create :update_balances
|
10
10
|
|
11
|
-
attr_accessible :account, :amount
|
11
|
+
#attr_accessible :account, :amount
|
12
12
|
|
13
13
|
def positive_amount
|
14
14
|
errors.add(:amount, "should be positive") unless amount > 0
|
data/lib/deb/builder.rb
CHANGED
@@ -32,7 +32,7 @@ module Deb
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def build
|
35
|
-
Deb::
|
35
|
+
Deb::Entry.new(description: @description, transactionable: @reference, kind: @kind) do |t|
|
36
36
|
credits.each do |account, amount|
|
37
37
|
t.credit_items.build(account: account, amount: amount)
|
38
38
|
end
|
data/lib/deb/version.rb
CHANGED
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Nadion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-06 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
|
-
version: '0'
|
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
|
-
version: '0'
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: docile
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
- boris@astrails.com
|
@@ -101,19 +101,19 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- MIT-LICENSE
|
105
|
+
- README.markdown
|
106
|
+
- Rakefile
|
104
107
|
- app/models/deb/account.rb
|
108
|
+
- app/models/deb/entry.rb
|
105
109
|
- app/models/deb/item.rb
|
106
|
-
-
|
110
|
+
- lib/deb.rb
|
107
111
|
- lib/deb/builder.rb
|
108
112
|
- lib/deb/engine.rb
|
109
113
|
- lib/deb/version.rb
|
110
|
-
- lib/deb.rb
|
111
114
|
- lib/generators/deb/deb_generator.rb
|
112
115
|
- lib/generators/deb/templates/migration.rb
|
113
116
|
- lib/tasks/deb_tasks.rake
|
114
|
-
- MIT-LICENSE
|
115
|
-
- Rakefile
|
116
|
-
- README.markdown
|
117
117
|
homepage: https://github.com/astrails/deb
|
118
118
|
licenses:
|
119
119
|
- MIT
|
@@ -124,18 +124,19 @@ require_paths:
|
|
124
124
|
- lib
|
125
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- -
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
|
-
- -
|
132
|
+
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.4.3
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Double Entry Bookkeeping for Rails
|
141
141
|
test_files: []
|
142
|
+
has_rdoc:
|