moneybook 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/moneybook +8 -2
  3. data/moneybook.gemspec +1 -1
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.5
data/bin/moneybook CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
+ require 'iconv'
3
4
  require 'terminal-table/import'
4
5
  require 'commander/import'
5
6
  require 'date'
@@ -65,7 +66,12 @@ command :parse do |c|
65
66
  people = []
66
67
  people_abbreviations = []
67
68
  sq = [] #big table to make the computations..
68
- File.open(args.first,'r').read.each_line{|line|
69
+ f=File.open(args.first,'r').read
70
+ if f[0]==255 && f[1]==254 then
71
+ f=Iconv.iconv('UTF-8', 'UTF-16LE', f)[0][3..-1]
72
+ puts "converting from UTF-16LE..."
73
+ end
74
+ f.each_line{|line|
69
75
  if line =~ /^\s*\#/ || line =~ /\A\s*\Z/
70
76
  # this is interpreted as a comment line
71
77
  elsif (m = line.match(/\A\s*PEOPLE\s*\:?\s*((\s+\w+)+)\s*\Z/).andand[1].andand.split(/\s+/).andand.delete_if{|x|x==""}) != nil then
@@ -77,7 +83,7 @@ command :parse do |c|
77
83
  original_str = line.strip
78
84
  line = "PAYBACK (#{temp[1].to_s}) #{temp[2].to_s}"
79
85
  end
80
- x = line.strip.match(/^\s*([\w\ ]+?)\s*\((.+)\)\s*(.+)?/).to_a.map{|z| z.to_s}
86
+ x = line.strip.match(/^\s*([\w\ \']+?)\s*\((.+)\)\s*(.+)?/).to_a.map{|z| z.to_s}
81
87
  sq << {:name => x[1].to_s, :original_str => original_str || line.strip, :true_str => x[2].to_s, :virtual_str => x[3].to_s, :true => {}, :virtual => {}, :balance => {},
82
88
  :true_total => 0, :virtual_total => 0}
83
89
  c=sq.last
data/moneybook.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["luca cioria"]
12
12
  s.date = %q{2011-01-10}
13
- s.default_executable = %q{moneybook}
13
+ s.default_executable = "moneybook"
14
14
  s.description = %q{keep track of money in a group}
15
15
  s.email = %q{noreply@mail.com}
16
16
  s.executables = ["moneybook"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneybook
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - luca cioria
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-10 00:00:00 +01:00
18
+ date: 2011-01-11 00:00:00 +01:00
19
19
  default_executable: moneybook
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency