reckon 0.6.1 → 0.6.2

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: aebd4114b69fd94cc45e9cf425da57269ae80508b90f781fbbc5c96c6912b100
4
- data.tar.gz: 0de1e3fb308bc2dad8cfa679056189092a4f07ece989b8e3b57c8acca100c77c
3
+ metadata.gz: 5debbf17f216c822d753863d7c4adf18318beaf06f608d9d145e7f07b2a0b91b
4
+ data.tar.gz: f1d393d4aae4cd646794c2b6388a77f2dcf0b154874b6a379922ab7b05a8da92
5
5
  SHA512:
6
- metadata.gz: c59e8ae6ecbf11534086bd9fc179ff5e8aa52066b8fb0cd5ddbce28b6a4a01b32659fdf51cdaa00403a86be2b3023e390184b76924fb13a6ed5288b8d637c8c0
7
- data.tar.gz: 75a5921df0c427351768c803bbe019b3bdf7a12ec8f8d714779086a73ab850ea50b49708c9430ac823b97c0ef35493b5888b5980cdbfab4691cecc05b759224e
6
+ metadata.gz: e35912bb53131baa9a150ce05eede60946fd0101566e84fd9ab21476fbed54cadc011e56d18b29502d3b2c020cd325d6e8883f9f7827485bab1d8e4e6907a853
7
+ data.tar.gz: 4e67777ef46d71051372c41ec5be831cf8a6945d2da12d84bfc346b58db5604f79c1b1cfcc1471dd445a8767cc5ec47c4a465af9c41c9c830f38879ed3c3b6e4
@@ -1,8 +1,21 @@
1
1
  # Changelog
2
2
 
3
- ## [0.6.1](https://github.com/cantino/reckon/tree/0.6.1) (2021-01-23)
3
+ ## [0.6.2](https://github.com/cantino/reckon/tree/0.6.2) (2021-01-24)
4
4
 
5
- [Full Changelog](https://github.com/cantino/reckon/compare/v0.6.0...0.6.1)
5
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.6.1...0.6.2)
6
+
7
+ **Closed issues:**
8
+
9
+ - spaces in tokens [\#97](https://github.com/cantino/reckon/issues/97)
10
+ - read from stdin [\#95](https://github.com/cantino/reckon/issues/95)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - 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))
15
+
16
+ ## [v0.6.1](https://github.com/cantino/reckon/tree/v0.6.1) (2021-01-23)
17
+
18
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.6.0...v0.6.1)
6
19
 
7
20
  **Implemented enhancements:**
8
21
 
@@ -10,7 +23,6 @@
10
23
 
11
24
  **Closed issues:**
12
25
 
13
- - spaces in tokens [\#97](https://github.com/cantino/reckon/issues/97)
14
26
  - Migrate CI system from travis-ci.org [\#93](https://github.com/cantino/reckon/issues/93)
15
27
  - \[Feature Request\] Pipe ledger file input to the bayesian predictor \(instead of csv\) [\#91](https://github.com/cantino/reckon/issues/91)
16
28
 
@@ -166,7 +178,6 @@
166
178
 
167
179
  **Merged pull requests:**
168
180
 
169
- - Fix --encoding option [\#41](https://github.com/cantino/reckon/pull/41) ([mamciek](https://github.com/mamciek))
170
181
  - Bumped version number [\#37](https://github.com/cantino/reckon/pull/37) ([BlackEdder](https://github.com/BlackEdder))
171
182
 
172
183
  ## [v0.3.9](https://github.com/cantino/reckon/tree/v0.3.9) (2014-02-20)
@@ -180,6 +191,7 @@
180
191
 
181
192
  **Merged pull requests:**
182
193
 
194
+ - Fix --encoding option [\#41](https://github.com/cantino/reckon/pull/41) ([mamciek](https://github.com/mamciek))
183
195
  - Added spec for csv files from Broker Canada [\#36](https://github.com/cantino/reckon/pull/36) ([BlackEdder](https://github.com/BlackEdder))
184
196
  - Date format [\#35](https://github.com/cantino/reckon/pull/35) ([BlackEdder](https://github.com/BlackEdder))
185
197
  - Added example from a french bank [\#34](https://github.com/cantino/reckon/pull/34) ([BlackEdder](https://github.com/BlackEdder))
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.6.1)
4
+ reckon (0.6.2)
5
5
  chronic (>= 0.3.0)
6
6
  highline (>= 1.5.2)
7
7
  rchardet (>= 1.8.0)
data/README.md CHANGED
@@ -82,6 +82,10 @@ To guess the accounts reckon can use an existing ledger file or a token file wit
82
82
 
83
83
  `reckon --unattended --account-tokens tokens.yaml -f bank.csv -o ledger.dat`
84
84
 
85
+ In unattended mode, you can use STDIN to read your csv data, by specifying `-` as the argument to `-f`.
86
+
87
+ `csv_file_generator | reckon --unattended -l 2010.dat -o ledger.dat -f -`
88
+
85
89
  ### Account Tokens
86
90
 
87
91
  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:
data/bin/reckon CHANGED
@@ -3,7 +3,12 @@
3
3
  require 'rubygems'
4
4
  require 'reckon'
5
5
 
6
- options = Reckon::App.parse_opts
6
+ begin
7
+ options = Reckon::App.parse_opts
8
+ rescue RuntimeError => e
9
+ puts("ERROR: #{e}")
10
+ exit(1)
11
+ end
7
12
  reckon = Reckon::App.new(options)
8
13
 
9
14
  if options[:print_table]
@@ -286,9 +286,9 @@ module Reckon
286
286
  print_transaction(rows)
287
287
  end
288
288
 
289
- def self.parse_opts(args = ARGV)
289
+ def self.parse_opts(args=ARGV, stdin=STDIN)
290
290
  options = { :output_file => STDOUT }
291
- parser = OptionParser.new do |opts|
291
+ OptionParser.new do |opts|
292
292
  opts.banner = "Usage: Reckon.rb [options]"
293
293
  opts.separator ""
294
294
 
@@ -394,6 +394,15 @@ module Reckon
394
394
  opts.parse!(args)
395
395
  end
396
396
 
397
+ if options[:file] == '-'
398
+ unless options[:unattended]
399
+ raise "--unattended is required to use STDIN as CSV source."
400
+ end
401
+
402
+ puts "Reading csv from STDIN"
403
+ options[:string] = stdin.read
404
+ end
405
+
397
406
  unless options[:file]
398
407
  options[:file] = @@cli.ask("What CSV file should I parse? ")
399
408
  unless options[:file].length > 0
@@ -1,3 +1,3 @@
1
1
  module Reckon
2
- VERSION="0.6.1"
2
+ VERSION="0.6.2"
3
3
  end
@@ -86,6 +86,22 @@ describe Reckon::App do
86
86
  expect(output_file.string.scan('Expenses:Websites').count).to eq(2)
87
87
  end
88
88
  end
89
+
90
+ describe 'csv from STDIN' do
91
+ it 'should assign to :string option' do
92
+ options = Reckon::App.parse_opts(
93
+ %w[-f - --unattended --account bank],
94
+ StringIO.new('foo,bar,baz')
95
+ )
96
+ expect(options[:string]).to eq('foo,bar,baz')
97
+ end
98
+
99
+ it 'should require --unattended flag' do
100
+ expect {Reckon::App.parse_opts(%w[-f - --account bank])}.to(
101
+ raise_error(RuntimeError, "--unattended is required to use STDIN as CSV source.")
102
+ )
103
+ end
104
+ end
89
105
  end
90
106
 
91
107
  context "Issue #73 - regression test" do
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.6.1
4
+ version: 0.6.2
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: 2021-01-23 00:00:00.000000000 Z
13
+ date: 2021-01-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec