double_entry 0.0.1.pre → 0.1.0.pre.pre.alpha

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 (64) hide show
  1. checksums.yaml +13 -5
  2. data/.gitignore +5 -6
  3. data/.rspec +1 -0
  4. data/.travis.yml +19 -0
  5. data/.yardopts +2 -0
  6. data/Gemfile +0 -1
  7. data/LICENSE.md +19 -0
  8. data/README.md +221 -14
  9. data/Rakefile +12 -0
  10. data/double_entry.gemspec +30 -15
  11. data/gemfiles/Gemfile.rails-3.2.0 +5 -0
  12. data/gemfiles/Gemfile.rails-4.0.0 +5 -0
  13. data/gemfiles/Gemfile.rails-4.1.0 +5 -0
  14. data/lib/active_record/locking_extensions.rb +61 -0
  15. data/lib/double_entry.rb +267 -2
  16. data/lib/double_entry/account.rb +82 -0
  17. data/lib/double_entry/account_balance.rb +31 -0
  18. data/lib/double_entry/aggregate.rb +118 -0
  19. data/lib/double_entry/aggregate_array.rb +65 -0
  20. data/lib/double_entry/configurable.rb +52 -0
  21. data/lib/double_entry/day_range.rb +38 -0
  22. data/lib/double_entry/hour_range.rb +40 -0
  23. data/lib/double_entry/line.rb +147 -0
  24. data/lib/double_entry/line_aggregate.rb +37 -0
  25. data/lib/double_entry/line_check.rb +118 -0
  26. data/lib/double_entry/locking.rb +187 -0
  27. data/lib/double_entry/month_range.rb +92 -0
  28. data/lib/double_entry/reporting.rb +16 -0
  29. data/lib/double_entry/time_range.rb +55 -0
  30. data/lib/double_entry/time_range_array.rb +43 -0
  31. data/lib/double_entry/transfer.rb +70 -0
  32. data/lib/double_entry/version.rb +3 -1
  33. data/lib/double_entry/week_range.rb +99 -0
  34. data/lib/double_entry/year_range.rb +39 -0
  35. data/lib/generators/double_entry/install/install_generator.rb +22 -0
  36. data/lib/generators/double_entry/install/templates/migration.rb +68 -0
  37. data/script/jack_hammer +201 -0
  38. data/script/setup.sh +8 -0
  39. data/spec/active_record/locking_extensions_spec.rb +54 -0
  40. data/spec/double_entry/account_balance_spec.rb +8 -0
  41. data/spec/double_entry/account_spec.rb +23 -0
  42. data/spec/double_entry/aggregate_array_spec.rb +75 -0
  43. data/spec/double_entry/aggregate_spec.rb +168 -0
  44. data/spec/double_entry/double_entry_spec.rb +391 -0
  45. data/spec/double_entry/line_aggregate_spec.rb +8 -0
  46. data/spec/double_entry/line_check_spec.rb +88 -0
  47. data/spec/double_entry/line_spec.rb +72 -0
  48. data/spec/double_entry/locking_spec.rb +154 -0
  49. data/spec/double_entry/month_range_spec.rb +131 -0
  50. data/spec/double_entry/reporting_spec.rb +25 -0
  51. data/spec/double_entry/time_range_array_spec.rb +149 -0
  52. data/spec/double_entry/time_range_spec.rb +43 -0
  53. data/spec/double_entry/week_range_spec.rb +88 -0
  54. data/spec/generators/double_entry/install/install_generator_spec.rb +33 -0
  55. data/spec/spec_helper.rb +47 -0
  56. data/spec/support/accounts.rb +26 -0
  57. data/spec/support/blueprints.rb +34 -0
  58. data/spec/support/database.example.yml +16 -0
  59. data/spec/support/database.travis.yml +18 -0
  60. data/spec/support/double_entry_spec_helper.rb +19 -0
  61. data/spec/support/reporting_configuration.rb +6 -0
  62. data/spec/support/schema.rb +71 -0
  63. metadata +277 -18
  64. data/LICENSE.txt +0 -22
@@ -0,0 +1,16 @@
1
+ postgres:
2
+ host: localhost
3
+ adapter: postgresql
4
+ encoding: unicode
5
+ database: double_entry_test
6
+ pool: 100
7
+ username: postgres
8
+ password:
9
+ min_messages: warning
10
+ mysql:
11
+ adapter: mysql2
12
+ encoding: utf8
13
+ database: double_entry_test
14
+ pool: 100
15
+ username: root
16
+ password:
@@ -0,0 +1,18 @@
1
+ mysql:
2
+ adapter: mysql2
3
+ username: root
4
+ password:
5
+ database: double_entry_test
6
+ pool: 100
7
+ timeout: 5000
8
+ host: 127.0.0.1
9
+
10
+ postgres:
11
+ adapter: postgresql
12
+ username: postgres
13
+ password:
14
+ database: double_entry_test
15
+ min_messages: ERROR
16
+ pool: 100
17
+ timeout: 5000
18
+ host: localhost
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ module DoubleEntrySpecHelper
3
+
4
+ def lines_for_account(account)
5
+ lines = DoubleEntry::Line.order(:id)
6
+ lines = lines.where(:scope => account.scope_identity) if account.scoped?
7
+ lines = lines.where(:account => account.identifier.to_s)
8
+ lines
9
+ end
10
+
11
+ def perform_deposit(user, amount)
12
+ DoubleEntry.transfer(Money.new(amount),
13
+ :from => DoubleEntry.account(:test, :scope => user),
14
+ :to => DoubleEntry.account(:savings, :scope => user),
15
+ :code => :bonus,
16
+ )
17
+ end
18
+
19
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ RSpec.configure do |config|
3
+ config.before do
4
+ DoubleEntry::Reporting.instance_variable_set(:@configuration, nil)
5
+ end
6
+ end
@@ -0,0 +1,71 @@
1
+ ActiveRecord::Schema.define do
2
+ self.verbose = false
3
+
4
+ create_table "double_entry_account_balances", :force => true do |t|
5
+ t.string "account", :null => false
6
+ t.string "scope"
7
+ t.integer "balance"
8
+ t.datetime "created_at"
9
+ t.datetime "updated_at"
10
+ end
11
+
12
+ add_index "double_entry_account_balances", ["account"], :name => "index_account_balances_on_account"
13
+ add_index "double_entry_account_balances", ["scope", "account"], :name => "index_account_balances_on_scope_and_account", :unique => true
14
+
15
+ create_table "double_entry_lines", :force => true do |t|
16
+ t.string "account"
17
+ t.string "scope"
18
+ t.string "code"
19
+ t.integer "amount"
20
+ t.integer "balance"
21
+ t.integer "partner_id"
22
+ t.string "partner_account"
23
+ t.string "partner_scope"
24
+ t.string "meta"
25
+ t.integer "detail_id"
26
+ t.string "detail_type"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ end
30
+
31
+ add_index "double_entry_lines", ["account", "code", "created_at"], :name => "lines_account_code_created_at_idx"
32
+ add_index "double_entry_lines", ["account", "created_at"], :name => "lines_account_created_at_idx"
33
+ add_index "double_entry_lines", ["scope", "account", "created_at"], :name => "lines_scope_account_created_at_idx"
34
+ add_index "double_entry_lines", ["scope", "account", "id"], :name => "lines_scope_account_id_idx"
35
+
36
+ create_table "double_entry_line_aggregates", :force => true do |t|
37
+ t.string "function"
38
+ t.string "account"
39
+ t.string "code"
40
+ t.string "scope"
41
+ t.integer "year"
42
+ t.integer "month"
43
+ t.integer "week"
44
+ t.integer "day"
45
+ t.integer "hour"
46
+ t.integer "amount"
47
+ t.datetime "created_at"
48
+ t.datetime "updated_at"
49
+ t.string "filter"
50
+ t.string "range_type"
51
+ end
52
+
53
+ add_index "double_entry_line_aggregates", ["function", "account", "code", "year", "month", "week", "day"], :name => "line_aggregate_idx"
54
+
55
+ create_table "double_entry_line_checks", :force => true do |t|
56
+ t.integer "last_line_id"
57
+ t.boolean "errors_found"
58
+ t.text "log"
59
+ t.datetime "created_at"
60
+ t.datetime "updated_at"
61
+ end
62
+
63
+ # test table only
64
+ create_table "users", :force => true do |t|
65
+ t.string "username"
66
+ t.datetime "created_at"
67
+ t.datetime "updated_at"
68
+ end
69
+
70
+ add_index "users", ["username"], :name => "index_users_on_username", :unique => true
71
+ end
metadata CHANGED
@@ -1,61 +1,295 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: double_entry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre
4
+ version: 0.1.0.pre.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
+ - Anthony Sellitti
8
+ - Keith Pitt
9
+ - Martin Jagusch
10
+ - Martin Spickermann
11
+ - Mark Turnley
7
12
  - Orien Madgwick
