reckon 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08cdfad096b04db11f671775c0119fcecefa7db46134f1c43677e949628498db'
4
- data.tar.gz: 5ed2722b2843a5147faabdd82b0027fe590ff9dd66000100e756fad6de13a116
3
+ metadata.gz: 26126e1e4ead4fcd93a94093f8e4a4fd557a9c46ccc6983198d4bdd516e639ee
4
+ data.tar.gz: f196a86ca58ebaeee4f27030bb21af9fd3c3001d20d06b74f2063ea42d96cfcc
5
5
  SHA512:
6
- metadata.gz: 7ebe28c482f091424d405efa1dc4b94cdc76022b114ce6f0db22a96e3ec6104a6e1efecec833af981f9c97f4c705cbbbd7f791403b5b669452abccd2caf295c8
7
- data.tar.gz: 7af0ef7c71bcca9b189d23939ebeb93eedbe0875373818419d878461c33035a5e92359204c939ac3d8933935ad29b8a9cec319ddb84ea13626e22f51897f2fea
6
+ metadata.gz: 02ad471caf5a5b6b69d98cde9cfa5e0579bbe680f50bb7fa8c1f5b3a7908018a48075531674a27d23139913be9156f889cac8010e06de87439c0665b064d7171
7
+ data.tar.gz: a8abf375fab7ba91d31a0d05ee372a5fc788feca0fe6a61859cb4ed6c72a3387238a4df2d2dac2ce300fe4f047142ea18bbe03a364e008e2b9588143f0223852
@@ -9,9 +9,7 @@ name: Build Status
9
9
 
10
10
  on:
11
11
  push:
12
- branches: [ master ]
13
12
  pull_request:
14
- branches: [ master ]
15
13
 
16
14
  jobs:
17
15
  test:
@@ -31,7 +29,7 @@ jobs:
31
29
  - name: Update package
32
30
  run: sudo apt-get update
33
31
  - name: Install packages
34
- run: sudo apt-get -y install ledger hledger expect
32
+ run: sudo apt-get -y install ledger hledger
35
33
  - name: Set up Ruby
36
34
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
37
35
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
data/.gitignore CHANGED
@@ -29,6 +29,11 @@ private_tests
29
29
  ## Bundler
30
30
  vendor
31
31
  .bundle
32
+ # binstubs
33
+ exec/
34
+
35
+ # Don't commit gem files
36
+ *.gem
32
37
 
33
38
  test.log
34
39
  test_log.txt
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.9.0](https://github.com/cantino/reckon/tree/v0.9.0) (2023-02-23)
4
+
5
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.9.0-beta...v0.9.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Add support for multiple money columns [\#118](https://github.com/cantino/reckon/pull/118) ([oskarth](https://github.com/oskarth))
10
+
11
+ ## [v0.9.0-beta](https://github.com/cantino/reckon/tree/v0.9.0-beta) (2023-02-21)
12
+
13
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.8.1...v0.9.0-beta)
14
+
3
15
  ## [v0.8.1](https://github.com/cantino/reckon/tree/v0.8.1) (2022-07-02)
4
16
 
5
17
  [Full Changelog](https://github.com/cantino/reckon/compare/v0.8.0...v0.8.1)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.8.1)
4
+ reckon (0.9.0)
5
5
  chronic (>= 0.3.0)
6
6
  highline (>= 1.5.2)
7
7
  matrix (>= 0.4.2)
@@ -11,30 +11,30 @@ GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
13
  chronic (0.10.2)
14
- coderay (1.1.2)
15
- diff-lcs (1.3)
16
- highline (2.0.3)
14
+ coderay (1.1.3)
15
+ diff-lcs (1.5.0)
16
+ highline (2.1.0)
17
17
  matrix (0.4.2)
18
- method_source (0.9.2)
19
- pry (0.12.2)
20
- coderay (~> 1.1.0)
21
- method_source (~> 0.9.0)
22
- rake (12.3.3)
18
+ method_source (1.0.0)
19
+ pry (0.14.2)
20
+ coderay (~> 1.1)
21
+ method_source (~> 1.0)
22
+ rake (13.0.6)
23
23
  rantly (1.2.0)
24
24
  rchardet (1.8.0)
25
- rspec (3.9.0)
26
- rspec-core (~> 3.9.0)
27
- rspec-expectations (~> 3.9.0)
28
- rspec-mocks (~> 3.9.0)
29
- rspec-core (3.9.1)
30
- rspec-support (~> 3.9.1)
31
- rspec-expectations (3.9.0)
25
+ rspec (3.12.0)
26
+ rspec-core (~> 3.12.0)
27
+ rspec-expectations (~> 3.12.0)
28
+ rspec-mocks (~> 3.12.0)
29
+ rspec-core (3.12.1)
30
+ rspec-support (~> 3.12.0)
31
+ rspec-expectations (3.12.2)
32
32
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.9.0)
34
- rspec-mocks (3.9.1)
33
+ rspec-support (~> 3.12.0)
34
+ rspec-mocks (3.12.3)
35
35
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.9.0)
37
- rspec-support (3.9.2)
36
+ rspec-support (~> 3.12.0)
37
+ rspec-support (3.12.0)
38
38
 
