reckon 0.8.0 → 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: fbf144e0683d1b618fbc046ade5af1c9fd37a69c2a62ee393301ce26f9b9a475
4
- data.tar.gz: 32fc57d45adec068894497619c357a36482ede4e547a3169a4c8faf95e731a2c
3
+ metadata.gz: 26126e1e4ead4fcd93a94093f8e4a4fd557a9c46ccc6983198d4bdd516e639ee
4
+ data.tar.gz: f196a86ca58ebaeee4f27030bb21af9fd3c3001d20d06b74f2063ea42d96cfcc
5
5
  SHA512:
6
- metadata.gz: a5cdf653ec68d8360526c131335249fce69c9b51b12824023263621fb743c4c769cf9e9a44aa37108d8d1ef3ad51bba9b9268e36259c7d4597dddf20abf3c368
7
- data.tar.gz: 0af870f477d800fb76edf3d7a4e31ef1120d40817b55d8e8da7175bad0e6daa2a981186e5bfc258a46703dd81cb1c07ed805a0260e9472264a5817fd207a9649
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:
@@ -21,23 +19,17 @@ jobs:
21
19
  matrix:
22
20
  ruby-version:
23
21
  # Current ruby stable version
22
+ - 3.1.2
23
+ # Ubuntu 22.04
24
24
  - 3.0
25
- # Ubuntu 20.10
25
+ # Ubuntu 20.04
26
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
27
  steps:
36
28
  - uses: actions/checkout@v2
37
29
  - name: Update package
38
30
  run: sudo apt-get update
39
31
  - name: Install packages
40
- run: sudo apt-get -y install ledger hledger expect
32
+ run: sudo apt-get -y install ledger hledger
41
33
  - name: Set up Ruby
42
34
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
43
35
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
data/.gitignore CHANGED
@@ -28,6 +28,14 @@ private_tests
28
28
 
29
29
  ## Bundler
30
30
  vendor
31
+ .bundle
32
+ # binstubs
33
+ exec/
34
+
35
+ # Don't commit gem files
36
+ *.gem
31
37
 
32
38
  test.log
33
39
  test_log.txt
