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 +4 -4
- data/gnucash2bmd.gemspec +1 -0
- data/history.md +9 -0
- data/lib/gnucash2bmd/version.rb +1 -1
- data/lib/gnucash2bmd.rb +19 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 501affd56837d858bf0df493370866f483bb703c
|
4
|
+
data.tar.gz: '09e3714dc472c4e08b31577c3d2f40481123affb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17b0da69b647a1ec46133b2ddb07b43185b9bc86dabafe2e4e80c53c2a0fbf518d3e85e6f4e2a221c9bca5ec0727ca0cd39b8de6bdf951ad6500434f69d126d0
|
7
|
+
data.tar.gz: 3dd2c1f0357c9e9576efc6fcc835573fa7315b71dea3fe95d2b95a58e1c9cb9d3dd5b0d2403e7c821f461cb700fb159e78e0a1524532a151561a9f38c4cb08eb
|
data/gnucash2bmd.gemspec
CHANGED
data/history.md
ADDED
data/lib/gnucash2bmd/version.rb
CHANGED
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.
|
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-
|
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
|