39
39
  PLATFORMS
40
40
  ruby
@@ -47,4 +47,4 @@ DEPENDENCIES
47
47
  rspec (>= 1.2.9)
48
48
 
49
49
  BUNDLED WITH
50
- 1.17.3
50
+ 2.3.5
data/README.md CHANGED
@@ -45,6 +45,8 @@ Learn more:
45
45
  Columns to ignore, starts from 1
46
46
  --money-column 2
47
47
  Column number of the money column, starts from 1
48
+ --money-columns 2,3
49
+ Column number of the money columns, starts from 1 (1 or 2 columns)
48
50
  --raw-money
49
51
  Don't format money column (for stocks)
50
52
  --date-column 3
@@ -126,13 +126,6 @@ module Reckon
126
126
  return results.sort_by { |n| n[:index] }
127
127
  end
128
128
 
129
- def found_double_money_column(id1, id2)
130
- self.money_column_indices = [id1, id2]
131
- puts "It looks like this CSV has two seperate columns for money, one of which shows positive"
132
- puts "changes and one of which shows negative changes. If this is true, great. Otherwise,"
133
- puts "please report this issue to us so we can take a look!\n"
134
- end
135
-
136
129
  # Some csv files negative/positive amounts are indicated in separate account
137
130
  def detect_sign_column
138
131
  return if columns[0].length <= 2 # This test needs requires more than two rows otherwise will lead to false positives
@@ -162,14 +155,30 @@ module Reckon
162
155
  def detect_columns
163
156
  results = evaluate_columns(columns)
164
157
 
158
+ # We keep money_column options for backwards compatibility reasons, while
159
+ # adding option to specify multiple money_columns
165
160
  if options[:money_column]
166
161
  self.money_column_indices = [options[:money_column] - 1]
162
+
163
+ # One or two columns can be specified as money_columns
164
+ elsif options[:money_columns]
165
+ if options[:money_columns].length == 1
166
+ self.money_column_indices = [options[:money_column] - 1]
167
+ elsif options[:money_columns].length == 2
168
+ in_col, out_col = options[:money_columns]
169
+ self.money_column_indices = [in_col -1, out_col -1]
170
+ else
171
+ puts "Unable to determine money columns, use --money-columns to specify the 1 or 2 column(s) reckon should use."
172
+ end
173
+
174
+ # If no money_column(s) argument is supplied, try to automatically infer money_column(s)
167
175
  else
168
176
  self.money_column_indices = results.select { |n| n[:is_money_column] }.map { |n| n[:index] }
169
177
  if self.money_column_indices.length == 1
170
178
  puts "Using column #{money_column_indices.first + 1} as the money column. Use --money-colum to specify a different one."
171
179
  elsif self.money_column_indices.length == 2
172
- found_double_money_column(*self.money_column_indices)
180
+ puts "Using columns #{money_column_indices[0] + 1} and #{money_column_indices[1] + 1} as money column. Use --money-columns to specify different ones."
181
+ self.money_column_indices = self.money_column_indices[0..1]
173
182
  else
174
183
  puts "Unable to determine a money column, use --money-column to specify the column reckon should use."
175
184
  end
@@ -44,6 +44,10 @@ module Reckon
44
44
  options[:money_column] = col
45
45
  end
46
46
 
47
+ opts.on("", "--money-columns 2,3", "Column number of the money columns, starts from 1 (1 or 2 columns)") do |ignore|
48
+ options[:money_columns] = ignore.split(",").map(&:to_i)
49
+ end
50
+
47
51
  opts.on("", "--raw-money", "Don't format money column (for stocks)") do |n|
48
52
  options[:raw] = n
49
53
  end
@@ -1,3 +1,3 @@
1
1
  module Reckon
2
- VERSION="0.8.1"
2
+ VERSION="0.9.0"
3
3
  end