40
+
41
+ .byebug_history
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
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
+
15
+ ## [v0.8.1](https://github.com/cantino/reckon/tree/v0.8.1) (2022-07-02)
16
+
17
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.8.0...v0.8.1)
18
+
19
+ **Closed issues:**
20
+
21
+ - Reckon files every transaction \(incoming and outgoing\) as Income:Unknown [\#116](https://github.com/cantino/reckon/issues/116)
22
+
23
+ **Merged pull requests:**
24
+
25
+ - fix bugs with test.sh [\#117](https://github.com/cantino/reckon/pull/117) ([benprew](https://github.com/benprew))
26
+
3
27
  ## [v0.8.0](https://github.com/cantino/reckon/tree/v0.8.0) (2021-08-08)
4
28
 
5
29
  [Full Changelog](https://github.com/cantino/reckon/compare/v0.7.2...v0.8.0)
@@ -222,7 +246,6 @@
222
246
  - Unattended mode and custom tokens support [\#47](https://github.com/cantino/reckon/pull/47) ([vzctl](https://github.com/vzctl))
223
247
  - \[RFC\] Implement issue \#40: Tab completion [\#46](https://github.com/cantino/reckon/pull/46) ([BlackEdder](https://github.com/BlackEdder))
224
248
  - set readline to allow for backspace in ask dialog [\#44](https://github.com/cantino/reckon/pull/44) ([mrtazz](https://github.com/mrtazz))
225
- - Fix --encoding option [\#41](https://github.com/cantino/reckon/pull/41) ([mamciek](https://github.com/mamciek))
226
249
 
227
250
  ## [v0.3.10](https://github.com/cantino/reckon/tree/v0.3.10) (2014-08-16)
228
251
 
@@ -230,6 +253,7 @@
230
253
 
231
254
  **Merged pull requests:**
232
255
 
256
+ - Fix --encoding option [\#41](https://github.com/cantino/reckon/pull/41) ([mamciek](https://github.com/mamciek))
233
257
  - Bumped version number [\#37](https://github.com/cantino/reckon/pull/37) ([BlackEdder](https://github.com/BlackEdder))
234
258
 
235
259
  ## [v0.3.9](https://github.com/cantino/reckon/tree/v0.3.9) (2014-02-20)
data/Gemfile.lock CHANGED
@@ -1,38 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.8.0)
4
+ reckon (0.9.0)
5
5
  chronic (>= 0.3.0)
6
6
  highline (>= 1.5.2)
7
+ matrix (>= 0.4.2)
7
8
  rchardet (>= 1.8.0)
8
9
 
9
10
  GEM
10
11
  remote: http://rubygems.org/
11
12
  specs:
12
13
  chronic (0.10.2)
13
- coderay (1.1.2)
14
- diff-lcs (1.3)
15
- highline (2.0.3)
16
- method_source (0.9.2)
17
- pry (0.12.2)
18
- coderay (~> 1.1.0)
19
- method_source (~> 0.9.0)
20
- rake (12.3.3)
14
+ coderay (1.1.3)
15
+ diff-lcs (1.5.0)
16
+ highline (2.1.0)
17
+ matrix (0.4.2)
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)
21
23
  rantly (1.2.0)
22
24
  rchardet (1.8.0)
23
- rspec (3.9.0)
24
- rspec-core (~> 3.9.0)
25
- rspec-expectations (~> 3.9.0)
26
- rspec-mocks (~> 3.9.0)
27
- rspec-core (3.9.1)
28
- rspec-support (~> 3.9.1)
29
- 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)
30
32
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.9.0)
32
- rspec-mocks (3.9.1)
33
+ rspec-support (~> 3.12.0)
34
+ rspec-mocks (3.12.3)
33
35
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.9.0)
35
- rspec-support (3.9.2)
36
+ rspec-support (~> 3.12.0)
37
+ rspec-support (3.12.0)
36
38
 
37
39
  PLATFORMS
38
40
  ruby
@@ -45,4 +47,4 @@ DEPENDENCIES
45
47
  rspec (>= 1.2.9)
46
48
 
47
49
  BUNDLED WITH
48
- 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
@@ -5,7 +5,7 @@ set -e
5
5
  VERSION=$1
6
6
 
7
7
  echo "Install github_changelog_generator"
8
- # gem install --user github_changelog_generator
8
+ gem install --user github_changelog_generator
9
9
 
10
10
  echo "Update 'lib/reckon/version.rb'"
11
11
  echo -e "module Reckon\n VERSION=\"$VERSION\"\nend" > lib/reckon/version.rb
@@ -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.0"
2
+ VERSION="0.9.0"
3
3
  end
data/reckon.gemspec CHANGED
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.add_runtime_dependency "chronic", ">= 0.3.0"
23
23
  s.add_runtime_dependency "highline", ">= 1.5.2"
24
24
  s.add_runtime_dependency "rchardet", ">= 1.8.0"
25
+ s.add_runtime_dependency "matrix", ">= 0.4.2"
25
26
  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
@@ -73,7 +71,7 @@ cli_test () {
73
71
  unattended_test() {
74
72
  OUTPUT_FILE=$(mktemp)
75
73
  TEST_CMD="$RECKON_CMD -o $OUTPUT_FILE $(cat test_args)"
76
- eval $TEST_CMD 2>&1
74
+ eval "$TEST_CMD" 2>&1
77
75
  ERROR=0
78
76
 
79
77
  compare_output "$OUTPUT_FILE"
@@ -114,11 +112,13 @@ compare_output_for () {
114
112
  EXPECTED_FILE=$(mktemp)
115
113
  ACTUAL_FILE=$(mktemp)
116
114
 
117
- echo $LEDGER -f output.ledger r "$EXPECTED_FILE"
118
- eval $LEDGER -f output.ledger r >"$EXPECTED_FILE" || return 1
115
+ EXPECTED_CMD="$LEDGER -f output.ledger r >$EXPECTED_FILE"
116
+ echo "$EXPECTED_CMD"
117
+ eval "$EXPECTED_CMD" || return 1
119
118
 
120
- echo $LEDGER -f output.ledger r "$ACTUAL_FILE"
121
- eval $LEDGER -f output.ledger r >"$ACTUAL_FILE" || return 1
119
+ ACTUAL_CMD="$LEDGER -f \"$OUTPUT_FILE\" r"
120
+ echo "running $ACTUAL_CMD"
121
+ eval $ACTUAL_CMD >$ACTUAL_FILE || return 1
122
122
 
123
123
  TEST_DIFF=$(diff -u "$EXPECTED_FILE" "$ACTUAL_FILE")
124
124
 
@@ -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.0
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: 2021-08-08 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
@@ -96,6 +96,20 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: 1.8.0
99
+ - !ruby/object:Gem::Dependency
100
+ name: matrix
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 0.4.2
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.4.2
99
113
  description: Reckon automagically converts CSV files for use with the command-line
100
114
  accounting tool Ledger. It also helps you to select the correct accounts associated
101
115
  with the CSV data using Bayesian machine learning.
@@ -163,7 +177,7 @@ files:
163
177
  - spec/integration/another_bank_example/input.csv
164
178
  - spec/integration/another_bank_example/output.ledger
165
179
  - spec/integration/another_bank_example/test_args
166
- - spec/integration/ask_for_account/cli_input.exp
180
+ - spec/integration/ask_for_account/cli_input.txt
167
181
  - spec/integration/ask_for_account/expected_output
168
182
  - spec/integration/ask_for_account/input.csv
169
183
  - spec/integration/ask_for_account/test_args
@@ -251,6 +265,9 @@ files:
251
265
  - spec/integration/two_money_columns/input.csv
252
266
  - spec/integration/two_money_columns/output.ledger
253
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
254
271
  - spec/integration/yyyymmdd_date_example/input.csv
255
272
  - spec/integration/yyyymmdd_date_example/output.ledger
256
273
  - spec/integration/yyyymmdd_date_example/test_args
@@ -267,7 +284,7 @@ homepage: https://github.com/cantino/reckon
267
284
  licenses:
268
285
  - MIT
269
286
  metadata: {}
270
- post_install_message:
287
+ post_install_message:
271
288
  rdoc_options: []
272
289
  require_paths:
273
290
  - lib
@@ -282,8 +299,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
299
  - !ruby/object:Gem::Version
283
300
  version: '0'
284
301
  requirements: []
285
- rubygems_version: 3.2.3
286
- signing_key:
302
+ rubygems_version: 3.3.5
303
+ signing_key:
287
304
  specification_version: 4
288
305
  summary: Utility for interactively converting and labeling CSV files for the Ledger
289
306
  accounting tool.
@@ -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