reckon 0.5.4 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +50 -0
  3. data/.gitignore +3 -0
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +73 -4
  6. data/Gemfile.lock +1 -45
  7. data/README.md +84 -33
  8. data/Rakefile +17 -1
  9. data/bin/build-new-version.sh +26 -0
  10. data/bin/reckon +6 -1
  11. data/lib/reckon.rb +2 -2
  12. data/lib/reckon/app.rb +140 -194
  13. data/lib/reckon/csv_parser.rb +2 -7
  14. data/lib/reckon/date_column.rb +10 -0
  15. data/lib/reckon/money.rb +48 -48
  16. data/lib/reckon/options.rb +149 -0
  17. data/lib/reckon/version.rb +1 -1
  18. data/reckon.gemspec +1 -3
  19. data/spec/integration/another_bank_example/input.csv +9 -0
  20. data/spec/integration/another_bank_example/output.ledger +36 -0
  21. data/spec/integration/another_bank_example/test_args +1 -0
  22. data/spec/integration/austrian_example/input.csv +13 -0
  23. data/spec/integration/austrian_example/output.ledger +52 -0
  24. data/spec/integration/austrian_example/test_args +2 -0
  25. data/spec/integration/bom_utf8_file/input.csv +3 -0
  26. data/spec/integration/bom_utf8_file/output.ledger +4 -0
  27. data/spec/integration/bom_utf8_file/test_args +3 -0
  28. data/spec/integration/broker_canada_example/input.csv +12 -0
  29. data/spec/integration/broker_canada_example/output.ledger +48 -0
  30. data/spec/integration/broker_canada_example/test_args +1 -0
  31. data/spec/integration/chase/account_tokens_and_regex/output.ledger +36 -0
  32. data/spec/integration/chase/account_tokens_and_regex/test_args +2 -0
  33. data/spec/integration/chase/account_tokens_and_regex/tokens.yml +16 -0
  34. data/spec/integration/chase/default_account_names/output.ledger +36 -0
  35. data/spec/integration/chase/default_account_names/test_args +3 -0
  36. data/spec/integration/chase/input.csv +9 -0
  37. data/spec/integration/chase/learn_from_existing/learn.ledger +7 -0
  38. data/spec/integration/chase/learn_from_existing/output.ledger +36 -0
  39. data/spec/integration/chase/learn_from_existing/test_args +1 -0
  40. data/spec/integration/chase/simple/output.ledger +36 -0
  41. data/spec/integration/chase/simple/test_args +1 -0
  42. data/spec/integration/danish_kroner_nordea_example/input.csv +6 -0
  43. data/spec/integration/danish_kroner_nordea_example/output.ledger +24 -0
  44. data/spec/integration/danish_kroner_nordea_example/test_args +1 -0
  45. data/spec/integration/english_date_example/input.csv +3 -0
  46. data/spec/integration/english_date_example/output.ledger +12 -0
  47. data/spec/integration/english_date_example/test_args +1 -0
  48. data/spec/integration/extratofake/input.csv +24 -0
  49. data/spec/integration/extratofake/output.ledger +92 -0
  50. data/spec/integration/extratofake/test_args +1 -0
  51. data/spec/integration/french_example/input.csv +9 -0
  52. data/spec/integration/french_example/output.ledger +36 -0
  53. data/spec/integration/french_example/test_args +2 -0
  54. data/spec/integration/german_date_example/input.csv +3 -0
  55. data/spec/integration/german_date_example/output.ledger +12 -0
  56. data/spec/integration/german_date_example/test_args +1 -0
  57. data/spec/integration/harder_date_example/input.csv +5 -0
  58. data/spec/integration/harder_date_example/output.ledger +20 -0
  59. data/spec/integration/harder_date_example/test_args +1 -0
  60. data/spec/integration/ing/input.csv +3 -0
  61. data/spec/integration/ing/output.ledger +12 -0
  62. data/spec/integration/ing/test_args +1 -0
  63. data/spec/integration/intuit_mint_example/input.csv +7 -0
  64. data/spec/integration/intuit_mint_example/output.ledger +28 -0
  65. data/spec/integration/intuit_mint_example/test_args +1 -0
  66. data/spec/integration/invalid_header_example/input.csv +6 -0
  67. data/spec/integration/invalid_header_example/output.ledger +8 -0
  68. data/spec/integration/invalid_header_example/test_args +1 -0
  69. data/spec/integration/inversed_credit_card/input.csv +16 -0
  70. data/spec/integration/inversed_credit_card/output.ledger +64 -0
  71. data/spec/integration/inversed_credit_card/test_args +1 -0
  72. data/spec/integration/nationwide/input.csv +4 -0
  73. data/spec/integration/nationwide/output.ledger +16 -0
  74. data/spec/integration/nationwide/test_args +1 -0
  75. data/spec/integration/regression/issue_51_account_tokens/input.csv +8 -0
  76. data/spec/integration/regression/issue_51_account_tokens/output.ledger +32 -0
  77. data/spec/integration/regression/issue_51_account_tokens/test_args +4 -0
  78. data/spec/integration/regression/issue_51_account_tokens/tokens.yml +9 -0
  79. data/spec/integration/regression/issue_64_date_column/input.csv +3 -0
  80. data/spec/integration/regression/issue_64_date_column/output.ledger +8 -0
  81. data/spec/integration/regression/issue_64_date_column/test_args +1 -0
  82. data/spec/integration/regression/issue_73_account_token_matching/input.csv +2 -0
  83. data/spec/integration/regression/issue_73_account_token_matching/output.ledger +4 -0
  84. data/spec/integration/regression/issue_73_account_token_matching/test_args +6 -0
  85. data/spec/integration/regression/issue_73_account_token_matching/tokens.yml +8 -0
  86. data/spec/integration/regression/issue_85_date_example/input.csv +2 -0
  87. data/spec/integration/regression/issue_85_date_example/output.ledger +8 -0
  88. data/spec/integration/regression/issue_85_date_example/test_args +1 -0
  89. data/spec/integration/spanish_date_example/input.csv +3 -0
  90. data/spec/integration/spanish_date_example/output.ledger +12 -0
  91. data/spec/integration/spanish_date_example/test_args +1 -0
  92. data/spec/integration/suntrust/input.csv +7 -0
  93. data/spec/integration/suntrust/output.ledger +28 -0
  94. data/spec/integration/suntrust/test_args +1 -0
  95. data/spec/integration/test.sh +83 -0
  96. data/spec/integration/test_money_column/input.csv +3 -0
  97. data/spec/integration/test_money_column/output.ledger +8 -0
  98. data/spec/integration/test_money_column/test_args +1 -0
  99. data/spec/integration/two_money_columns/input.csv +5 -0
  100. data/spec/integration/two_money_columns/output.ledger +20 -0
  101. data/spec/integration/two_money_columns/test_args +1 -0
  102. data/spec/integration/yyyymmdd_date_example/input.csv +1 -0
  103. data/spec/integration/yyyymmdd_date_example/output.ledger +4 -0
  104. data/spec/integration/yyyymmdd_date_example/test_args +1 -0
  105. data/spec/reckon/app_spec.rb +25 -7
  106. data/spec/reckon/ledger_parser_spec.rb +2 -2
  107. data/spec/reckon/money_column_spec.rb +24 -24
  108. data/spec/reckon/money_spec.rb +13 -32
  109. data/spec/reckon/options_spec.rb +17 -0
  110. data/spec/spec_helper.rb +6 -1
  111. metadata +97 -35
  112. data/.travis.yml +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52cfe9cf67708213b2650008196a5177e9732285e320e7024d92cab9155aab5b