@@ -0,0 +1 @@
1
+ Test::Bank
@@ -31,7 +31,7 @@ main () {
31
31
  TEST_DIR=$(dirname "$t")
32
32
  TEST_LOG=$(mktemp)
33
33
  pushd "$TEST_DIR" >/dev/null || exit 1
34
- if [[ -e "cli_input.exp" ]]; then
34
+ if [[ -e "cli_input.txt" ]]; then
35
35
  cli_test >$TEST_LOG 2>&1
36
36
  else
37
37
  unattended_test >$TEST_LOG 2>&1
@@ -56,10 +56,8 @@ main () {
56
56
 
57
57
  cli_test () {
58
58
  OUTPUT_FILE=$(mktemp)
59
- CLI_CMD="$RECKON_CMD --table-output-file $OUTPUT_FILE $(cat test_args)"
60
- TEST_CMD="expect -d -c 'spawn $CLI_CMD' cli_input.exp"
61
- eval "$TEST_CMD" 2>&1
62
- ERROR=0
59
+ TEST_CMD="$RECKON_CMD --table-output-file $OUTPUT_FILE $(cat test_args)"
60
+ cat cli_input.txt | $TEST_CMD
63
61
  TEST_DIFF=$(diff -u "$OUTPUT_FILE" expected_output)
64
62
 
65
63
  # ${#} is character length, test that there was no output from diff
@@ -0,0 +1,5 @@
1
+ Date,Summary,Withdrawal,Deposit,Ending balance,Remarks,In/outward transfer account,Notes
2
+ 2021/07/02,Expense,200,,999,,,
3
+ 2021/07/02,Expense,100,,999,,,
4
+ 2021/07/08,Transfer,,200,999,,,In1
5
+ 2021/07/08,Transfer,500,,999,,,Out1
@@ -0,0 +1,16 @@
1
+ 2021-07-02 Expense; 999
2
+ Expenses:Unknown
3
+ Assets:Bank:Checking -$100.00
4
+
5
+ 2021-07-02 Expense; 999
6
+ Expenses:Unknown
7
+ Assets:Bank:Checking -$200.00
8
+
9
+ 2021-07-08 Transfer; 999; In1
10
+ Assets:Bank:Checking $200.00
11
+ Expenses:Unknown
12
+
13
+ 2021-07-08 Transfer; 999; Out1
14
+ Expenses:Unknown
15
+ Assets:Bank:Checking -$500.00
16
+
@@ -0,0 +1 @@
1
+ -f input.csv --unattended --account Assets:Bank:Checking --money-columns 3,4
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reckon
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
  - Andrew Cantino
8
8
  - BlackEdder
9
9
  - Ben Prew
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-07-02 00:00:00.000000000 Z
13
+ date: 2023-02-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -177,7 +177,7 @@ files:
177
177
  - spec/integration/another_bank_example/input.csv
178
178
  - spec/integration/another_bank_example/output.ledger
179
179
  - spec/integration/another_bank_example/test_args
180
- - spec/integration/ask_for_account/cli_input.exp
180
+ - spec/integration/ask_for_account/cli_input.txt
181
181
  - spec/integration/ask_for_account/expected_output
182
182
  - spec/integration/ask_for_account/input.csv
183
183
  - spec/integration/ask_for_account/test_args
@@ -265,6 +265,9 @@ files:
265
265
  - spec/integration/two_money_columns/input.csv
266
266
  - spec/integration/two_money_columns/output.ledger
267
267
  - spec/integration/two_money_columns/test_args
268
+ - spec/integration/two_money_columns_manual/input.csv
269
+ - spec/integration/two_money_columns_manual/output.ledger
270
+ - spec/integration/two_money_columns_manual/test_args
268
271
  - spec/integration/yyyymmdd_date_example/input.csv
269
272
  - spec/integration/yyyymmdd_date_example/output.ledger
270
273
  - spec/integration/yyyymmdd_date_example/test_args
@@ -281,7 +284,7 @@ homepage: https://github.com/cantino/reckon
281
284
  licenses:
282
285
  - MIT
283
286
  metadata: {}
284
- post_install_message:
287
+ post_install_message:
285
288
  rdoc_options: []
286
289
  require_paths:
287
290
  - lib
@@ -296,142 +299,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
299
  - !ruby/object:Gem::Version
297
300
  version: '0'
298
301
  requirements: []
299
- rubygems_version: 3.3.7
300
- signing_key:
302
+ rubygems_version: 3.3.5
303
+ signing_key:
301
304
  specification_version: 4
302
305
  summary: Utility for interactively converting and labeling CSV files for the Ledger
303
306
  accounting tool.
304
- test_files:
305
- - spec/cosine_training_and_test.rb
306
- - spec/data_fixtures/51-sample.csv
307
- - spec/data_fixtures/51-tokens.yml
308
- - spec/data_fixtures/73-sample.csv
309
- - spec/data_fixtures/73-tokens.yml
310
- - spec/data_fixtures/73-transactions.ledger
311
- - spec/data_fixtures/85-date-example.csv
312
- - spec/data_fixtures/austrian_example.csv
313
- - spec/data_fixtures/bom_utf8_file.csv
314
- - spec/data_fixtures/broker_canada_example.csv
315
- - spec/data_fixtures/chase.csv
316
- - spec/data_fixtures/danish_kroner_nordea_example.csv
317
- - spec/data_fixtures/english_date_example.csv
318
- - spec/data_fixtures/extratofake.csv
319
- - spec/data_fixtures/french_example.csv
320
- - spec/data_fixtures/german_date_example.csv
321
- - spec/data_fixtures/harder_date_example.csv
322
- - spec/data_fixtures/ing.csv
323
- - spec/data_fixtures/intuit_mint_example.csv
324
- - spec/data_fixtures/invalid_header_example.csv
325
- - spec/data_fixtures/inversed_credit_card.csv
326
- - spec/data_fixtures/nationwide.csv
327
- - spec/data_fixtures/simple.csv
328
- - spec/data_fixtures/some_other.csv
329
- - spec/data_fixtures/spanish_date_example.csv
330
- - spec/data_fixtures/suntrust.csv
331
- - spec/data_fixtures/test_money_column.csv
332
- - spec/data_fixtures/tokens.yaml
333
- - spec/data_fixtures/two_money_columns.csv
334
- - spec/data_fixtures/yyyymmdd_date_example.csv
335
- - spec/integration/another_bank_example/input.csv
336
- - spec/integration/another_bank_example/output.ledger
337
- - spec/integration/another_bank_example/test_args
338
- - spec/integration/ask_for_account/cli_input.exp
339
- - spec/integration/ask_for_account/expected_output
340
- - spec/integration/ask_for_account/input.csv
341
- - spec/integration/ask_for_account/test_args
342
- - spec/integration/austrian_example/input.csv
343
- - spec/integration/austrian_example/output.ledger
344
- - spec/integration/austrian_example/test_args
345
- - spec/integration/bom_utf8_file/input.csv
346
- - spec/integration/bom_utf8_file/output.ledger
347
- - spec/integration/bom_utf8_file/test_args
348
- - spec/integration/broker_canada_example/input.csv
349
- - spec/integration/broker_canada_example/output.ledger
350
- - spec/integration/broker_canada_example/test_args
351
- - spec/integration/chase/account_tokens_and_regex/output.ledger
352
- - spec/integration/chase/account_tokens_and_regex/test_args
353
- - spec/integration/chase/account_tokens_and_regex/tokens.yml
354
- - spec/integration/chase/default_account_names/output.ledger
355
- - spec/integration/chase/default_account_names/test_args
356
- - spec/integration/chase/input.csv
357
- - spec/integration/chase/learn_from_existing/learn.ledger
358
- - spec/integration/chase/learn_from_existing/output.ledger
359
- - spec/integration/chase/learn_from_existing/test_args
360
- - spec/integration/chase/simple/output.ledger
361
- - spec/integration/chase/simple/test_args
362
- - spec/integration/danish_kroner_nordea_example/input.csv
363
- - spec/integration/danish_kroner_nordea_example/output.ledger
364
- - spec/integration/danish_kroner_nordea_example/test_args
365
- - spec/integration/english_date_example/input.csv
366
- - spec/integration/english_date_example/output.ledger
367
- - spec/integration/english_date_example/test_args
368
- - spec/integration/extratofake/input.csv
369
- - spec/integration/extratofake/output.ledger
370
- - spec/integration/extratofake/test_args
371
- - spec/integration/french_example/input.csv
372
- - spec/integration/french_example/output.ledger
373
- - spec/integration/french_example/test_args
374
- - spec/integration/german_date_example/input.csv
375
- - spec/integration/german_date_example/output.ledger
376
- - spec/integration/german_date_example/test_args
377
- - spec/integration/harder_date_example/input.csv
378
- - spec/integration/harder_date_example/output.ledger
379
- - spec/integration/harder_date_example/test_args
380
- - spec/integration/ing/input.csv
381
- - spec/integration/ing/output.ledger
382
- - spec/integration/ing/test_args
383
- - spec/integration/intuit_mint_example/input.csv
384
- - spec/integration/intuit_mint_example/output.ledger
385
- - spec/integration/intuit_mint_example/test_args
386
- - spec/integration/invalid_header_example/input.csv
387
- - spec/integration/invalid_header_example/output.ledger
388
- - spec/integration/invalid_header_example/test_args
389
- - spec/integration/inversed_credit_card/input.csv
390
- - spec/integration/inversed_credit_card/output.ledger
391
- - spec/integration/inversed_credit_card/test_args
392
- - spec/integration/ledger_date_format/compare_cmds
393
- - spec/integration/ledger_date_format/input.csv
394
- - spec/integration/ledger_date_format/output.ledger
395
- - spec/integration/ledger_date_format/test_args
396
- - spec/integration/nationwide/input.csv
397
- - spec/integration/nationwide/output.ledger
398
- - spec/integration/nationwide/test_args
399
- - spec/integration/regression/issue_51_account_tokens/input.csv
400
- - spec/integration/regression/issue_51_account_tokens/output.ledger
401
- - spec/integration/regression/issue_51_account_tokens/test_args
402
- - spec/integration/regression/issue_51_account_tokens/tokens.yml
403
- - spec/integration/regression/issue_64_date_column/input.csv
404
- - spec/integration/regression/issue_64_date_column/output.ledger
405
- - spec/integration/regression/issue_64_date_column/test_args
406
- - spec/integration/regression/issue_73_account_token_matching/input.csv
407
- - spec/integration/regression/issue_73_account_token_matching/output.ledger
408
- - spec/integration/regression/issue_73_account_token_matching/test_args
409
- - spec/integration/regression/issue_73_account_token_matching/tokens.yml
410
- - spec/integration/regression/issue_85_date_example/input.csv
411
- - spec/integration/regression/issue_85_date_example/output.ledger
412
- - spec/integration/regression/issue_85_date_example/test_args
413
- - spec/integration/spanish_date_example/input.csv
414
- - spec/integration/spanish_date_example/output.ledger
415
- - spec/integration/spanish_date_example/test_args
416
- - spec/integration/suntrust/input.csv
417
- - spec/integration/suntrust/output.ledger
418
- - spec/integration/suntrust/test_args
419
- - spec/integration/test.sh
420
- - spec/integration/test_money_column/input.csv
421
- - spec/integration/test_money_column/output.ledger
422
- - spec/integration/test_money_column/test_args
423
- - spec/integration/two_money_columns/input.csv
424
- - spec/integration/two_money_columns/output.ledger
425
- - spec/integration/two_money_columns/test_args
426
- - spec/integration/yyyymmdd_date_example/input.csv
427
- - spec/integration/yyyymmdd_date_example/output.ledger
428
- - spec/integration/yyyymmdd_date_example/test_args
429
- - spec/reckon/app_spec.rb
430
- - spec/reckon/csv_parser_spec.rb
431
- - spec/reckon/date_column_spec.rb
432
- - spec/reckon/ledger_parser_spec.rb
433
- - spec/reckon/money_column_spec.rb
434
- - spec/reckon/money_spec.rb
435
- - spec/reckon/options_spec.rb
436
- - spec/spec.opts
437
- - spec/spec_helper.rb
307
+ test_files: []
@@ -1,33 +0,0 @@
1
- #!/usr/bin/expect -f
2
-
3
-
4
- set timeout 7
5
- match_max 100000
6
- expect "What is this account named in Ledger |Assets:Bank:Checking|?\r
7
- \[1Gā–½\[6n"
8
- send -- "\[45;2R"
9
- expect -exact "\[1G\[K\[6n"
10
- send -- "\[45;1R"
11
- expect "\[1G\[K\[1G\[1G"
12
- send -- "T"
13
- expect "\[1GT\[K\[1G\[2G"
14
- send -- "e"
15
- expect "\[1GTe\[K\[1G\[3G"
16
- send -- "s"
17
- expect "\[1GTes\[K\[1G\[4G"
18
- send -- "t"
19
- expect "\[1GTest\[K\[1G\[5G"
20
- send -- ":"
21
- expect "\[1GTest:\[K\[1G\[6G"
22
- send -- ":"
23
- expect "\[1GTest::\[K\[1G\[7G"
24
- send -- "B"
25
- expect "\[1GTest::B\[K\[1G\[8G"
26
- send -- "a"
27
- expect "\[1GTest::Ba\[K\[1G\[9G"
28
- send -- "n"
29
- expect "\[1GTest::Ban\[K\[1G\[10G"
30
- send -- "k"
31
- expect "\[1GTest::Bank\[K\[1G\[11G"
32
- send -- "\r"
33
- expect eof