simple-ynab 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/simple-ynab +17 -18
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cabb1f913594c58030b31312b99eb10570e34f87
|
4
|
+
data.tar.gz: c0b4faa6bbe84ec3245700e6b21ec272d5ae4da6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f14adca756b11609d1d9f3b0d15e1be576a9b2450d76f5a47e1eaa11035c3d93e0c6f50eed606074a5003a54111434c71ab8d2b7669afcb2c4144cd4b36953
|
7
|
+
data.tar.gz: 8a85367f92eb859bbd2184bf08a63de2f8574d23b6e3e35d7f1743ce140cf38b41975c971636d5de9fc1be014d1430d865bbbb3a021c02ebc108ae0b6b628b73
|
data/bin/simple-ynab
CHANGED
@@ -9,14 +9,13 @@ require 'Date'
|
|
9
9
|
opts = Slop.parse(:banner => 'simple-ynab', :help => true ) do
|
10
10
|
on 'd', 'days=', 'Strips all rows before x days ago, e.g -d 30 ', :argument => true
|
11
11
|
on 'y', 'ynab_date', 'Converts date to MM/DD/YYYY. SEE README.md FOR WARNINGS!!!', :argument => false
|
12
|
-
on 'p', 'pending', 'Include pending transactions', :argument => false
|
13
12
|
on 'v', 'verbose', 'Print debug information', :argument => false
|
14
13
|
on 'x', 'very_verbose', 'Prints an uncomfortable amount of debugging information to terminal, does not replace -v', :argument => false
|
15
14
|
end
|
16
15
|
|
17
16
|
# Which column headers in the Simple CSV match up with the columns headers needed by YNAB
|
18
|
-
simple_keywords = ["
|
19
|
-
ynab_keywords = ["Date", "Payee", "
|
17
|
+
simple_keywords = ["when_received", "raw_description", "merchant_description", "amount"]
|
18
|
+
ynab_keywords = ["Date", "Payee", "Memo", "Amount"]
|
20
19
|
|
21
20
|
##### Get the csv file from args
|
22
21
|
ARGV.each do |argument|
|
@@ -42,25 +41,25 @@ simple_headers = simple_keywords.map{ |column| simplecsv[0].index(column)}
|
|
42
41
|
if opts.verbose? then puts "Simple_headers indexes are #{simple_headers}".blue end
|
43
42
|
|
44
43
|
|
45
|
-
# Create a new array that omits the CSV rows when the value in the 'Pending' column = true
|
46
|
-
if opts.verbose? then puts "Removing pending transactions".magenta end
|
47
|
-
if opts.pending? then puts "User chose to include pending transactions".blue end
|
48
|
-
no_pending_array = Array.new()
|
49
|
-
pending = simplecsv[0].find_index('Pending') # Column number that contains 'Pending'
|
50
|
-
simplecsv.each do |row|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
44
|
+
# # Create a new array that omits the CSV rows when the value in the 'Pending' column = true
|
45
|
+
# if opts.verbose? then puts "Removing pending transactions".magenta end
|
46
|
+
# if opts.pending? then puts "User chose to include pending transactions".blue end
|
47
|
+
# no_pending_array = Array.new()
|
48
|
+
# pending = simplecsv[0].find_index('Pending') # Column number that contains 'Pending'
|
49
|
+
# simplecsv.each do |row|
|
50
|
+
# # If -p (Pending) option is not provided, Only push rows with 'false' in the pending column.
|
51
|
+
# # Make sure header (row 0) gets included too.
|
52
|
+
# if opts.pending? or row[pending].to_s.casecmp('false') == 0 or row[pending].to_s.casecmp('Pending') == 0
|
53
|
+
# no_pending_array.push(row)
|
54
|
+
# else
|
55
|
+
# if opts.verbose? then puts "Removing pending transaction #{row}".yellow end
|
56
|
+
# end
|
57
|
+
# end
|
59
58
|
|
60
59
|
|
61
60
|
# Create a new array that only includes the YNAB columns
|
62
61
|
ynab_array = Array.new()
|
63
|
-
|
62
|
+
simplecsv.each do |row| #Itterate over every row in new 'pending free' array
|
64
63
|
newrow = Array.new() #Create a temporary array
|
65
64
|
simple_headers.each do | desired_index | #Itterate over each of the columsn we want e.g. [0, 7, 9, 16, 3]
|
66
65
|
newrow.push(row[desired_index]) #Add the new value to the temporary array
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-ynab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.4.
|
69
|
+
rubygems_version: 2.4.6
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Converts csv from simple format to ynab format
|