4
- data.tar.gz: 82197ab9f98b310892471cc1cbe5b7d924b8fa57ca2b2cf3b4dbd2abc428f654
3
+ metadata.gz: 13ec00f6b1277d98d6df6264af61020310ab5bf61197412a116a2f61901e6214
4
+ data.tar.gz: cf1b1e21a64fac57a5796b64f53da971a48c4bb3f439be94fd847441c5b36a0f
5
5
  SHA512:
6
- metadata.gz: 5601c43ce038078a9ce825a05b7cd09f57953632e7abc9882f7025806a7c5a6d89f350c41b0b4964e9a3302090e07839064597f343c348e00ad514e8796852bd
7
- data.tar.gz: 3de71c2b8ab50d203ceb9fe888d13c7bf68785f428322a7a865a21315aa781a809639d95cab5c0eeb96c678e871f83505b61bf0860b08ff0387d772e836a8488
6
+ metadata.gz: 450fb569cf8509563edd5fb36239965b9cd29b28d544399bcc10cf510a146d68fb56c3dd1737a1904cd7f23ab3453128d522fb07159068bbc6ed2d44cb0fe1d6
7
+ data.tar.gz: 461bade5035f16c278131102df52b91e39a365b18c3e73875730616b5489f07f7c0528094da13a06558791b4238d1d6cc495452b14c917b15eef5eea2719e909
@@ -0,0 +1,50 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Build Status
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version:
23
+ # Current ruby stable version
24
+ - 3.0
25
+ # Ubuntu 20.10
26
+ - 2.7
27
+ # Ubuntu 19.10
28
+ - 2.5
29
+ # Mac v11 Big Sur
30
+ # - 2.6?
31
+ # Mac v10.15 Catalina
32
+ - 2.6
33
+ # Mac v10.14 Mojave
34
+ - 2.3.7
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+ - name: Install packages
38
+ run: sudo apt-get -y install ledger hledger
39
+ - name: Install bundler
40
+ run: sudo gem install -v 1.17.3 bundler
41
+ - name: Set up Ruby
42
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
43
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
44
+ uses: ruby/setup-ruby@v1
45
+ # uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
46
+ with:
47
+ ruby-version: ${{ matrix.ruby-version }}
48
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
49
+ - name: Run tests
50
+ run: bundle exec rake test_all
data/.gitignore CHANGED
@@ -28,3 +28,6 @@ private_tests
28
28
 
