simple-ynab 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/simple-ynab +18 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b5425edb465bcd4354121d7469a34d63724e521
|
4
|
+
data.tar.gz: 851b75538d9ef709d8c637bb2bdfd14245d1529f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0447b21fc229ce2f7dcfa2493d96b7544a14e6ed21eb21b3e228628c029206d3fb00be65ed152e20438fdf0db8e57a9ccfb205ea7cf938be2c6750ed58114dac
|
7
|
+
data.tar.gz: f5bb2c3996e81ad08b1517d3a9c34b2b3479f3ae5603c9803bd904b3bb801bdf38ff56818ea94c50175319db7be37c16c932d014735ae6682f9cc142af363b14
|
data/bin/simple-ynab
CHANGED
@@ -9,13 +9,14 @@ 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
|
12
13
|
on 'v', 'verbose', 'Print debug information', :argument => false
|
13
14
|
on 'x', 'very_verbose', 'Prints an uncomfortable amount of debugging information to terminal, does not replace -v', :argument => false
|
14
15
|
end
|
15
16
|
|
16
17
|
# Which column headers in the Simple CSV match up with the columns headers needed by YNAB
|
17
|
-
simple_keywords = ["
|
18
|
-
ynab_keywords = ["Date", "Payee", "Memo", "Amount"]
|
18
|
+
simple_keywords = ["Date", "Description", "Category", "Memo", "Amount"]
|
19
|
+
ynab_keywords = ["Date", "Payee", "Category", "Memo", "Amount"]
|
19
20
|
|
20
21
|
##### Get the csv file from args
|
21
22
|
ARGV.each do |argument|
|
@@ -41,25 +42,25 @@ simple_headers = simple_keywords.map{ |column| simplecsv[0].index(column)}
|
|
41
42
|
if opts.verbose? then puts "Simple_headers indexes are #{simple_headers}".blue end
|
42
43
|
|
43
44
|
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
#
|
51
|
-
#
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
+
# If -p (Pending) option is not provided, Only push rows with 'false' in the pending column.
|
52
|
+
# Make sure header (row 0) gets included too.
|
53
|
+
if opts.pending? or row[pending].to_s.casecmp('false') == 0 or row[pending].to_s.casecmp('Pending') == 0
|
54
|
+
no_pending_array.push(row)
|
55
|
+
else
|
56
|
+
if opts.verbose? then puts "Removing pending transaction #{row}".yellow end
|
57
|
+
end
|
58
|
+
end
|
58
59
|
|
59
60
|
|
60
61
|
# Create a new array that only includes the YNAB columns
|
61
62
|
ynab_array = Array.new()
|
62
|
-
|
63
|
+
no_pending_array.each do |row| #Itterate over every row in new 'pending free' array
|
63
64
|
newrow = Array.new() #Create a temporary array
|
64
65
|
simple_headers.each do | desired_index | #Itterate over each of the columsn we want e.g. [0, 7, 9, 16, 3]
|
65
66
|
newrow.push(row[desired_index]) #Add the new value to the temporary array
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-ynab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Owen
|
@@ -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.
|
69
|
+
rubygems_version: 2.5.1
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Converts csv from simple format to ynab format
|