reckon 0.6.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +50 -0
- data/.gitignore +3 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +75 -7
- data/Gemfile.lock +1 -1
- data/README.md +85 -24
- data/Rakefile +17 -1
- data/bin/build-new-version.sh +26 -0
- data/bin/reckon +9 -1
- data/lib/reckon.rb +1 -0
- data/lib/reckon/app.rb +18 -141
- data/lib/reckon/cosine_similarity.rb +67 -62
- data/lib/reckon/csv_parser.rb +2 -7
- data/lib/reckon/date_column.rb +10 -0
- data/lib/reckon/money.rb +59 -52
- data/lib/reckon/options.rb +153 -0
- data/lib/reckon/version.rb +1 -1
- data/spec/cosine_training_and_test.rb +52 -0
- data/spec/integration/another_bank_example/input.csv +9 -0
- data/spec/integration/another_bank_example/output.ledger +36 -0
- data/spec/integration/another_bank_example/test_args +1 -0
- data/spec/integration/ask_for_account/cli_input.exp +33 -0
- data/spec/integration/ask_for_account/expected_output +11 -0
- data/spec/integration/ask_for_account/input.csv +9 -0
- data/spec/integration/ask_for_account/test_args +1 -0
- data/spec/integration/austrian_example/input.csv +13 -0
- data/spec/integration/austrian_example/output.ledger +52 -0
- data/spec/integration/austrian_example/test_args +2 -0
- data/spec/integration/bom_utf8_file/input.csv +3 -0
- data/spec/integration/bom_utf8_file/output.ledger +4 -0
- data/spec/integration/bom_utf8_file/test_args +3 -0
- data/spec/integration/broker_canada_example/input.csv +12 -0
- data/spec/integration/broker_canada_example/output.ledger +48 -0
- data/spec/integration/broker_canada_example/test_args +1 -0
- data/spec/integration/chase/account_tokens_and_regex/output.ledger +36 -0
- data/spec/integration/chase/account_tokens_and_regex/test_args +2 -0
- data/spec/integration/chase/account_tokens_and_regex/tokens.yml +16 -0
- data/spec/integration/chase/default_account_names/output.ledger +36 -0
- data/spec/integration/chase/default_account_names/test_args +3 -0
- data/spec/integration/chase/input.csv +9 -0
- data/spec/integration/chase/learn_from_existing/learn.ledger +7 -0
- data/spec/integration/chase/learn_from_existing/output.ledger +36 -0
- data/spec/integration/chase/learn_from_existing/test_args +1 -0
- data/spec/integration/chase/simple/output.ledger +36 -0
- data/spec/integration/chase/simple/test_args +1 -0
- data/spec/integration/danish_kroner_nordea_example/input.csv +6 -0
- data/spec/integration/danish_kroner_nordea_example/output.ledger +24 -0
- data/spec/integration/danish_kroner_nordea_example/test_args +1 -0
- data/spec/integration/english_date_example/input.csv +3 -0
- data/spec/integration/english_date_example/output.ledger +12 -0
- data/spec/integration/english_date_example/test_args +1 -0
- data/spec/integration/extratofake/input.csv +24 -0
- data/spec/integration/extratofake/output.ledger +92 -0
- data/spec/integration/extratofake/test_args +1 -0
- data/spec/integration/french_example/input.csv +9 -0
- data/spec/integration/french_example/output.ledger +36 -0
- data/spec/integration/french_example/test_args +2 -0
- data/spec/integration/german_date_example/input.csv +3 -0
- data/spec/integration/german_date_example/output.ledger +12 -0
- data/spec/integration/german_date_example/test_args +1 -0
- data/spec/integration/harder_date_example/input.csv +5 -0
- data/spec/integration/harder_date_example/output.ledger +20 -0
- data/spec/integration/harder_date_example/test_args +1 -0
- data/spec/integration/ing/input.csv +3 -0
- data/spec/integration/ing/output.ledger +12 -0
- data/spec/integration/ing/test_args +1 -0
- data/spec/integration/intuit_mint_example/input.csv +7 -0
- data/spec/integration/intuit_mint_example/output.ledger +28 -0
- data/spec/integration/intuit_mint_example/test_args +1 -0
- data/spec/integration/invalid_header_example/input.csv +6 -0
- data/spec/integration/invalid_header_example/output.ledger +8 -0
- data/spec/integration/invalid_header_example/test_args +1 -0
- data/spec/integration/inversed_credit_card/input.csv +16 -0
- data/spec/integration/inversed_credit_card/output.ledger +64 -0
- data/spec/integration/inversed_credit_card/test_args +1 -0
- data/spec/integration/nationwide/input.csv +4 -0
- data/spec/integration/nationwide/output.ledger +16 -0
- data/spec/integration/nationwide/test_args +1 -0
- data/spec/integration/regression/issue_51_account_tokens/input.csv +8 -0
- data/spec/integration/regression/issue_51_account_tokens/output.ledger +32 -0
- data/spec/integration/regression/issue_51_account_tokens/test_args +4 -0
- data/spec/integration/regression/issue_51_account_tokens/tokens.yml +9 -0
- data/spec/integration/regression/issue_64_date_column/input.csv +3 -0
- data/spec/integration/regression/issue_64_date_column/output.ledger +8 -0
- data/spec/integration/regression/issue_64_date_column/test_args +1 -0
- data/spec/integration/regression/issue_73_account_token_matching/input.csv +2 -0
- data/spec/integration/regression/issue_73_account_token_matching/output.ledger +4 -0
- data/spec/integration/regression/issue_73_account_token_matching/test_args +6 -0
- data/spec/integration/regression/issue_73_account_token_matching/tokens.yml +8 -0
- data/spec/integration/regression/issue_85_date_example/input.csv +2 -0
- data/spec/integration/regression/issue_85_date_example/output.ledger +8 -0
- data/spec/integration/regression/issue_85_date_example/test_args +1 -0
- data/spec/integration/spanish_date_example/input.csv +3 -0
- data/spec/integration/spanish_date_example/output.ledger +12 -0
- data/spec/integration/spanish_date_example/test_args +1 -0
- data/spec/integration/suntrust/input.csv +7 -0
- data/spec/integration/suntrust/output.ledger +28 -0
- data/spec/integration/suntrust/test_args +1 -0
- data/spec/integration/test.sh +123 -0
- data/spec/integration/test_money_column/input.csv +3 -0
- data/spec/integration/test_money_column/output.ledger +8 -0
- data/spec/integration/test_money_column/test_args +1 -0
- data/spec/integration/two_money_columns/input.csv +5 -0
- data/spec/integration/two_money_columns/output.ledger +20 -0
- data/spec/integration/two_money_columns/test_args +1 -0
- data/spec/integration/yyyymmdd_date_example/input.csv +1 -0
- data/spec/integration/yyyymmdd_date_example/output.ledger +4 -0
- data/spec/integration/yyyymmdd_date_example/test_args +1 -0
- data/spec/reckon/app_spec.rb +24 -6
- data/spec/reckon/csv_parser_spec.rb +3 -3
- data/spec/reckon/money_column_spec.rb +24 -24
- data/spec/reckon/money_spec.rb +15 -34
- data/spec/reckon/options_spec.rb +17 -0
- data/spec/spec_helper.rb +6 -1
- metadata +102 -7
- data/.travis.yml +0 -13
@@ -0,0 +1,12 @@
|
|
1
|
+
2009-12-24 BLARG R SH 456930; $1,826.06
|
2
|
+
Assets:Bank:Checking $327.49
|
3
|
+
Income:Unknown
|
4
|
+
|
5
|
+
2009-12-24 Check - 0000000122; 122; $1,750.06
|
6
|
+
Income:Unknown
|
7
|
+
Assets:Bank:Checking -$76.00
|
8
|
+
|
9
|
+
2009-12-24 Check - 0000000112; 112; $1,498.57
|
10
|
+
Income:Unknown
|
11
|
+
Assets:Bank:Checking -$800.00
|
12
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1,5 @@
|
|
1
|
+
10-Nov-9,-123.12,,,TRANSFER DEBIT INTERNET TRANSFER,INTERNET TRANSFER MORTGAGE,0.00,
|
2
|
+
09-Nov-10,123.12,,,SALARY SALARY,NGHSKS46383BGDJKD FOO BAR,432.12,
|
3
|
+
04-Nov-11,-1234.00,,,TRANSFER DEBIT INTERNET TRANSFER,INTERNET TRANSFER SAV TO MECU,0.00,
|
4
|
+
04-Nov-9,1234.00,,,TRANSFER CREDIT INTERNET TRANSFER,INTERNET TRANSFER,1234.00,
|
5
|
+
28-Oct-10,-123.12,,,TRANSFER DEBIT INTERNET TRANSFER,INTERNET TRANSFER SAV TO MORTGAGE,0.00,
|
@@ -0,0 +1,20 @@
|
|
1
|
+
2009-11-04 TRANSFER CREDIT INTERNET TRANSFER; INTERNET TRANSFER; 1234.00
|
2
|
+
Assets:Bank:Checking $1,234.00
|
3
|
+
Income:Unknown
|
4
|
+
|
5
|
+
2009-11-10 TRANSFER DEBIT INTERNET TRANSFER; INTERNET TRANSFER MORTGAGE; 0.00
|
6
|
+
Income:Unknown
|
7
|
+
Assets:Bank:Checking -$123.12
|
8
|
+
|
9
|
+
2010-10-28 TRANSFER DEBIT INTERNET TRANSFER; INTERNET TRANSFER SAV TO MORTGAGE; 0.00
|
10
|
+
Income:Unknown
|
11
|
+
Assets:Bank:Checking -$123.12
|
12
|
+
|
13
|
+
2010-11-09 SALARY SALARY; NGHSKS46383BGDJKD FOO BAR; 432.12
|
14
|
+
Assets:Bank:Checking $123.12
|
15
|
+
Income:Unknown
|
16
|
+
|
17
|
+
2011-11-04 TRANSFER DEBIT INTERNET TRANSFER; INTERNET TRANSFER SAV TO MECU; 0.00
|
18
|
+
Income:Unknown
|
19
|
+
Assets:Bank:Checking -$1,234.00
|
20
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1,12 @@
|
|
1
|
+
2009-11-17 Names; NL28 INGB 1200 3244 16; 21817; GT; Af; Opm3
|
2
|
+
Expenses:Unknown
|
3
|
+
Assets:Bank:Checking -$257.50
|
4
|
+
|
5
|
+
2012-11-12 Names; NL28 INGB 1200 3244 16; 21817; GT; Bij; Opm2
|
6
|
+
Assets:Bank:Checking $375.00
|
7
|
+
Expenses:Unknown
|
8
|
+
|
9
|
+
2012-11-15 From1; Acc; T1; IC; Af; Incasso; SEPA Incasso; Opm1
|
10
|
+
Expenses:Unknown
|
11
|
+
Assets:Bank:Checking -$136.13
|
12
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking --comma-separates-cents
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"12/10/2014","Dn Ing Inv","[DN]ING INV/PLA","0.01","credit","Investments","Chequing","",""
|
2
|
+
"2/03/2014","Ds Lms Msp Condo","[DS]LMS598 MSP/DIV","331.63","debit","Condo Fees","Chequing","",""
|
3
|
+
"2/10/2014","Ib Granville","[IB] 2601 GRANVILLE","100.00","debit","Uncategorized","Chequing","",""
|
4
|
+
"2/06/2014","So Pa","[SO]PA 0005191230116379851","140.72","debit","Mortgage & Rent","Chequing","",""
|
5
|
+
"2/03/2014","Dn Sun Life","[DN]SUN LIFE MSP/DIV","943.34","credit","Income","Chequing","",""
|
6
|
+
"1/30/2014","Transfer to CBT (Savings)","[CW] TF 0004#3409-797","500.00","debit","Transfer","Chequing","",""
|
7
|
+
"1/30/2014","Costco","[PR]COSTCO WHOLESAL","559.96","debit","Business Services","Chequing","",""
|
@@ -0,0 +1,28 @@
|
|
1
|
+
2014-01-30 Transfer to CBT (Savings); [CW] TF 0004#3409-797; debit; Transfer; Chequing
|
2
|
+
Expenses:Unknown
|
3
|
+
Assets:Bank:Checking -$500.00
|
4
|
+
|
5
|
+
2014-01-30 Costco; [PR]COSTCO WHOLESAL; debit; Business Services; Chequing
|
6
|
+
Expenses:Unknown
|
7
|
+
Assets:Bank:Checking -$559.96
|
8
|
+
|
9
|
+
2014-02-03 Dn Sun Life; [DN]SUN LIFE MSP/DIV; credit; Income; Chequing
|
10
|
+
Assets:Bank:Checking $943.34
|
11
|
+
Expenses:Unknown
|
12
|
+
|
13
|
+
2014-02-03 Ds Lms Msp Condo; [DS]LMS598 MSP/DIV; debit; Condo Fees; Chequing
|
14
|
+
Expenses:Unknown
|
15
|
+
Assets:Bank:Checking -$331.63
|
16
|
+
|
17
|
+
2014-02-06 So Pa; [SO]PA 0005191230116379851; debit; Mortgage & Rent; Chequing
|
18
|
+
Expenses:Unknown
|
19
|
+
Assets:Bank:Checking -$140.72
|
20
|
+
|
21
|
+
2014-02-10 Ib Granville; [IB] 2601 GRANVILLE; debit; Uncategorized; Chequing
|
22
|
+
Expenses:Unknown
|
23
|
+
Assets:Bank:Checking -$100.00
|
24
|
+
|
25
|
+
2014-12-10 Dn Ing Inv; [DN]ING INV/PLA; credit; Investments; Chequing
|
26
|
+
Assets:Bank:Checking $0.01
|
27
|
+
Expenses:Unknown
|
28
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1,6 @@
|
|
1
|
+
-
|
2
|
+
="0234500012345678";21/11/2015;19/02/2016;36;19/02/2016;1234,37 EUR
|
3
|
+
|
4
|
+
Date de l'opération;Libellé;Détail de l'écriture;Montant de l'opération;Devise
|
5
|
+
19/02/2016;VIR RECU 508160;VIR RECU 1234567834S DE: Francois REF: 123457891234567894561231 PROVENANCE: DE Allemagne ;50,00;EUR
|
6
|
+
18/02/2016;COTISATION JAZZ;COTISATION JAZZ ;-8,10;EUR
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking --contains-header 4
|
@@ -0,0 +1,16 @@
|
|
1
|
+
2013/01/17,2013/01/16,2013011702,DEBIT,2226,"VODAFONE PREPAY VISA M AUCKLAND NZL",30.00
|
2
|
+
2013/01/18,2013/01/17,2013011801,DEBIT,2226,"WILSON PARKING AUCKLAND NZL",4.60
|
3
|
+
2013/01/18,2013/01/17,2013011802,DEBIT,2226,"AUCKLAND TRANSPORT HENDERSON NZL",2.00
|
4
|
+
2013/01/19,2013/01/19,2013011901,CREDIT,2226,"INTERNET PAYMENT RECEIVED ",-500.00
|
5
|
+
2013/01/26,2013/01/23,2013012601,DEBIT,2226,"ITUNES NZ CORK IRL",64.99
|
6
|
+
2013/01/26,2013/01/25,2013012602,DEBIT,2226,"VODAFONE FXFLNE BBND R NEWTON NZL",90.26
|
7
|
+
2013/01/29,2013/01/29,2013012901,CREDIT,2101,"PAYMENT RECEIVED THANK YOU ",-27.75
|
8
|
+
2013/01/30,2013/01/29,2013013001,DEBIT,2226,"AUCKLAND TRANSPORT HENDERSON NZL",3.50
|
9
|
+
2013/02/05,2013/02/03,2013020501,DEBIT,2226,"Z BEACH RD AUCKLAND NZL",129.89
|
10
|
+
2013/02/05,2013/02/03,2013020502,DEBIT,2226,"TOURNAMENT KHYBER PASS AUCKLAND NZL",8.00
|
11
|
+
2013/02/05,2013/02/04,2013020503,DEBIT,2226,"VODAFONE PREPAY VISA M AUCKLAND NZL",30.00
|
12
|
+
2013/02/08,2013/02/07,2013020801,DEBIT,2226,"AKLD TRANSPORT PARKING AUCKLAND NZL",2.50
|
13
|
+
2013/02/08,2013/02/07,2013020802,DEBIT,2226,"AUCKLAND TRANSPORT HENDERSON NZL",3.50
|
14
|
+
2013/02/12,2013/02/11,2013021201,DEBIT,2226,"AKLD TRANSPORT PARKING AUCKLAND NZL",1.50
|
15
|
+
2013/02/17,2013/02/17,2013021701,CREDIT,2226,"INTERNET PAYMENT RECEIVED ",-12.00
|
16
|
+
2013/02/17,2013/02/17,2013021702,CREDIT,2226,"INTERNET PAYMENT RECEIVED ",-18.00
|
@@ -0,0 +1,64 @@
|
|
1
|
+
2013-01-17 2013/01/16; 2013011702; DEBIT; 2226; VODAFONE PREPAY VISA M AUCKLAND NZL
|
2
|
+
Assets:Bank:Checking $30.00
|
3
|
+
Income:Unknown
|
4
|
+
|
5
|
+
2013-01-18 2013/01/17; 2013011801; DEBIT; 2226; WILSON PARKING AUCKLAND NZL
|
6
|
+
Assets:Bank:Checking $4.60
|
7
|
+
Income:Unknown
|
8
|
+
|
9
|
+
2013-01-18 2013/01/17; 2013011802; DEBIT; 2226; AUCKLAND TRANSPORT HENDERSON NZL
|
10
|
+
Assets:Bank:Checking $2.00
|
11
|
+
Income:Unknown
|
12
|
+
|
13
|
+
2013-01-19 2013/01/19; 2013011901; CREDIT; 2226; INTERNET PAYMENT RECEIVED
|
14
|
+
Income:Unknown
|
15
|
+
Assets:Bank:Checking -$500.00
|
16
|
+
|
17
|
+
2013-01-26 2013/01/25; 2013012602; DEBIT; 2226; VODAFONE FXFLNE BBND R NEWTON NZL
|
18
|
+
Assets:Bank:Checking $90.26
|
19
|
+
Income:Unknown
|
20
|
+
|
21
|
+
2013-01-26 2013/01/23; 2013012601; DEBIT; 2226; ITUNES NZ CORK IRL
|
22
|
+
Assets:Bank:Checking $64.99
|
23
|
+
Income:Unknown
|
24
|
+
|
25
|
+
2013-01-29 2013/01/29; 2013012901; CREDIT; 2101; PAYMENT RECEIVED THANK YOU
|
26
|
+
Income:Unknown
|
27
|
+
Assets:Bank:Checking -$27.75
|
28
|
+
|
29
|
+
2013-01-30 2013/01/29; 2013013001; DEBIT; 2226; AUCKLAND TRANSPORT HENDERSON NZL
|
30
|
+
Assets:Bank:Checking $3.50
|
31
|
+
Income:Unknown
|
32
|
+
|
33
|
+
2013-02-05 2013/02/03; 2013020501; DEBIT; 2226; Z BEACH RD AUCKLAND NZL
|
34
|
+
Assets:Bank:Checking $129.89
|
35
|
+
Income:Unknown
|
36
|
+
|
37
|
+
2013-02-05 2013/02/04; 2013020503; DEBIT; 2226; VODAFONE PREPAY VISA M AUCKLAND NZL
|
38
|
+
Assets:Bank:Checking $30.00
|
39
|
+
Income:Unknown
|
40
|
+
|
41
|
+
2013-02-05 2013/02/03; 2013020502; DEBIT; 2226; TOURNAMENT KHYBER PASS AUCKLAND NZL
|
42
|
+
Assets:Bank:Checking $8.00
|
43
|
+
Income:Unknown
|
44
|
+
|
45
|
+
2013-02-08 2013/02/07; 2013020802; DEBIT; 2226; AUCKLAND TRANSPORT HENDERSON NZL
|
46
|
+
Assets:Bank:Checking $3.50
|
47
|
+
Income:Unknown
|
48
|
+
|
49
|
+
2013-02-08 2013/02/07; 2013020801; DEBIT; 2226; AKLD TRANSPORT PARKING AUCKLAND NZL
|
50
|
+
Assets:Bank:Checking $2.50
|
51
|
+
Income:Unknown
|
52
|
+
|
53
|
+
2013-02-12 2013/02/11; 2013021201; DEBIT; 2226; AKLD TRANSPORT PARKING AUCKLAND NZL
|
54
|
+
Assets:Bank:Checking $1.50
|
55
|
+
Income:Unknown
|
56
|
+
|
57
|
+
2013-02-17 2013/02/17; 2013021701; CREDIT; 2226; INTERNET PAYMENT RECEIVED
|
58
|
+
Income:Unknown
|
59
|
+
Assets:Bank:Checking -$12.00
|
60
|
+
|
61
|
+
2013-02-17 2013/02/17; 2013021702; CREDIT; 2226; INTERNET PAYMENT RECEIVED
|
62
|
+
Income:Unknown
|
63
|
+
Assets:Bank:Checking -$18.00
|
64
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1,16 @@
|
|
1
|
+
2013-10-09 ATM Withdrawal; Withdrawal; £480.00
|
2
|
+
Expenses:Unknown
|
3
|
+
Assets:Bank:Checking -20.00 POUND
|
4
|
+
|
5
|
+
2013-11-07 Bank credit; Bank credit; £500.00
|
6
|
+
Assets:Bank:Checking 500.00 POUND
|
7
|
+
Income:Unknown
|
8
|
+
|
9
|
+
2013-12-09 Visa; Supermarket; £460.23
|
10
|
+
Expenses:Unknown
|
11
|
+
Assets:Bank:Checking -19.77 POUND
|
12
|
+
|
13
|
+
2013-12-10 ATM Withdrawal 2; ATM Withdrawal 4; £360.23
|
14
|
+
Expenses:Unknown
|
15
|
+
Assets:Bank:Checking -100.00 POUND
|
16
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking --csv-separator , --suffixed --currency POUND
|
@@ -0,0 +1,8 @@
|
|
1
|
+
01/09/2015,05354 SUBWAY,8.19,,1000.00
|
2
|
+
02/18/2015,WENDY'S #6338,8.55,,1000.00
|
3
|
+
02/25/2015,WENDY'S #6338,8.55,,1000.00
|
4
|
+
02/25/2015,WENDY'S #6338,9.14,,1000.00
|
5
|
+
02/27/2015,WENDY'S #6338,5.85,,1000.00
|
6
|
+
03/09/2015,WENDY'S #6338,17.70,,1000.00
|
7
|
+
03/16/2015,WENDY'S #6338,11.15,,1000.00
|
8
|
+
03/23/2015,WENDY'S,10.12,,1000.00
|
@@ -0,0 +1,32 @@
|
|
1
|
+
2015-01-09 05354 SUBWAY
|
2
|
+
Assets:Chequing $8.19
|
3
|
+
Expenses:Dining:Resturant
|
4
|
+
|
5
|
+
2015-02-18 WENDY'S #6338
|
6
|
+
Assets:Chequing $8.55
|
7
|
+
Expenses:Dining:Resturant
|
8
|
+
|
9
|
+
2015-02-25 WENDY'S #6338
|
10
|
+
Assets:Chequing $9.14
|
11
|
+
Expenses:Dining:Resturant
|
12
|
+
|
13
|
+
2015-02-25 WENDY'S #6338
|
14
|
+
Assets:Chequing $8.55
|
15
|
+
Expenses:Dining:Resturant
|
16
|
+
|
17
|
+
2015-02-27 WENDY'S #6338
|
18
|
+
Assets:Chequing $5.85
|
19
|
+
Expenses:Dining:Resturant
|
20
|
+
|
21
|
+
2015-03-09 WENDY'S #6338
|
22
|
+
Assets:Chequing $17.70
|
23
|
+
Expenses:Dining:Resturant
|
24
|
+
|
25
|
+
2015-03-16 WENDY'S #6338
|
26
|
+
Assets:Chequing $11.15
|
27
|
+
Expenses:Dining:Resturant
|
28
|
+
|
29
|
+
2015-03-23 WENDY'S
|
30
|
+
Assets:Chequing $10.12
|
31
|
+
Expenses:Dining:Resturant
|
32
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1,12 @@
|
|
1
|
+
2009-12-02 BLARG R SH 456930; $1,826.06
|
2
|
+
Assets:Bank:Checking $327.49
|
3
|
+
Income:Unknown
|
4
|
+
|
5
|
+
2009-12-02 Check - 0000000122; 122; $1,750.06
|
6
|
+
Income:Unknown
|
7
|
+
Assets:Bank:Checking -$76.00
|
8
|
+
|
9
|
+
2009-12-02 Check - 0000000112; 112; $1,498.57
|
10
|
+
Income:Unknown
|
11
|
+
Assets:Bank:Checking -$800.00
|
12
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking --date-format '%d/%m/%Y'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
11/01/2014,0, Deposit,0,500.00,500.00
|
2
|
+
11/02/2014,101,Check,100.00,0,400.00
|
3
|
+
11/03/2014,102,Check,100.00,0,300.00
|
4
|
+
11/04/2014,103,Check,100.00,0,200.00
|
5
|
+
11/05/2014,104,Check,100.00,0,100.00
|
6
|
+
11/06/2014,105,Check,100.00,0,0.00
|
7
|
+
11/17/2014,0, Deposit,0,700.00,700.00
|
@@ -0,0 +1,28 @@
|
|
1
|
+
2014-11-01 0; Deposit; 500.00
|
2
|
+
Assets:Bank:Checking $500.00
|
3
|
+
Income:Unknown
|
4
|
+
|
5
|
+
2014-11-02 101; Check; 400.00
|
6
|
+
Expenses:Unknown
|
7
|
+
Assets:Bank:Checking -$100.00
|
8
|
+
|
9
|
+
2014-11-03 102; Check; 300.00
|
10
|
+
Expenses:Unknown
|
11
|
+
Assets:Bank:Checking -$100.00
|
12
|
+
|
13
|
+
2014-11-04 103; Check; 200.00
|
14
|
+
Expenses:Unknown
|
15
|
+
Assets:Bank:Checking -$100.00
|
16
|
+
|
17
|
+
2014-11-05 104; Check; 100.00
|
18
|
+
Expenses:Unknown
|
19
|
+
Assets:Bank:Checking -$100.00
|
20
|
+
|
21
|
+
2014-11-06 105; Check; 0.00
|
22
|
+
Expenses:Unknown
|
23
|
+
Assets:Bank:Checking -$100.00
|
24
|
+
|
25
|
+
2014-11-17 0; Deposit; 700.00
|
26
|
+
Assets:Bank:Checking $700.00
|
27
|
+
Income:Unknown
|
28
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
-f input.csv --unattended --account Assets:Bank:Checking
|
@@ -0,0 +1,123 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# set -x
|
4
|
+
|
5
|
+
set -Euo pipefail
|
6
|
+
|
7
|
+
|
8
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
9
|
+
TEST_DIFF=""
|
10
|
+
OUTPUT=""
|
11
|
+
RECKON_CMD="reckon -v"
|
12
|
+
export RUBYLIB=$SCRIPT_DIR/../../lib:${RUBYLIB:-}
|
13
|
+
export PATH="$SCRIPT_DIR/../../bin:$PATH"
|
14
|
+
|
15
|
+
main () {
|
16
|
+
trap test_fail EXIT
|
17
|
+
|
18
|
+
if [[ $# -eq 1 ]]; then
|
19
|
+
TESTS=$1/test_args
|
20
|
+
else
|
21
|
+
TESTS=$(find "$SCRIPT_DIR" -name 'test_args')
|
22
|
+
fi
|
23
|
+
|
24
|
+
echo > test.log
|
25
|
+
|
26
|
+
NUM_TESTS=$(echo "$TESTS" |wc -l)
|
27
|
+
|
28
|
+
echo "1..$NUM_TESTS"
|
29
|
+
|
30
|
+
I=1
|
31
|
+
|
32
|
+
for t in $TESTS; do
|
33
|
+
TEST_DIR=$(dirname "$t")
|
34
|
+
pushd "$TEST_DIR" >/dev/null || exit 1
|
35
|
+
if [[ -e "cli_input.exp" ]]; then
|
36
|
+
cli_test
|
37
|
+
else
|
38
|
+
unattended_test
|
39
|
+
fi
|
40
|
+
|
41
|
+
popd >/dev/null || exit 1
|
42
|
+
# have to save output after popd
|
43
|
+
echo -e "\n\n======>$TEST_DIR" >> test.log
|
44
|
+
echo -e "TEST_CMD\n$TEST_LOG" >> test.log
|
45
|
+
|
46
|
+
if [[ $ERROR -ne 0 ]]; then
|
47
|
+
echo -e "not ok $I - $TEST_DIR"
|
48
|
+
tail -n25 test.log
|
49
|
+
exit 1
|
50
|
+
else
|
51
|
+
echo -e "ok $I - $TEST_DIR"
|
52
|
+
fi
|
53
|
+
I=$(($I + 1))
|
54
|
+
done
|
55
|
+
}
|
56
|
+
|
57
|
+
cli_test () {
|
58
|
+
OUTPUT_FILE=$(mktemp)
|
59
|
+
TEST_CMD="$RECKON_CMD --table-output-file $OUTPUT_FILE $(cat test_args)"
|
60
|
+
TEST_CMD="expect -d -c 'spawn $TEST_CMD' cli_input.exp"
|
61
|
+
TEST_LOG=$(eval "$TEST_CMD" 2>&1)
|
62
|
+
ERROR=0
|
63
|
+
TEST_DIFF=$(diff -u "$OUTPUT_FILE" "expected_output")
|
64
|
+
|
65
|
+
# ${#} is character length, test that there was no output from diff
|
66
|
+
if [ ${#TEST_DIFF} -eq 0 ]; then
|
67
|
+
ERROR=0
|
68
|
+
else
|
69
|
+
ERROR=1
|
70
|
+
fi
|
71
|
+
}
|
72
|
+
|
73
|
+
unattended_test() {
|
74
|
+
OUTPUT_FILE=$(mktemp)
|
75
|
+
TEST_CMD="$RECKON_CMD -o $OUTPUT_FILE $(cat test_args)"
|
76
|
+
TEST_LOG=$(eval "$TEST_CMD" 2>&1)
|
77
|
+
ERROR=0
|
78
|
+
|
79
|
+
compare_output "$OUTPUT_FILE"
|
80
|
+
}
|
81
|
+
|
82
|
+
test_fail () {
|
83
|
+
STATUS=$?
|
84
|
+
if [[ $STATUS -ne 0 ]]; then
|
85
|
+
echo -e "FAILED!!!\n$TEST_DIFF\nTest output saved to $OUTPUT_FILE\n"
|
86
|
+
exit $STATUS
|
87
|
+
fi
|
88
|
+
}
|
89
|
+
|
90
|
+
compare_output_for () {
|
91
|
+
OUTPUT_FILE=$1
|
92
|
+
LEDGER=$2
|
93
|
+
|
94
|
+
EXPECTED_FILE=$(mktemp)
|
95
|
+
ACTUAL_FILE=$(mktemp)
|
96
|
+
|
97
|
+
$LEDGER -f output.ledger r >"$EXPECTED_FILE" 2>&1 || return 1
|
98
|
+
$LEDGER -f output.ledger r >"$ACTUAL_FILE" 2>&1 || return 1
|
99
|
+
|
100
|
+
TEST_DIFF=$(diff -u "$EXPECTED_FILE" "$ACTUAL_FILE")
|
101
|
+
|
102
|
+
# ${#} is character length, test that there was no output from diff
|
103
|
+
if [ ${#TEST_DIFF} -eq 0 ]; then
|
104
|
+
return 0
|
105
|
+
else
|
106
|
+
return 1
|
107
|
+
fi
|
108
|
+
}
|
109
|
+
|
110
|
+
compare_output () {
|
111
|
+
OUTPUT_FILE=$1
|
112
|
+
|
113
|
+
for n in {ledger,hledger}; do
|
114
|
+
if compare_output_for "$OUTPUT_FILE" "$n"; then
|
115
|
+
ERROR=0
|
116
|
+
else
|
117
|
+
ERROR=1
|
118
|
+
return 0
|
119
|
+
fi
|
120
|
+
done
|
121
|
+
}
|
122
|
+
|
123
|
+
main "$@"
|