29
29
  ## Bundler
30
30
  vendor
31
+
32
+ test.log
33
+ test_log.txt
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7
1
+ 3.0.0
data/CHANGELOG.md CHANGED
@@ -1,8 +1,77 @@
1
1
  # Changelog
2
2
 
3
- ## [0.5.4](https://github.com/cantino/reckon/tree/0.5.4) (2020-06-04)
3
+ ## [v0.7.1](https://github.com/cantino/reckon/tree/v0.7.1) (2021-02-06)
4
4
 
5
- [Full Changelog](https://github.com/cantino/reckon/compare/v0.5.3...0.5.4)
5
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.7.0...v0.7.1)
6
+
7
+ **Closed issues:**
8
+
9
+ - bug when asking for account name [\#103](https://github.com/cantino/reckon/issues/103)
10
+
11
+ ## [v0.7.0](https://github.com/cantino/reckon/tree/v0.7.0) (2021-02-06)
12
+
13
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.6.2...v0.7.0)
14
+
15
+ **Closed issues:**
16
+
17
+ - fail on unknown accounts [\#96](https://github.com/cantino/reckon/issues/96)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Fail on unknown account [\#102](https://github.com/cantino/reckon/pull/102) ([benprew](https://github.com/benprew))
22
+ - Joined split sentence to one [\#101](https://github.com/cantino/reckon/pull/101) ([RidaAyed](https://github.com/RidaAyed))
23
+
24
+ ## [v0.6.2](https://github.com/cantino/reckon/tree/v0.6.2) (2021-01-25)
25
+
26
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.6.1...v0.6.2)
27
+
28
+ **Closed issues:**
29
+
30
+ - spaces in tokens [\#97](https://github.com/cantino/reckon/issues/97)
31
+ - read from stdin [\#95](https://github.com/cantino/reckon/issues/95)
32
+
33
+ **Merged pull requests:**
34
+
35
+ - Allow using '-' as filename in -f to read csv from STDIN. Fixes \#95 [\#98](https://github.com/cantino/reckon/pull/98) ([benprew](https://github.com/benprew))
36
+
37
+ ## [v0.6.1](https://github.com/cantino/reckon/tree/v0.6.1) (2021-01-23)
38
+
39
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.6.0...v0.6.1)
40
+
41
+ **Implemented enhancements:**
42
+
43
+ - \[Feature Request\] Note flag --add-notes in CLI to allow additional notes for each ledger entry [\#86](https://github.com/cantino/reckon/issues/86)
44
+
45
+ **Closed issues:**
46
+
47
+ - Migrate CI system from travis-ci.org [\#93](https://github.com/cantino/reckon/issues/93)
48
+ - \[Feature Request\] Pipe ledger file input to the bayesian predictor \(instead of csv\) [\#91](https://github.com/cantino/reckon/issues/91)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Add github actions [\#100](https://github.com/cantino/reckon/pull/100) ([benprew](https://github.com/benprew))
53
+ - Add documentation for doing a substring match. Fixes \#97 [\#99](https://github.com/cantino/reckon/pull/99) ([benprew](https://github.com/benprew))
54
+ - Test fixes [\#94](https://github.com/cantino/reckon/pull/94) ([benprew](https://github.com/benprew))
55
+
56
+ ## [v0.6.0](https://github.com/cantino/reckon/tree/v0.6.0) (2020-09-04)
57
+
58
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.5.4...v0.6.0)
59
+
60
+ **Fixed bugs:**
61
+
62
+ - \[BUG\] Reckon appears not to be parsing ISO standard date yyyy-mm-dd? [\#85](https://github.com/cantino/reckon/issues/85)
63
+
64
+ **Closed issues:**
65
+
66
+ - duplicate detection [\#16](https://github.com/cantino/reckon/issues/16)
67
+
68
+ **Merged pull requests:**
69
+
70
+ - Add ability to add note to transaction when entering it [\#89](https://github.com/cantino/reckon/pull/89) ([benprew](https://github.com/benprew))
71
+
72
+ ## [v0.5.4](https://github.com/cantino/reckon/tree/v0.5.4) (2020-06-05)
73
+
74
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.5.3...v0.5.4)
6
75
 
7
76
  **Fixed bugs:**
8
77
 
@@ -36,7 +105,7 @@
36
105
 
37
106
  **Merged pull requests:**
38
107
 
39
- - Fix bugs in ledger file parsing. Fixes \#56. [\#81](https://github.com/cantino/reckon/pull/81) ([benprew](https://github.com/benprew))
108
+ - guard against rows that don't parse dates [\#82](https://github.com/cantino/reckon/pull/82) ([benprew](https://github.com/benprew))
40
109
 
41
110
  ## [v0.5.0](https://github.com/cantino/reckon/tree/v0.5.0) (2020-02-19)
42
111
 
@@ -63,7 +132,7 @@
63
132
 
64
133
  **Merged pull requests:**
65
134
 
66
- - guard against rows that don't parse dates [\#82](https://github.com/cantino/reckon/pull/82) ([benprew](https://github.com/benprew))
135
+ - Fix bugs in ledger file parsing. Fixes \#56. [\#81](https://github.com/cantino/reckon/pull/81) ([benprew](https://github.com/benprew))
67
136
  - Better file encoding suggestions [\#80](https://github.com/cantino/reckon/pull/80) ([benprew](https://github.com/benprew))
68
137
  - :bug: fix matching algorithm, add logging and a spec helper. Fixes \#73 [\#79](https://github.com/cantino/reckon/pull/79) ([benprew](https://github.com/benprew))
69
138
  - bug: invalid header lines should be ignored, not parsed. [\#78](https://github.com/cantino/reckon/pull/78) ([benprew](https://github.com/benprew))
data/Gemfile.lock CHANGED
@@ -1,58 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.5.4)
4
+ reckon (0.7.1)
5
5
  chronic (>= 0.3.0)
6
6
  highline (>= 1.5.2)
7
7
  rchardet (>= 1.8.0)
8
- terminal-table (>= 1.4.2)
9
8
 
10
9
  GEM
11
10
  remote: http://rubygems.org/
12
11
  specs:
13
- activesupport (6.0.3.1)
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 0.7, < 2)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
18
- zeitwerk (~> 2.2, >= 2.2.2)
19
- addressable (2.7.0)
20
- public_suffix (>= 2.0.2, < 5.0)
21
12
  chronic (0.10.2)
22
13
  coderay (1.1.2)
23
- concurrent-ruby (1.1.6)
24
14
  diff-lcs (1.3)
25
- faraday (1.0.1)
26
- multipart-post (>= 1.2, < 3)
27
- faraday-http-cache (2.2.0)
28
- faraday (>= 0.8)
29
- github_changelog_generator (1.15.2)
30
- activesupport
31
- faraday-http-cache
32
- multi_json
33
- octokit (~> 4.6)
34
- rainbow (>= 2.2.1)
35
- rake (>= 10.0)
36
- retriable (~> 3.0)
37
15
  highline (2.0.3)
38
- i18n (1.8.2)
39
- concurrent-ruby (~> 1.0)
40
16
  method_source (0.9.2)
41
- minitest (5.14.1)
42
- multi_json (1.14.1)
43
- multipart-post (2.1.1)
44
- octokit (4.18.0)
45
- faraday (>= 0.9)
46
- sawyer (~> 0.8.0, >= 0.5.3)
47
17
  pry (0.12.2)
48
18
  coderay (~> 1.1.0)
49
19
  method_source (~> 0.9.0)
50
- public_suffix (4.0.5)
51
- rainbow (3.0.0)
52
20
  rake (12.3.3)
53
21
  rantly (1.2.0)
54
22
  rchardet (1.8.0)
55
- retriable (3.1.2)
56
23
  rspec (3.9.0)
57
24
  rspec-core (~> 3.9.0)
58
25
  rspec-expectations (~> 3.9.0)
@@ -66,22 +33,11 @@ GEM
66
33
  diff-lcs (>= 1.2.0, < 2.0)
67
34
  rspec-support (~> 3.9.0)
68
35
  rspec-support (3.9.2)
69
- sawyer (0.8.2)
70
- addressable (>= 2.3.5)
71
- faraday (> 0.8, < 2.0)
72
- terminal-table (1.8.0)
73
- unicode-display_width (~> 1.1, >= 1.1.1)
74
- thread_safe (0.3.6)
75
- tzinfo (1.2.7)
76
- thread_safe (~> 0.1)
77
- unicode-display_width (1.7.0)
78
- zeitwerk (2.3.0)
79
36
 
80
37
  PLATFORMS
81
38
  ruby
82
39
 
83
40
  DEPENDENCIES
84
- github_changelog_generator
85
41
  pry (>= 0.12.2)
86
42
  rake
87
43
  rantly (= 1.2.0)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Reckon
2
2
 
3
- [![Build Status](https://travis-ci.org/cantino/reckon.png?branch=master)](https://travis-ci.org/cantino/reckon)
3
+ ![Build Status](https://github.com/cantino/reckon/workflows/Build%20Status/badge.svg)
4
4
 
5
5
  Reckon automagically converts CSV files for use with the command-line accounting tool [Ledger](http://www.ledger-cli.org/). It also helps you to select the correct accounts associated with the CSV data using Bayesian machine learning.
6
6
 
@@ -34,35 +34,42 @@ Learn more:
34
34
 
35
35
  Usage: Reckon.rb [options]
36
36
 
37
-
38
37
  -f, --file FILE The CSV file to parse
39
- -a, --account name The Ledger Account this file is for
38
+ -a, --account NAME The Ledger Account this file is for
40
39
  -v, --[no-]verbose Run verbosely
41
40
  -i, --inverse Use the negative of each amount
42
41
  -p, --print-table Print out the parsed CSV in table form
43
42
  -o, --output-file FILE The ledger file to append to
44
43
  -l, --learn-from FILE An existing ledger file to learn accounts from
45
44
  --ignore-columns 1,2,5
46
- Columns to ignore in the CSV file - the first column is column 1
45
+ Columns to ignore, starts from 1
46
+ --money-column 2
47
+ Column number of the money column, starts from 1
48
+ --raw-money
49
+ Don't format money column (for stocks)
50
+ --date-column 3
51
+ Column number of the date column, starts from 1
47
52
  --contains-header [N]
48
- The first row of the CSV is a header and should be skipped. Optionally add the number of rows to skip.
53
+ Skip N header rows - default 1
49
54
  --csv-separator ','
50
- Separator for parsing the CSV - default is comma.
55
+ CSV separator (default ',')
51
56
  --comma-separates-cents
52
- Use comma instead of period to deliminate dollars from cents when parsing ($100,50 instead of $100.50)
57
+ Use comma to separate cents ($100,50 vs. $100.50)
53
58
  --encoding 'UTF-8'
54
- Specify an encoding for the CSV file; not usually needed
55
- -c, --currency '$' Currency symbol to use, defaults to $ (£, EUR)
59
+ Specify an encoding for the CSV file
60
+ -c, --currency '$' Currency symbol to use - default $ (ex £, EUR)
56
61
  --date-format '%d/%m/%Y'
57
62
  Force the date format (see Ruby DateTime strftime)
58
- -u, --unattended Don't ask questions and guess all the accounts automatically. Used with --learn-from or --account-tokens options.
63
+ -u, --unattended Don't ask questions and guess all the accounts automatically. Use with --learn-from or --account-tokens options.
59
64
  -t, --account-tokens FILE YAML file with manually-assigned tokens for each account (see README)
60
- --default-into-account name
65
+ --default-into-account NAME
61
66
  Default into account
62
- --default-outof-account name
67
+ --default-outof-account NAME
63
68
  Default 'out of' account
69
+ --fail-on-unknown-account
70
+ Fail on unmatched transactions.
64
71
  --suffixed
65
- If --currency should be used as a suffix. Defaults to false.
72
+ Append currency symbol as a suffix.
66
73
  -h, --help Show this message
67
74
  --version Show version
68
75
 
@@ -77,6 +84,20 @@ To guess the accounts reckon can use an existing ledger file or a token file wit
77
84
 
78
85
  `reckon --unattended --account-tokens tokens.yaml -f bank.csv -o ledger.dat`
79
86
 
87
+ In unattended mode, you can use STDIN to read your csv data, by specifying `-` as the argument to `-f`.
88
+
89
+ `csv_file_generator | reckon --unattended -l 2010.dat -o ledger.dat -f -`
90
+
91
+ ### Account Tokens
92
+
93
+ The account tokens file provides a way to teach reckon about what tokens are associated with an account. As an example, this `tokens.yaml` file:
94
+
95
+ Expenses:
96
+ Bank:
97
+ - 'ING Direct Deposit'
98
+
99
+ Would tokenize to 'ING', 'Direct' and 'Deposit'. The matcher would then suggest matches to transactions that included those tokens. (ex 'Chase Direct Deposit')
100
+
80
101
  Here's an example of `tokens.yaml`:
81
102
 
82
103
  ```
@@ -96,31 +117,61 @@ Expenses:
96
117
  - '4433221100' # Your own account number
97
118
  ```
98
119
 
99
- If reckon can not guess the accounts it will use `Income:Unknown` or `Expenses:Unknown` names.
100
- You can override them with `--default_outof_account` and `--default_into_account` options.
120
+ Reckon will use `Income:Unknown` or `Expenses:Unknown` if it can't match a transaction to an account.
121
+
122
+ You can override these names with the `--default_outof_account` and `--default_into_account` options.
123
+
124
+ ### Substring Match
125
+
126
+ If, in the above example, you'd prefer to match any transaction that contains the string 'ING Direct Deposit' you have to use a regex:
127
+
128
+ Expenses:
129
+ Bank:
130
+ - /ING Direct Deposit/
131
+
132
+ ## Contributing
133
+
134
+ We encourage you to contribute to Reckon! Here is some information to help you.
135
+
136
+ ### Patches/Pull Requests Process
137
+
138
+ 1. Fork the project.
139
+ 2. Make your feature addition or bug fix.
140
+ 3. Add tests for it. This is important so I don't break it in a future version unintentionally.
141
+ 4. Commit, do not mess with rakefile, version, or history.
142
+ - (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
143
+ 5. Send me a pull request. Bonus points for topic branches.
144
+
145
+ ### Integration Tests
146
+
147
+ Reckon has integration test located in `spec/integration`. These are integration and regression tests for reckon.
148
+
149
+ Run all the tests:
150
+
151
+ ./spec/integration/test.sh
152
+
153
+ Run a single test
154
+
155
+ ./spec/integration/test.sh chase/account_tokens_and_regex
156
+
157
+ #### Add a new integration test
158
+
159
+ Each test has it's own directory, which you can add any files you want, but the following files are required:
160
+
161
+ - `test_args` - arguments to add to the reckon command to test against, can specify `--unattended`, `-f input.csv`, etc
162
+ - `output.ledger` - the expected ledger file output
163
+
164
+ If the result of running reckon with `test_args` does not match `output.ledger`, then the test fails.
165
+
166
+ Most tests will specify `--unattended`, otherwise reckon prompts for keyboard input.
101
167
 
102
- ## Note on Patches/Pull Requests
168
+ The convention is to use `input.csv` as the input file, and `tokens.yml` as the tokens file, but it is not required.
103
169
 
104
- * Fork the project.
105
- * Make your feature addition or bug fix.
106
- * Add tests for it. This is important so I don't break it in a
107
- future version unintentionally.
108
- * Commit, do not mess with rakefile, version, or history.
109
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
110
- * Send me a pull request. Bonus points for topic branches.
111
170
 
112
171
  ## Copyright
113
172
 
114
- Copyright (c) 2013 Andrew Cantino. See LICENSE for details.
173
+ Copyright (c) 2013 Andrew Cantino (@cantino). See LICENSE for details.
115
174
 
116
175
  Thanks to @BlackEdder for many contributions!
117
176
 
118
- ## Building a new version of reckon
119
- 1. Update reckon/version.rb
120
- 2. Run `bundle install` to build updated Gemfile.lock
121
- 3. Run `bundle exec github_changelog_generator -u cantino -p reckon -t $TOKEN --future-release $VERSION`
122
- 3. Commit changes with: 'Release $VERSION'
123
- 4. Tag release `git tag v$VERSION`
124
- 5. `git push && git push --tags`
125
- 6. Build new gem `gem build reckon.gemspec`
126
- 7. Push new gem `gem push <gemname>`
177
+ Currently maintained by @benprew. Thank you!
data/Rakefile CHANGED
@@ -1,6 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require 'rspec/core/rake_task'
5
+ require 'English'
3
6
 
4
7
  RSpec::Core::RakeTask.new(:spec)
5
8
 
6
- task :default => :spec
9
+ task default: :spec
10
+
11
+ task :test_all do
12
+ puts "#{`ledger --version |head -n1`}"
13
+ puts "Running unit tests"
14
+ Rake::Task["spec"].invoke
15
+ puts "Running integration tests"
16
+ Rake::Task["integration_tests"].invoke
17
+ end
18
+
19
+ task :integration_tests do
20
+ puts `./spec/integration/test.sh`
21
+ raise 'Integration tests failed' if $CHILD_STATUS.exitstatus != 0
22
+ end
@@ -0,0 +1,26 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ VERSION=$1
6
+
7
+ echo "Install github_changelog_generator"
8
+ gem install --user github_changelog_generator
9
+
10
+ echo "Update 'lib/reckon/version.rb'"
11
+ echo -e "module Reckon\n VERSION=\"$VERSION\"\nend" > lib/reckon/version.rb
12
+ echo "Run `bundle install` to build updated Gemfile.lock"
13
+ bundle install
14
+ echo "Run changelog generator (requires $TOKEN to be your github token)"
15
+ github_changelog_generator -u cantino -p reckon -t $TOKEN --future-release v$VERSION
16
+ echo "Commit changes"
17
+ git add CHANGELOG.md lib/reckon/version.rb Gemfile.lock
18
+ git commit -m "Release $VERSION"
19
+ echo "Tag release"
20
+ git tag v$VERSION
21
+ echo "Build new gem"
22
+ gem build reckon.gemspec
23
+ echo "Push changes and tags"
24
+ echo "git push && git push --tags"
25
+ echo "Push new gem"
26
+ echo "gem push reckon-$VERSION.gem"