reckon 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/lib/reckon.rb +6 -1
- data/lib/reckon/app.rb +6 -2
- data/reckon.gemspec +28 -24
- data/spec/reckon/app_spec.rb +7 -3
- data/spec/reckon/ledger_parser_spec.rb +1 -1
- metadata +47 -18
- data/.gitignore +0 -24
data/Rakefile
CHANGED
@@ -10,8 +10,10 @@ begin
|
|
10
10
|
gem.email = "andrew@iterationlabs.com"
|
11
11
|
gem.homepage = "http://github.com/iterationlabs/reckon"
|
12
12
|
gem.authors = ["Andrew Cantino"]
|
13
|
-
gem.add_development_dependency "rspec", "
|
13
|
+
gem.add_development_dependency "rspec", "1.3.1"
|
14
|
+
gem.add_development_dependency "jeweler"
|
14
15
|
gem.add_dependency('fastercsv', '>= 1.5.1')
|
16
|
+
gem.add_dependency('chronic', '>= 0.3.0')
|
15
17
|
gem.add_dependency('highline', '>= 1.5.2')
|
16
18
|
gem.add_dependency('terminal-table', '>= 1.4.2')
|
17
19
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/reckon.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
|
4
|
+
if RUBY_VERSION =~ /^1\.9/
|
5
|
+
require 'csv'
|
6
|
+
else
|
7
|
+
require 'fastercsv'
|
8
|
+
end
|
5
9
|
require 'highline/import'
|
6
10
|
require 'optparse'
|
11
|
+
require 'chronic'
|
7
12
|
require 'time'
|
8
13
|
require 'terminal-table'
|
9
14
|
|
data/lib/reckon/app.rb
CHANGED
@@ -172,7 +172,11 @@ module Reckon
|
|
172
172
|
value = columns[date_column_index][index]
|
173
173
|
value = [$1, $2, $3].join("/") if value =~ /^(\d{4})(\d{2})(\d{2})\d+\[\d+\:GMT\]$/ # chase format
|
174
174
|
begin
|
175
|
-
|
175
|
+
guess = Chronic.parse(value, :context => :past)
|
176
|
+
if guess.to_i < 953236800 && value =~ /\//
|
177
|
+
guess = Chronic.parse((value.split("/")[0...-1] + [(2000 + value.split("/").last.to_i).to_s]).join("/"), :context => :past)
|
178
|
+
end
|
179
|
+
guess
|
176
180
|
rescue
|
177
181
|
puts "I'm having trouble parsing #{value}, which I thought was a date. Please report this so that we"
|
178
182
|
puts "can make this parser better!"
|
@@ -327,7 +331,7 @@ module Reckon
|
|
327
331
|
|
328
332
|
def parse
|
329
333
|
data = options[:string] || File.read(options[:file])
|
330
|
-
self.csv_data = FasterCSV.parse(data.strip, :col_sep => options[:csv_separator] || ',')
|
334
|
+
self.csv_data = (RUBY_VERSION =~ /^1\.9/ ? CSV : FasterCSV).parse(data.strip, :col_sep => options[:csv_separator] || ',')
|
331
335
|
end
|
332
336
|
|
333
337
|
def self.parse_opts(args = ARGV)
|
data/reckon.gemspec
CHANGED
@@ -1,49 +1,47 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{reckon}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Cantino"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-07}
|
13
13
|
s.default_executable = %q{reckon}
|
14
14
|
s.description = %q{Reckon automagically converts CSV files for use with the command-line accounting tool Ledger. It also helps you to select the correct accounts associated with the CSV data using Bayesian machine learning.}
|
15
15
|
s.email = %q{andrew@iterationlabs.com}
|
16
16
|
s.executables = ["reckon"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
19
|
+
"README.rdoc"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
"spec/spec_helper.rb"
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/reckon",
|
28
|
+
"lib/reckon.rb",
|
29
|
+
"lib/reckon/app.rb",
|
30
|
+
"lib/reckon/ledger_parser.rb",
|
31
|
+
"reckon.gemspec",
|
32
|
+
"spec/reckon/app_spec.rb",
|
33
|
+
"spec/reckon/ledger_parser_spec.rb",
|
34
|
+
"spec/spec.opts",
|
35
|
+
"spec/spec_helper.rb"
|
37
36
|
]
|
38
37
|
s.homepage = %q{http://github.com/iterationlabs/reckon}
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
40
38
|
s.require_paths = ["lib"]
|
41
39
|
s.rubygems_version = %q{1.3.7}
|
42
40
|
s.summary = %q{Utility for interactively converting and labeling CSV files for the Ledger accounting tool.}
|
43
41
|
s.test_files = [
|
44
42
|
"spec/reckon/app_spec.rb",
|
45
|
-
|
46
|
-
|
43
|
+
"spec/reckon/ledger_parser_spec.rb",
|
44
|
+
"spec/spec_helper.rb"
|
47
45
|
]
|
48
46
|
|
49
47
|
if s.respond_to? :specification_version then
|
@@ -51,19 +49,25 @@ Gem::Specification.new do |s|
|
|
51
49
|
s.specification_version = 3
|
52
50
|
|
53
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
-
s.add_development_dependency(%q<rspec>, ["
|
52
|
+
s.add_development_dependency(%q<rspec>, ["= 1.3.1"])
|
53
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
55
54
|
s.add_runtime_dependency(%q<fastercsv>, [">= 1.5.1"])
|
55
|
+
s.add_runtime_dependency(%q<chronic>, [">= 0.3.0"])
|
56
56
|
s.add_runtime_dependency(%q<highline>, [">= 1.5.2"])
|
57
57
|
s.add_runtime_dependency(%q<terminal-table>, [">= 1.4.2"])
|
58
58
|
else
|
59
|
-
s.add_dependency(%q<rspec>, ["
|
59
|
+
s.add_dependency(%q<rspec>, ["= 1.3.1"])
|
60
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
60
61
|
s.add_dependency(%q<fastercsv>, [">= 1.5.1"])
|
62
|
+
s.add_dependency(%q<chronic>, [">= 0.3.0"])
|
61
63
|
s.add_dependency(%q<highline>, [">= 1.5.2"])
|
62
64
|
s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
|
63
65
|
end
|
64
66
|
else
|
65
|
-
s.add_dependency(%q<rspec>, ["
|
67
|
+
s.add_dependency(%q<rspec>, ["= 1.3.1"])
|
68
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
66
69
|
s.add_dependency(%q<fastercsv>, [">= 1.5.1"])
|
70
|
+
s.add_dependency(%q<chronic>, [">= 0.3.0"])
|
67
71
|
s.add_dependency(%q<highline>, [">= 1.5.2"])
|
68
72
|
s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
|
69
73
|
end
|
data/spec/reckon/app_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require File.dirname(__FILE__)
|
3
|
+
require "./#{File.dirname(__FILE__)}/../spec_helper"
|
4
4
|
require 'rubygems'
|
5
5
|
require 'reckon'
|
6
6
|
|
@@ -95,8 +95,12 @@ describe Reckon::App do
|
|
95
95
|
|
96
96
|
describe "date_for" do
|
97
97
|
it "should return a parsed date object" do
|
98
|
-
@chase.date_for(1).should == Time.parse("2009/12/24")
|
99
|
-
@
|
98
|
+
@chase.date_for(1).year.should == Time.parse("2009/12/24").year
|
99
|
+
@chase.date_for(1).month.should == Time.parse("2009/12/24").month
|
100
|
+
@chase.date_for(1).day.should == Time.parse("2009/12/24").day
|
101
|
+
@some_other_bank.date_for(1).year.should == Time.parse("2010/12/24").year
|
102
|
+
@some_other_bank.date_for(1).month.should == Time.parse("2010/12/24").month
|
103
|
+
@some_other_bank.date_for(1).day.should == Time.parse("2010/12/24").day
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reckon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Cantino
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-07 00:00:00 -08:00
|
19
19
|
default_executable: reckon
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,20 +24,34 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - "="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 25
|
30
30
|
segments:
|
31
31
|
- 1
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 1.
|
32
|
+
- 3
|
33
|
+
- 1
|
34
|
+
version: 1.3.1
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: jeweler
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: fastercsv
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
55
|
none: false
|
42
56
|
requirements:
|
43
57
|
- - ">="
|
@@ -49,11 +63,27 @@ dependencies:
|
|
49
63
|
- 1
|
50
64
|
version: 1.5.1
|
51
65
|
type: :runtime
|
52
|
-
version_requirements: *
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: chronic
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 19
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
- 3
|
79
|
+
- 0
|
80
|
+
version: 0.3.0
|
81
|
+
type: :runtime
|
82
|
+
version_requirements: *id004
|
53
83
|
- !ruby/object:Gem::Dependency
|
54
84
|
name: highline
|
55
85
|
prerelease: false
|
56
|
-
requirement: &
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
57
87
|
none: false
|
58
88
|
requirements:
|
59
89
|
- - ">="
|
@@ -65,11 +95,11 @@ dependencies:
|
|
65
95
|
- 2
|
66
96
|
version: 1.5.2
|
67
97
|
type: :runtime
|
68
|
-
version_requirements: *
|
98
|
+
version_requirements: *id005
|
69
99
|
- !ruby/object:Gem::Dependency
|
70
100
|
name: terminal-table
|
71
101
|
prerelease: false
|
72
|
-
requirement: &
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
73
103
|
none: false
|
74
104
|
requirements:
|
75
105
|
- - ">="
|
@@ -81,7 +111,7 @@ dependencies:
|
|
81
111
|
- 2
|
82
112
|
version: 1.4.2
|
83
113
|
type: :runtime
|
84
|
-
version_requirements: *
|
114
|
+
version_requirements: *id006
|
85
115
|
description: Reckon automagically converts CSV files for use with the command-line accounting tool Ledger. It also helps you to select the correct accounts associated with the CSV data using Bayesian machine learning.
|
86
116
|
email: andrew@iterationlabs.com
|
87
117
|
executables:
|
@@ -93,7 +123,6 @@ extra_rdoc_files:
|
|
93
123
|
- README.rdoc
|
94
124
|
files:
|
95
125
|
- .document
|
96
|
-
- .gitignore
|
97
126
|
- LICENSE
|
98
127
|
- README.rdoc
|
99
128
|
- Rakefile
|
@@ -112,8 +141,8 @@ homepage: http://github.com/iterationlabs/reckon
|
|
112
141
|
licenses: []
|
113
142
|
|
114
143
|
post_install_message:
|
115
|
-
rdoc_options:
|
116
|
-
|
144
|
+
rdoc_options: []
|
145
|
+
|
117
146
|
require_paths:
|
118
147
|
- lib
|
119
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/.gitignore
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
pkg
|
20
|
-
|
21
|
-
## PROJECT::SPECIFIC
|
22
|
-
.idea
|
23
|
-
reckon_local
|
24
|
-
private_tests
|