13
+ - Pete Yandall
14
+ - Stephanie Staub
8
15
  autorequire:
9
16
  bindir: bin
10
17
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
18
+ date: 2014-06-20 00:00:00.000000000 Z
12
19
  dependencies:
13
20
  - !ruby/object:Gem::Dependency
14
- name: bundler
21
+ name: money
15
22
  requirement: !ruby/object:Gem::Requirement
16
23
  requirements:
17
- - - "~>"
24
+ - - ! '>='
18
25
  - !ruby/object:Gem::Version
19
- version: '1.6'
20
- type: :development
26
+ version: 5.1.0
27
+ type: :runtime
28
+ prerelease: false
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 5.1.0
34
+ - !ruby/object:Gem::Dependency
35
+ name: encapsulate_as_money
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: activerecord
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.9
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.9
62
+ - !ruby/object:Gem::Dependency
63
+ name: activesupport
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 3.0.0
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: 3.0.0
76
+ - !ruby/object:Gem::Dependency
77
+ name: railties
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.0
83
+ type: :runtime
21
84
  prerelease: false
22
85
  version_requirements: !ruby/object:Gem::Requirement
23
86
  requirements:
24
- - - "~>"
87
+ - - ! '>='
25
88
  - !ruby/object:Gem::Version
26
- version: '1.6'
89
+ version: 3.0.0
27
90
  - !ruby/object:Gem::Dependency
28
91
  name: rake
29
92
  requirement: !ruby/object:Gem::Requirement
30
93
  requirements:
31
- - - ">="
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: mysql2
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ - !ruby/object:Gem::Dependency
119
+ name: pg
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ - !ruby/object:Gem::Dependency
133
+ name: rspec
134
+ requirement: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ - !ruby/object:Gem::Dependency
147
+ name: rspec-its
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ - !ruby/object:Gem::Dependency
161
+ name: database_cleaner
162
+ requirement: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: generator_spec
176
+ requirement: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ type: :development
182
+ prerelease: false
183
+ version_requirements: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ - !ruby/object:Gem::Dependency
189
+ name: machinist
190
+ requirement: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ! '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ type: :development
196
+ prerelease: false
197
+ version_requirements: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ! '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ - !ruby/object:Gem::Dependency
203
+ name: timecop
204
+ requirement: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ! '>='
32
207
  - !ruby/object:Gem::Version
33
208
  version: '0'
34
209
  type: :development
35
210
  prerelease: false
36
211
  version_requirements: !ruby/object:Gem::Requirement
37
212
  requirements:
38
- - - ">="
213
+ - - ! '>='
39
214
  - !ruby/object:Gem::Version
40
215
  version: '0'
41
216
  description:
42
217
  email:
218
+ - anthony.sellitti@envato.com
219
+ - me@keithpitt.com
220
+ - _@mj.io
221
+ - spickemann@gmail.com
222
+ - mark@envato.com
43
223
  - _@orien.io
224
+ - pete@envato.com
225
+ - staub.steph@gmail.com
44
226
  executables: []
45
227
  extensions: []
46
228
  extra_rdoc_files: []
47
229
  files:
48
- - ".gitignore"
230
+ - .gitignore
231
+ - .rspec
232
+ - .travis.yml
233
+ - .yardopts
49
234
  - Gemfile
50
- - LICENSE.txt
235
+ - LICENSE.md
51
236
  - README.md
52
237
  - Rakefile
53
238
  - double_entry.gemspec
239
+ - gemfiles/Gemfile.rails-3.2.0
240
+ - gemfiles/Gemfile.rails-4.0.0
241
+ - gemfiles/Gemfile.rails-4.1.0
242
+ - lib/active_record/locking_extensions.rb
54
243
  - lib/double_entry.rb
244
+ - lib/double_entry/account.rb
245
+ - lib/double_entry/account_balance.rb
246
+ - lib/double_entry/aggregate.rb
247
+ - lib/double_entry/aggregate_array.rb
248
+ - lib/double_entry/configurable.rb
249
+ - lib/double_entry/day_range.rb
250
+ - lib/double_entry/hour_range.rb
251
+ - lib/double_entry/line.rb
252
+ - lib/double_entry/line_aggregate.rb
253
+ - lib/double_entry/line_check.rb
254
+ - lib/double_entry/locking.rb
255
+ - lib/double_entry/month_range.rb
256
+ - lib/double_entry/reporting.rb
257
+ - lib/double_entry/time_range.rb
258
+ - lib/double_entry/time_range_array.rb
259
+ - lib/double_entry/transfer.rb
55
260
  - lib/double_entry/version.rb
