reckon 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ reckon
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p392
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ script: "bundle exec rake"
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rake'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.3.4)
4
+ reckon (0.3.6)
5
5
  chronic (>= 0.3.0)
6
6
  fastercsv (>= 1.5.1)
7
7
  highline (>= 1.5.2)
@@ -10,10 +10,11 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- chronic (0.9.0)
13
+ chronic (0.9.1)
14
14
  diff-lcs (1.1.3)
15
15
  fastercsv (1.5.5)
16
- highline (1.6.15)
16
+ highline (1.6.18)
17
+ rake (10.0.4)
17
18
  rspec (2.11.0)
18
19
  rspec-core (~> 2.11.0)
19
20
  rspec-expectations (~> 2.11.0)
@@ -28,5 +29,6 @@ PLATFORMS
28
29
  ruby
29
30
 
30
31
  DEPENDENCIES
32
+ rake
31
33
  reckon!
32
34
  rspec (>= 1.2.9)
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Reckon
2
2
 
3
+ [![Build Status](https://travis-ci.org/cantino/reckon.png)](https://travis-ci.org/cantino/reckon)
4
+
3
5
  Reckon automagically converts CSV files for use with the command-line accounting tool [Ledger](https://github.com/jwiegley/ledger/wiki). It also helps you to select the correct accounts associated with the CSV data using Bayesian machine learning.
4
6
 
5
7
  ## Installation
data/lib/reckon.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- if RUBY_VERSION =~ /^1\.9/
4
+ if RUBY_VERSION =~ /^1\.9/ || RUBY_VERSION =~ /^2/
5
5
  require 'csv'
6
6
  else
7
7
  require 'fastercsv'
data/lib/reckon/app.rb CHANGED
@@ -176,6 +176,7 @@ module Reckon
176
176
  value = [$1, $2, $3].join("/") if value =~ /^(\d{4})(\d{2})(\d{2})\d+\[\d+\:GMT\]$/ # chase format
177
177
  value = [$3, $2, $1].join("/") if value =~ /^(\d{2})\.(\d{2})\.(\d{4})$/ # german format
178
178
  value = [$3, $2, $1].join("/") if value =~ /^(\d{2})\-(\d{2})\-(\d{4})$/ # nordea format
179
+ value = [$1, $2, $3].join("/") if value =~ /^(\d{4})(\d{2})(\d{2})/ # yyyymmdd format
179
180
  begin
180
181
  guess = Chronic.parse(value, :context => :past)
181
182
  if guess.to_i < 953236800 && value =~ /\//
data/reckon.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{reckon}
6
- s.version = "0.3.5"
6
+ s.version = "0.3.6"
7
7
  s.authors = ["Andrew Cantino"]
8
8
  s.email = %q{andrew@iterationlabs.com}
9
9
  s.homepage = %q{https://github.com/cantino/reckon}
@@ -14,6 +14,7 @@ describe Reckon::App do
14
14
  @simple_csv = Reckon::App.new(:string => SIMPLE_CSV)
15
15
  @german_date = Reckon::App.new(:string => GERMAN_DATE_EXAMPLE)
16
16
  @danish_kroner_nordea = Reckon::App.new(:string => DANISH_KRONER_NORDEA_EXAMPLE, :csv_separator => ';', :comma_separates_cents => true)
17
+ @yyyymmdd_date = Reckon::App.new(:string => YYYYMMDD_DATE_EXAMPLE)
17
18
  end
18
19
 
19
20
  it "should be in testing mode" do
@@ -57,6 +58,7 @@ describe Reckon::App do
57
58
  @two_money_columns.money_column_indices.should == [3, 4]
58
59
  @harder_date_example_csv.money_column_indices.should == [1]
59
60
  @danish_kroner_nordea.money_column_indices.should == [3]
61
+ @yyyymmdd_date.money_column_indices.should == [3]
60
62
  end
61
63
 
62
64
  it "should detect the date column" do
@@ -65,6 +67,7 @@ describe Reckon::App do
65
67
  @two_money_columns.date_column_index.should == 0
66
68
  @harder_date_example_csv.date_column_index.should == 0
67
69
  @danish_kroner_nordea.date_column_index.should == 0
70
+ @yyyymmdd_date.date_column_index.should == 1
68
71
  end
69
72
 
70
73
  it "should consider all other columns to be description columns" do
@@ -73,6 +76,7 @@ describe Reckon::App do
73
76
  @two_money_columns.description_column_indices.should == [1, 2, 5]
74
77
  @harder_date_example_csv.description_column_indices.should == [2, 3, 4, 5, 6, 7]
75
78
  @danish_kroner_nordea.description_column_indices.should == [1, 2, 4]
79
+ @yyyymmdd_date.description_column_indices.should == [0, 2]
76
80
  end
77
81
  end
78
82
 
@@ -103,6 +107,7 @@ describe Reckon::App do
103
107
  @danish_kroner_nordea.money_for(3).should == -995.00
104
108
  @danish_kroner_nordea.money_for(4).should == -3452.90
105
109
  @danish_kroner_nordea.money_for(5).should == -655.00
110
+ @yyyymmdd_date.money_for(0).should == -123.45
106
111
  end
107
112
 
108
113
  it "should handle the comma_separates_cents option correctly" do
@@ -132,6 +137,9 @@ describe Reckon::App do
132
137
  @danish_kroner_nordea.date_for(0).year.should == Time.parse("2012/11/16").year
133
138
  @danish_kroner_nordea.date_for(0).month.should == Time.parse("2012/11/16").month
134
139
  @danish_kroner_nordea.date_for(0).day.should == Time.parse("2012/11/16").day
140
+ @yyyymmdd_date.date_for(0).year.should == Time.parse("2012/12/31").year
141
+ @yyyymmdd_date.date_for(0).month.should == Time.parse("2012/12/31").month
142
+ @yyyymmdd_date.date_for(0).day.should == Time.parse("2012/12/31").day
135
143
  end
136
144
  end
137
145
 
@@ -240,4 +248,8 @@ describe Reckon::App do
240
248
  27-08-2012;Dankort-nota MATAS - 20319 18230;27-08-2012;-655,00;21127,45
241
249
  CSV
242
250
 
251
+ YYYYMMDD_DATE_EXAMPLE = (<<-CSV).strip
252
+ DEBIT,20121231,"ODESK***BAL-27DEC12 650-12345 CA 12/28",-123.45
253
+ CSV
254
+
243
255
  end
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.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-24 00:00:00.000000000 Z
12
+ date: 2013-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -102,7 +102,9 @@ extra_rdoc_files: []
102
102
  files:
103
103
  - .document
104
104
  - .gitignore
105
- - .rvmrc
105
+ - .ruby-gemset
106
+ - .ruby-version
107
+ - .travis.yml
106
108
  - CHANGES.md
107
109
  - Gemfile
108
110
  - Gemfile.lock
@@ -132,12 +134,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
134
  - - ! '>='
133
135
  - !ruby/object:Gem::Version
134
136
  version: '0'
137
+ segments:
138
+ - 0
139
+ hash: 3416374461755206032
135
140
  required_rubygems_version: !ruby/object:Gem::Requirement
136
141
  none: false
137
142
  requirements:
138
143
  - - ! '>='
139
144
  - !ruby/object:Gem::Version
140
145
  version: '0'
146
+ segments:
147
+ - 0
148
+ hash: 3416374461755206032
141
149
  requirements: []
142
150
  rubyforge_project:
143
151
  rubygems_version: 1.8.25
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.3@reckon --create