simple-ynab 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/simple-ynab +18 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cabb1f913594c58030b31312b99eb10570e34f87
4
- data.tar.gz: c0b4faa6bbe84ec3245700e6b21ec272d5ae4da6
3
+ metadata.gz: 6b5425edb465bcd4354121d7469a34d63724e521
4
+ data.tar.gz: 851b75538d9ef709d8c637bb2bdfd14245d1529f
5
5
  SHA512:
6
- metadata.gz: 52f14adca756b11609d1d9f3b0d15e1be576a9b2450d76f5a47e1eaa11035c3d93e0c6f50eed606074a5003a54111434c71ab8d2b7669afcb2c4144cd4b36953
7
- data.tar.gz: 8a85367f92eb859bbd2184bf08a63de2f8574d23b6e3e35d7f1743ce140cf38b41975c971636d5de9fc1be014d1430d865bbbb3a021c02ebc108ae0b6b628b73
6
+ metadata.gz: 0447b21fc229ce2f7dcfa2493d96b7544a14e6ed21eb21b3e228628c029206d3fb00be65ed152e20438fdf0db8e57a9ccfb205ea7cf938be2c6750ed58114dac
7
+ data.tar.gz: f5bb2c3996e81ad08b1517d3a9c34b2b3479f3ae5603c9803bd904b3bb801bdf38ff56818ea94c50175319db7be37c16c932d014735ae6682f9cc142af363b14
@@ -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 = ["when_received", "raw_description", "merchant_description", "amount"]
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
- # # 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
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
- simplecsv.each do |row| #Itterate over every row in new 'pending free' array
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.0.0
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.4.6
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