261
+ - lib/double_entry/week_range.rb
262
+ - lib/double_entry/year_range.rb
263
+ - lib/generators/double_entry/install/install_generator.rb
264
+ - lib/generators/double_entry/install/templates/migration.rb
265
+ - script/jack_hammer
266
+ - script/setup.sh
267
+ - spec/active_record/locking_extensions_spec.rb
268
+ - spec/double_entry/account_balance_spec.rb
269
+ - spec/double_entry/account_spec.rb
270
+ - spec/double_entry/aggregate_array_spec.rb
271
+ - spec/double_entry/aggregate_spec.rb
272
+ - spec/double_entry/double_entry_spec.rb
273
+ - spec/double_entry/line_aggregate_spec.rb
274
+ - spec/double_entry/line_check_spec.rb
275
+ - spec/double_entry/line_spec.rb
276
+ - spec/double_entry/locking_spec.rb
277
+ - spec/double_entry/month_range_spec.rb
278
+ - spec/double_entry/reporting_spec.rb
279
+ - spec/double_entry/time_range_array_spec.rb
280
+ - spec/double_entry/time_range_spec.rb
281
+ - spec/double_entry/week_range_spec.rb
282
+ - spec/generators/double_entry/install/install_generator_spec.rb
283
+ - spec/spec_helper.rb
284
+ - spec/support/accounts.rb
285
+ - spec/support/blueprints.rb
286
+ - spec/support/database.example.yml
287
+ - spec/support/database.travis.yml
288
+ - spec/support/double_entry_spec_helper.rb
289
+ - spec/support/reporting_configuration.rb
290
+ - spec/support/schema.rb
56
291
  homepage: https://github.com/envato/double_entry
57
- licenses:
58
- - MIT
292
+ licenses: []
59
293
  metadata: {}
60
294
  post_install_message:
61
295
  rdoc_options: []
@@ -63,18 +297,43 @@ require_paths:
63
297
  - lib
64
298
  required_ruby_version: !ruby/object:Gem::Requirement
65
299
  requirements:
66
- - - ">="
300
+ - - ! '>='
67
301
  - !ruby/object:Gem::Version
68
302
  version: '0'
69
303
  required_rubygems_version: !ruby/object:Gem::Requirement
70
304
  requirements:
71
- - - ">"
305
+ - - ! '>'
72
306
  - !ruby/object:Gem::Version
73
307
  version: 1.3.1
74
308
  requirements: []
75
309
  rubyforge_project:
76
- rubygems_version: 2.2.2
310
+ rubygems_version: 2.3.0
77
311
  signing_key:
78
312
  specification_version: 4
79
313
  summary: Tools to build your double entry financial ledger
80
- test_files: []
314
+ test_files:
315
+ - spec/active_record/locking_extensions_spec.rb
316
+ - spec/double_entry/account_balance_spec.rb
317
+ - spec/double_entry/account_spec.rb
318
+ - spec/double_entry/aggregate_array_spec.rb
319
+ - spec/double_entry/aggregate_spec.rb
320
+ - spec/double_entry/double_entry_spec.rb
321
+ - spec/double_entry/line_aggregate_spec.rb
322
+ - spec/double_entry/line_check_spec.rb
323
+ - spec/double_entry/line_spec.rb
324
+ - spec/double_entry/locking_spec.rb
325
+ - spec/double_entry/month_range_spec.rb
326
+ - spec/double_entry/reporting_spec.rb
327
+ - spec/double_entry/time_range_array_spec.rb
328
+ - spec/double_entry/time_range_spec.rb
329
+ - spec/double_entry/week_range_spec.rb
330
+ - spec/generators/double_entry/install/install_generator_spec.rb
331
+ - spec/spec_helper.rb
332
+ - spec/support/accounts.rb
333
+ - spec/support/blueprints.rb
334
+ - spec/support/database.example.yml
335
+ - spec/support/database.travis.yml
336
+ - spec/support/double_entry_spec_helper.rb
337
+ - spec/support/reporting_configuration.rb
338
+ - spec/support/schema.rb
339
+ has_rdoc: