gnucash2bmd 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: e9c5d80e25978ab36e18c9e3325c98449dde2bab
4
- data.tar.gz: f54245d8ce4cbeebfd9fbd0a489b8009be669631
3
+ metadata.gz: 501affd56837d858bf0df493370866f483bb703c
4
+ data.tar.gz: '09e3714dc472c4e08b31577c3d2f40481123affb'
5
5
  SHA512:
6
- metadata.gz: 513492c7ab766bd1c5822380a062b33d9c67c2a8eb9e59fee4d62104019e044fbdd8402d89b430b01917f4900d84ae745e2934f67a5d28a3121b0977911e1108
7
- data.tar.gz: 47bfd082b7ef6ff2ac4751bd5c2f1e295ea1b7467040b3e8b4c1d00ffe81f815dd5c1f3a5cbaddb87a120d1a0009afbae629f35b21467b81f8cb00f8b7ec111c
6
+ metadata.gz: 17b0da69b647a1ec46133b2ddb07b43185b9bc86dabafe2e4e80c53c2a0fbf518d3e85e6f4e2a221c9bca5ec0727ca0cd39b8de6bdf951ad6500434f69d126d0
7
+ data.tar.gz: 3dd2c1f0357c9e9576efc6fcc835573fa7315b71dea3fe95d2b95a58e1c9cb9d3dd5b0d2403e7c821f461cb700fb159e78e0a1524532a151561a9f38c4cb08eb
data/gnucash2bmd.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_dependency 'trollop'
20
+ spec.add_dependency 'oga'
20
21
 
21
22
  spec.add_development_dependency "bundler"
22
23
  spec.add_development_dependency "rake"
data/history.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 0.0.2 of 2017.05.26
2
+
3
+ - Force col-sep to ';', force quotes for BMD importer
4
+ - added check_bmd
5
+
6
+ ## 0.0.1 of 2017.05.22
7
+
8
+ - initial release
9
+
@@ -1,3 +1,3 @@
1
1
  module Gnucash2Bmd
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/gnucash2bmd.rb CHANGED
@@ -190,8 +190,25 @@ def read_journal(filename)
190
190
  @contents << @bmd if @bmd # save terminated
191
191
  end
192
192
 
193
+ def check_cmd(filename)
194
+ nr_rows = nil
195
+ idx = 0
196
+ CSV.foreach(filename, :col_sep => ';') do |row|
197
+ idx += 1
198
+ nr_rows ||= row.size
199
+ unless nr_rows == row.size
200
+ puts "Expected #{nr_rows} not #{row.size} in line #{idx}"
201
+ puts " #{row}"
202
+ exit 2
203
+ end
204
+ end
205
+ puts "All #{idx} lines of #{filename} have #{nr_rows} elements"
206
+ rescue => error
207
+ puts "got #{error} at line #{idx}"
208
+ end
209
+
193
210
  def emit_bmd(filename)
194
- CSV.open(filename, "wb", :encoding => 'UTF-8') do |csv|
211
+ CSV.open(filename, "wb", :encoding => 'UTF-8', :force_quotes => true, :col_sep => ';') do |csv|
195
212
  csv << IDS.values
196
213
  @contents.each do |content|
197
214
  value_array = []
@@ -213,5 +230,6 @@ files_read.each do |filename|
213
230
  read_journal(filename)
214
231
  end
215
232
  emit_bmd(AUSGABE)
233
+ check_cmd(AUSGABE)
216
234
 
217
235
  puts "Created #{AUSGABE} with #{@contents.size} lines"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnucash2bmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2017-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oga
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +95,7 @@ files:
81
95
  - Rakefile
82
96
  - bin/gnucash2bmd
83
97
  - gnucash2bmd.gemspec
98
+ - history.md
84
99
  - lib/gnucash2bmd.rb
85
100
  - lib/gnucash2bmd/version.rb
86
101
  homepage: https://github.com/ngiger/gnucash2bmd