reckon 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77139229b37c2dcb66ec4f8494fb9d40f036ed267cee0dad067483568b02b948
4
- data.tar.gz: 363a124cf17848e855dede2351f06946e799ead31b2440e586d5c01ae45e63f1
3
+ metadata.gz: 52cfe9cf67708213b2650008196a5177e9732285e320e7024d92cab9155aab5b
4
+ data.tar.gz: 82197ab9f98b310892471cc1cbe5b7d924b8fa57ca2b2cf3b4dbd2abc428f654
5
5
  SHA512:
6
- metadata.gz: 3473f4f80d659d8369151a4b22310159d8b4231df5a24efefd9fc426fa4d27744f2e62fb2c2d17826b0ce4c9a96ef13176ca9e602a47377b6271da49c1324cae
7
- data.tar.gz: 323b5fe3aeafba7f04d93b91458d9982e75704c839bd763bf99371ba8f2b11f74d2b3a82a08bc57a56a1765f7a177955f441af03df63f844f0ae2804f842aacc
6
+ metadata.gz: 5601c43ce038078a9ce825a05b7cd09f57953632e7abc9882f7025806a7c5a6d89f350c41b0b4964e9a3302090e07839064597f343c348e00ad514e8796852bd
7
+ data.tar.gz: 3de71c2b8ab50d203ceb9fe888d13c7bf68785f428322a7a865a21315aa781a809639d95cab5c0eeb96c678e871f83505b61bf0860b08ff0387d772e836a8488
@@ -1 +1 @@
1
- 2.0.0-p648
1
+ 2.7
@@ -1,12 +1,20 @@
1
1
  # Changelog
2
2
 
3
- ## [v0.5.3](https://github.com/cantino/reckon/tree/v0.5.3) (2020-05-01)
3
+ ## [0.5.4](https://github.com/cantino/reckon/tree/0.5.4) (2020-06-04)
4
+
5
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.5.3...0.5.4)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - order of transactions [\#88](https://github.com/cantino/reckon/issues/88)
10
+ - Is reckon failing to handle comments when learning? [\#87](https://github.com/cantino/reckon/issues/87)
11
+
12
+ ## [v0.5.3](https://github.com/cantino/reckon/tree/v0.5.3) (2020-05-02)
4
13
 
5
14
  [Full Changelog](https://github.com/cantino/reckon/compare/v0.5.2...v0.5.3)
6
15
 
7
16
  **Closed issues:**
8
17
 
9
- - Is reckon failing to handle comments when learning? [\#87](https://github.com/cantino/reckon/issues/87)
10
18
  - \[FEATURE REQUEST\] Ask for currency of Account and output in output file in standard format of xxxx TLA for currency [\#84](https://github.com/cantino/reckon/issues/84)
11
19
 
12
20
  ## [v0.5.2](https://github.com/cantino/reckon/tree/v0.5.2) (2020-03-07)
@@ -28,7 +36,7 @@
28
36
 
29
37
  **Merged pull requests:**
30
38
 
31
- - guard against rows that don't parse dates [\#82](https://github.com/cantino/reckon/pull/82) ([benprew](https://github.com/benprew))
39
+ - Fix bugs in ledger file parsing. Fixes \#56. [\#81](https://github.com/cantino/reckon/pull/81) ([benprew](https://github.com/benprew))
32
40
 
33
41
  ## [v0.5.0](https://github.com/cantino/reckon/tree/v0.5.0) (2020-02-19)
34
42
 
@@ -55,7 +63,7 @@
55
63
 
56
64
  **Merged pull requests:**
57
65
 
58
- - Fix bugs in ledger file parsing. Fixes \#56. [\#81](https://github.com/cantino/reckon/pull/81) ([benprew](https://github.com/benprew))
66
+ - guard against rows that don't parse dates [\#82](https://github.com/cantino/reckon/pull/82) ([benprew](https://github.com/benprew))
59
67
  - Better file encoding suggestions [\#80](https://github.com/cantino/reckon/pull/80) ([benprew](https://github.com/benprew))
60
68
  - :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))
61
69
  - bug: invalid header lines should be ignored, not parsed. [\#78](https://github.com/cantino/reckon/pull/78) ([benprew](https://github.com/benprew))
@@ -212,15 +220,15 @@
212
220
 
213
221
  ## [v0.3.3](https://github.com/cantino/reckon/tree/v0.3.3) (2013-01-13)
214
222
 
215
- [Full Changelog](https://github.com/cantino/reckon/compare/v0.3.2...v0.3.3)
223
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.3.1...v0.3.3)
216
224
 
217
- ## [v0.3.2](https://github.com/cantino/reckon/tree/v0.3.2) (2012-07-30)
225
+ ## [v0.3.1](https://github.com/cantino/reckon/tree/v0.3.1) (2012-07-30)
218
226
 
219
- [Full Changelog](https://github.com/cantino/reckon/compare/v0.3.1...v0.3.2)
227
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.3.2...v0.3.1)
220
228
 
221
- ## [v0.3.1](https://github.com/cantino/reckon/tree/v0.3.1) (2012-07-30)
229
+ ## [v0.3.2](https://github.com/cantino/reckon/tree/v0.3.2) (2012-07-30)
222
230
 
223
- [Full Changelog](https://github.com/cantino/reckon/compare/5c07bea3fe63f9b909b4b76bd49f22fd8faf7a29...v0.3.1)
231
+ [Full Changelog](https://github.com/cantino/reckon/compare/5c07bea3fe63f9b909b4b76bd49f22fd8faf7a29...v0.3.2)
224
232
 
225
233
 
226
234
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.5.2)
4
+ reckon (0.5.4)
5
5
  chronic (>= 0.3.0)
6
6
  highline (>= 1.5.2)
7
7
  rchardet (>= 1.8.0)
@@ -10,17 +10,49 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  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)
13
21
  chronic (0.10.2)
14
22
  coderay (1.1.2)
23
+ concurrent-ruby (1.1.6)
15
24
  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)
16
37
  highline (2.0.3)
38
+ i18n (1.8.2)
39
+ concurrent-ruby (~> 1.0)
17
40
  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)
18
47
  pry (0.12.2)
19
48
  coderay (~> 1.1.0)
20
49
  method_source (~> 0.9.0)
50
+ public_suffix (4.0.5)
51
+ rainbow (3.0.0)
21
52
  rake (12.3.3)
22
53
  rantly (1.2.0)
23
54
  rchardet (1.8.0)
55
+ retriable (3.1.2)
24
56
  rspec (3.9.0)
25
57
  rspec-core (~> 3.9.0)
26
58
  rspec-expectations (~> 3.9.0)
@@ -34,14 +66,22 @@ GEM
34
66
  diff-lcs (>= 1.2.0, < 2.0)
35
67
  rspec-support (~> 3.9.0)
36
68
  rspec-support (3.9.2)
69
+ sawyer (0.8.2)
70
+ addressable (>= 2.3.5)
71
+ faraday (> 0.8, < 2.0)
37
72
  terminal-table (1.8.0)
38
73
  unicode-display_width (~> 1.1, >= 1.1.1)
39
- unicode-display_width (1.6.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)
40
79
 
41
80
  PLATFORMS
42
81
  ruby
43
82
 
44
83
  DEPENDENCIES
84
+ github_changelog_generator
45
85
  pry (>= 0.12.2)
46
86
  rake
47
87
  rantly (= 1.2.0)
data/README.md CHANGED
@@ -109,14 +109,18 @@ You can override them with `--default_outof_account` and `--default_into_account
109
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
110
  * Send me a pull request. Bonus points for topic branches.
111
111
 
112
- ## Making a release
113
- * Update lib/reckon/version.rb
114
- * Run `github_changelog_generator --future-release v$(egrep '"[^"]+"' -o lib/reckon/version.rb |sed -e 's/"//g') --user cantino --project reckon -t $(cat ~/.github_token)`
115
- * Commit
116
- * Tag the commit same as in version.rb vX.XX.XX (ex v0.5.2)
117
-
118
112
  ## Copyright
119
113
 
120
114
  Copyright (c) 2013 Andrew Cantino. See LICENSE for details.
121
115
 
122
116
  Thanks to @BlackEdder for many contributions!
117
+
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>`
@@ -53,7 +53,12 @@ module Reckon
53
53
  end
54
54
 
55
55
  def description_for(index)
56
- description_column_indices.map { |i| columns[i][index] }.reject(&:empty?).join("; ").squeeze(" ").gsub(/(;\s+){2,}/, '').strip
56
+ description_column_indices.map { |i| columns[i][index].to_s.strip }
57
+ .reject(&:empty?)
58
+ .join("; ")
59
+ .squeeze(" ")
60
+ .gsub(/(;\s+){2,}/, '')
61
+ .strip
57
62
  end
58
63
 
59
64
  def row(index)
@@ -122,12 +122,13 @@ module Reckon
122
122
  @entries = []
123
123
  new_entry = {}
124
124
  in_comment = false
125
+ comment_chars = ';#%*|'
125
126
  ledger.strip.split("\n").each do |entry|
126
127
  # strip comment lines
127
128
  in_comment = true if entry == 'comment'
128
129
  in_comment = false if entry == 'end comment'
129
130
  next if in_comment
130
- next if entry =~ /^\s*$/ || entry =~ /^[;#%|*]/
131
+ next if entry =~ /^\s*[#{comment_chars}]/
131
132
 
132
133
  # (date, type, code, description), type and code are optional
133
134
  if (m = entry.match(%r{^(\d+[\d/-]+)\s+([*!])?\s*(\([^)]+\))?\s*(.*)$}))
@@ -139,6 +140,9 @@ module Reckon
139
140
  desc: m[4].strip,
140
141
  accounts: []
141
142
  }
143
+ elsif entry =~ /^\s*$/ && new_entry[:date]
144
+ add_entry(new_entry)
145
+ new_entry = {}
142
146
  elsif new_entry[:date] && entry =~ /^\s+/
143
147
  LOGGER.info("Adding new account #{entry}")
144
148
  new_entry[:accounts] << parse_account_line(entry)
@@ -1,3 +1,3 @@
1
1
  module Reckon
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency "rspec", ">= 1.2.9"
20
20
  s.add_development_dependency "pry", ">= 0.12.2"
21
21
  s.add_development_dependency "rantly", "= 1.2.0"
22
+ s.add_development_dependency "github_changelog_generator"
22
23
  s.add_runtime_dependency "chronic", ">= 0.3.0"
23
24
  s.add_runtime_dependency "highline", ">= 1.5.2"
24
25
  s.add_runtime_dependency "terminal-table", ">= 1.4.2"
@@ -232,6 +232,11 @@ describe Reckon::CSVParser do
232
232
  parser = Reckon::CSVParser.new(:string => '01/09/2015,05354 SUBWAY,8.19,,',:date_format => '%d/%m/%Y')
233
233
  parser.description_for(0).should == '05354 SUBWAY'
234
234
  end
235
+
236
+ it "should handle nil description" do
237
+ parser = Reckon::CSVParser.new(string: '2015-09-01,test,3.99')
238
+ expect(parser.description_for(1)).to eq("")
239
+ end
235
240
  end
236
241
 
237
242
  describe "pretty_money_for" do
@@ -20,12 +20,13 @@ describe Reckon::LedgerParser do
20
20
  formats = ["%Y/%m/%d", "%Y-%m-%d"]
21
21
  types = [' ! ', ' * ', ' ']
22
22
  delimiters = [" ", "\t", "\t\t"]
23
+ comment_chars = ';#%*|'
23
24
  currency_delimiters = delimiters + ['']
24
25
  currencies = ['', '$', '£']
25
26
  property_of do
26
27
  Rantly do
27
28
  description = Proc.new do
28
- sized(15){string}.tr(%q{'`:*\\},'').gsub(/\s+/, ' ').gsub(/^[!;<\[( ]+/, '')
29
+ sized(15){string}.tr(%q{'`:*\\},'').gsub(/\s+/, ' ').gsub(/^[!;<\[( #{comment_chars}]+/, '')
29
30
  end
30
31
  currency = choose(*currencies) # to be consistent within the transaction
31
32
  single_line_comments = ";#|%*".split('').map { |n| "#{n} #{call(description)}" }
@@ -56,11 +57,12 @@ describe Reckon::LedgerParser do
56
57
  filter_format = lambda { |n| [n['date'], n['desc'], n['name'], sprintf("%.02f", n['amount'])] }
57
58
  headers = %w[date code desc name currency amount type commend]
58
59
  safe_s = Shellwords.escape(s)
59
- ledger_csv = `echo #{safe_s} | ledger csv --date-format '%Y-%m-%d' -f - `
60
- ledger_parser_csv = Reckon::LedgerParser.new(s, date_format: '%Y/%m/%d').to_csv.join("\n")
61
60
 
61
+ lp_csv = Reckon::LedgerParser.new(s, date_format: '%Y-%m-%d').to_csv.join("\n")
62
+ actual = CSV.parse(lp_csv, headers: headers).map(&filter_format)
63
+
64
+ ledger_csv = `echo #{safe_s} | ledger csv --date-format '%Y-%m-%d' -f - `
62
65
  expected = CSV.parse(ledger_csv.gsub('\"', '""'), headers: headers).map(&filter_format)
63
- actual = CSV.parse(ledger_parser_csv, headers: headers).map(&filter_format)
64
66
  expected.length.times do |i|
65
67
  expect(actual[i]).to eq(expected[i])
66
68
  end
@@ -87,6 +89,19 @@ HERE
87
89
 
88
90
  end
89
91
 
92
+ it 'should transaction comments' do
93
+ ledger = <<HERE
94
+ 2020-03-27 AMZN Mktp USX999H3203; Shopping; Sale
95
+ Expenses:Household $82.77
96
+ Liabilities:ChaseSapphire -$81.77
97
+ # END FINANCE SCRIPT OUTPUT Thu 02 Apr 2020 12:05:54 PM EDT
98
+ HERE
99
+ l = Reckon::LedgerParser.new(ledger)
100
+ expect(l.entries.first[:accounts].map { |n| n[:name] }).to eq(['Expenses:Household', 'Liabilities:ChaseSapphire'])
101
+ expect(l.entries.first[:accounts].size).to eq(2)
102
+ expect(l.entries.length).to eq(1)
103
+ end
104
+
90
105
  it "should ignore non-standard entries" do
91
106
  @ledger.entries.length.should == 7
92
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reckon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Cantino
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-05-02 00:00:00.000000000 Z
13
+ date: 2020-06-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -54,6 +54,20 @@ dependencies:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
56
  version: 1.2.0
57
+ - !ruby/object:Gem::Dependency
58
+ name: github_changelog_generator
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: chronic
59
73
  requirement: !ruby/object:Gem::Requirement
@@ -197,46 +211,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
211
  - !ruby/object:Gem::Version
198
212
  version: '0'
199
213
  requirements: []
200
- rubygems_version: 3.0.3
214
+ rubygems_version: 3.1.2
201
215
  signing_key:
202
216
  specification_version: 4
203
217
  summary: Utility for interactively converting and labeling CSV files for the Ledger
204
218
  accounting tool.
205
- test_files:
206
- - spec/data_fixtures/51-sample.csv
207
- - spec/data_fixtures/51-tokens.yml
208
- - spec/data_fixtures/73-sample.csv
209
- - spec/data_fixtures/73-tokens.yml
210
- - spec/data_fixtures/73-transactions.ledger
211
- - spec/data_fixtures/85-date-example.csv
212
- - spec/data_fixtures/austrian_example.csv
213
- - spec/data_fixtures/bom_utf8_file.csv
214
- - spec/data_fixtures/broker_canada_example.csv
215
- - spec/data_fixtures/chase.csv
216
- - spec/data_fixtures/danish_kroner_nordea_example.csv
217
- - spec/data_fixtures/english_date_example.csv
218
- - spec/data_fixtures/extratofake.csv
219
- - spec/data_fixtures/french_example.csv
220
- - spec/data_fixtures/german_date_example.csv
221
- - spec/data_fixtures/harder_date_example.csv
222
- - spec/data_fixtures/ing.csv
223
- - spec/data_fixtures/intuit_mint_example.csv
224
- - spec/data_fixtures/invalid_header_example.csv
225
- - spec/data_fixtures/inversed_credit_card.csv
226
- - spec/data_fixtures/nationwide.csv
227
- - spec/data_fixtures/simple.csv
228
- - spec/data_fixtures/some_other.csv
229
- - spec/data_fixtures/spanish_date_example.csv
230
- - spec/data_fixtures/suntrust.csv
231
- - spec/data_fixtures/test_money_column.csv
232
- - spec/data_fixtures/tokens.yaml
233
- - spec/data_fixtures/two_money_columns.csv
234
- - spec/data_fixtures/yyyymmdd_date_example.csv
235
- - spec/reckon/app_spec.rb
236
- - spec/reckon/csv_parser_spec.rb
237
- - spec/reckon/date_column_spec.rb
238
- - spec/reckon/ledger_parser_spec.rb
239
- - spec/reckon/money_column_spec.rb
240
- - spec/reckon/money_spec.rb
241
- - spec/spec.opts
242
- - spec/spec_helper.rb
219
+ test_files: []