prune-erickson 0.2.1 → 0.3.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/prune-erickson +445 -327
  3. data/lib/prune-erickson.rb +555 -127
  4. metadata +1 -1
@@ -1,160 +1,588 @@
1
+ #!/usr/bin/env ruby
2
+ require 'roo'
1
3
  require 'spreadsheet'
4
+ require "csv"
5
+ require 'colorize'
6
+ # require 'fileUtils'
2
7
 
3
8
 
4
- class Prune
5
- def self.run(fileName,sheetNum,output)
9
+ # ------------------
10
+ # FUNCTIONS
11
+ # ------------------
6
12
 
7
13
 
8
- # --------------------------------------------
9
- # GRABS INFORMATION FROM COMMAND LINE AND MAKES DATA AVAILABLE FOR PROGRAM
10
- # fileName = ARGV[0]
11
- # sheetNum = ARGV[1].to_i-1
12
- # output = ARGV[2]
13
- if sheetNum > 0
14
- print fileName
15
- print "\n"
16
-
17
- print sheetNum
18
- end
19
- print "\n\n"
20
- # --------------------------------------------
21
- # ASKING FOR HELP
22
- if ARGV.length == 1 and ARGV[0] == "help"
23
- print "
24
- THANK YOU FOR USING PRUNE!! /_(O__O)_/
25
- \n
26
- .. ...
27
- | | / /
28
- | | / /
29
- | | / /
30
- | |/ ;-._
31
- } ` _/ / ;
32
- | /` ) / /
33
- | / /_/_ /| \s
34
- |/ / |
35
- ( ' \ '- |
36
- \ `. /
37
- | |
38
- | | \n\n\n
39
- to edit a file use this format:
40
-
41
- prune-erickson [filename.xls (string)] [sheet-number (number)] [output.xls (string)]\n\n\n\n
42
- "
43
- else
44
- # --------------------------------------------
45
- Spreadsheet.client_encoding = 'UTF-8'
46
- print "~>reading file you have requested"
47
- print "\n"
48
- # reads file
49
- book = Spreadsheet.open fileName
50
- sheet1 = book.worksheet sheetNum
51
-
52
- print '\n'
53
- newBook = Spreadsheet::Workbook.new
54
- newSheet = newBook.create_worksheet
14
+
15
+ def labelChecker (row, testvar)
55
16
 
56
- newSheet.name = "output"
17
+ row.each_with_index{|val, index|
57
18
 
58
- testvar = Array.new
19
+ unless val != "OppCommunity" and val !="FirstName" and val != "LastName" and val != "Address" and val!="City" and val != "State" and val != "Zipcode" and val != "Phone" and val != "Email" and val != "ILorCC"
20
+ testvar.push(index)
21
+ end
22
+ }
23
+ end
59
24
 
60
- print "~>looking for unnecessary information"
61
- print "\n"
62
- sheet1.row(0).each_with_index{|val, index|
25
+ def fieldChecker (row)
26
+ unless row.include? "OppCommunity"
27
+ print "you are missing the OppCommunity field\n".yellow.blink
28
+ else
29
+ end
30
+ unless row.include? "FirstName"
31
+ print "you are missing the FirstName field\n".yellow.blink
32
+ end
33
+ unless row.include? "LastName"
34
+ print "you are missing the LastName field\n".yellow.blink
35
+ end
36
+ unless row.include? "Phone"
37
+ print "you are missing the phone field\n".yellow.blink
38
+ end
39
+ unless row.include? "Address"
40
+ print "you are missing the Address field\n".yellow.blink
41
+ end
42
+ unless row.include? "City"
43
+ print "you are missing the City field\n".yellow.blink
44
+ end
45
+ unless row.include? "State"
46
+ print "you are missing the State field\n".yellow.blink
47
+ end
48
+ unless row.include? "Zipcode"
49
+ print "you are missing the Zipcode field\n".yellow.blink
50
+ end
51
+ unless row.include? "Address"
52
+ print "you are missing the Address field\n".yellow.blink
53
+ end
54
+ unless row.include? "Address"
55
+ print "you are missing the Address field\n".yellow.blink
56
+ end
57
+ unless row.include? "Email"
58
+ print "you are missing the Email field\n".yellow.blink
59
+ end
60
+ end
63
61
 
64
- unless val != "OppCommunity" and val !="FirstName" and val != "LastName" and val != "Address" and val!="City" and val != "State" and val != "Zipcode" and val != "Phone" and val != "Email" and val != "ILorCC"
65
- testvar.push(index)
62
+ def processData (sheet, newvar, testvar)
63
+
64
+ newvar.push "zero"
65
+ sheet.each do |row|
66
+ row.each_with_index {|val, index|
67
+ if testvar.include? index
68
+
69
+ newvar.push val
66
70
  end
67
71
  }
72
+ end
73
+ print "~~>writing new file \n\n"
74
+
75
+ newvar.map! { |x|
68
76
 
69
- unless sheet1.row(0).include? "OppCommunity"
70
- print "you are missing the OppCommunity field\n".upcase
77
+ if x == "OppCommunity"
78
+ print "renaming field #{x} \n".colorize(:light_blue)
79
+ x = "Community of Interest"
80
+ elsif x == "FirstName"
81
+ print "renaming field #{x} \n".colorize(:light_blue)
82
+ x = "First Name"
83
+ elsif x == "LastName"
84
+ print "renaming field #{x} \n".colorize(:light_blue)
85
+ x = "Last Name"
86
+ elsif x == "Address"
87
+ print "renaming field #{x} \n".colorize(:light_blue)
88
+ x = "Address 1"
89
+ elsif x == "city"
90
+ print "renaming field #{x} \n".colorize(:light_blue)
91
+ x = "city"
92
+ elsif x == "State"
93
+ print "renaming field #{x} \n".colorize(:light_blue)
94
+ x = "State or Province"
95
+ elsif x == "Zipcode"
96
+ print "renaming field #{x} \n".colorize(:light_blue)
97
+ x = "Zip or Postal Code"
98
+ elsif x == "Email"
99
+ print "renaming field #{x} \n".colorize(:light_blue)
100
+ x = "Email Address"
101
+ elsif x == "Phone"
102
+ print "renaming field #{x} \n".colorize(:light_blue)
103
+ x = "Home Phone"
71
104
  else
105
+ x=x
106
+ end
107
+ }
108
+ end
72
109
 
110
+ def printFile (newvar, testvar, output, il_or_cc, k=0, l=1,offset=0)
111
+ # print newvar
112
+ newBook = Spreadsheet::Workbook.new
113
+ newSheet = newBook.create_worksheet
114
+ if il_or_cc == ""
115
+ testvar.each do |x|
116
+ newSheet.row(0).push x
73
117
  end
74
- unless sheet1.row(0).include? "FirstName"
75
- print "you are missing the FirstName field\n".upcase
118
+ end
119
+ for i in k..newvar.length
120
+ for j in l..testvar.length-1
121
+ newSheet.row(i+offset).push newvar[(i*testvar.length)+j]
76
122
  end
77
- unless sheet1.row(0).include? "LastName"
78
- print "you are missing the LastName field\n".upcase
123
+ if il_or_cc != ""
124
+ if i > 0
125
+ newSheet.row(i).push "#{il_or_cc}"
126
+
127
+ else
128
+ newSheet.row(i).push "ILorCC"
129
+ end
79
130
  end
80
- unless sheet1.row(0).include? "Phone"
81
- print "you are missing the phone field\n".upcase
131
+ end
132
+ print "output file is in same file under out.xls to open, use \n \n open #{output}"
133
+ print "\n"
134
+ newBook.write output
135
+ end
136
+
137
+ def com_separated_files (output)
138
+ puts output
139
+ labels = Array.new
140
+ apl_array = Array.new
141
+ ach_array = Array.new
142
+ bbv_array = Array.new
143
+ ccv_array = Array.new
144
+ cci_array = Array.new
145
+ dvf_array = Array.new
146
+ eth_array = Array.new
147
+ frv_array = Array.new
148
+ gsv_array = Array.new
149
+ hsd_array = Array.new
150
+ lhn_array = Array.new
151
+ lph_array = Array.new
152
+ mgc_array = Array.new
153
+ ocv_array = Array.new
154
+ rwv_array = Array.new
155
+ sbv_array = Array.new
156
+ tck_array = Array.new
157
+ wcd_array = Array.new
158
+
159
+ original = Spreadsheet.open(output)
160
+ original_sheet = original.worksheet(0)
161
+
162
+
163
+ rowlength = original_sheet.row(0)
164
+ puts rowlength.length
165
+ # make a directory for the new files
166
+ unless File.directory?("com_separated_files")
167
+ %x(mkdir com_separated_files)
168
+ end
169
+ original_sheet.each do |row|
170
+ if row[0] == "apl".upcase
171
+
172
+ # print row to other array and print label to a community array
173
+ row.each do |x|
174
+ apl_array.push x
175
+ end
176
+ unless labels.include?("apl".upcase)
177
+ labels.push "apl".upcase
178
+ end
82
179
  end
83
- unless sheet1.row(0).include? "Address"
84
- print "you are missing the Address field\n".upcase
180
+ if row[0] == "ach".upcase
181
+
182
+ # print row to other array and print label to a community array
183
+ row.each do |x|
184
+ ach_array.push x
185
+ end
186
+ unless labels.include?("ach".upcase)
187
+ labels.push "ach".upcase
188
+ end
85
189
  end
86
- unless sheet1.row(0).include? "City"
87
- print "you are missing the City field\n".upcase
190
+ if row[0] == "bbv".upcase
191
+
192
+ # print row to other array and print label to a community array
193
+ row.each do |x|
194
+ bbv_array.push x
195
+ end
196
+ unless labels.include?("bbv".upcase)
197
+ labels.push "bbv".upcase
198
+ end
88
199
  end
89
- unless sheet1.row(0).include? "State"
90
- print "you are missing the State field\n".upcase
200
+ if row[0] == "ccv".upcase
201
+
202
+ # print row to other array and print label to a community array
203
+ row.each do |x|
204
+ ccv_array.push x
205
+ end
206
+ unless labels.include?("ccv".upcase)
207
+ labels.push "ccv".upcase
208
+ end
91
209
  end
92
- unless sheet1.row(0).include? "Zipcode"
93
- print "you are missing the Zipcode field\n".upcase
210
+ if row[0] == "cci".upcase
211
+
212
+ # print row to other array and print label to a community array
213
+ row.each do |x|
214
+ cci_array.push x
215
+ end
216
+ unless labels.include?("cci".upcase)
217
+ labels.push "cci".upcase
218
+ end
94
219
  end
95
- unless sheet1.row(0).include? "Address"
96
- print "you are missing the Address field\n".upcase
220
+ if row[0] == "dvf".upcase
221
+
222
+ # print row to other array and print label to a community array
223
+ row.each do |x|
224
+ dvf_array.push x
225
+ end
226
+ unless labels.include?("dvf".upcase)
227
+ labels.push "dvf".upcase
228
+ end
97
229
  end
98
- unless sheet1.row(0).include? "Address"
99
- print "you are missing the Address field\n".upcase
230
+ if row[0] == "eth".upcase
231
+
232
+ # print row to other array and print label to a community array
233
+ row.each do |x|
234
+ eth_array.push x
235
+ end
236
+ unless labels.include?("eth".upcase)
237
+ labels.push "eth".upcase
238
+ end
100
239
  end
101
- unless sheet1.row(0).include? "Email"
102
- print "you are missing the Email field\n".upcase
240
+ if row[0] == "frv".upcase
241
+
242
+ # print row to other array and print label to a community array
243
+ row.each do |x|
244
+ frv_array.push x
245
+ end
246
+ unless labels.include?("frv".upcase)
247
+ labels.push "frv".upcase
248
+ end
103
249
  end
104
- # puts testvar
105
- newvar = Array.new
106
- newvar.push "zero"
107
- sheet1.each do |row|
108
- row.each_with_index {|val, index|
109
- if testvar.include? index
110
-
111
- newvar.push val
112
- end
113
- }
114
- end
115
- print "~~>writing new file \n\n"
116
- # print newvar
117
- newvar.map! { |x|
118
-
119
- if x == "OppCommunity"
120
- print "renaming field #{x} \n"
121
- x = "Community"
122
- elsif x == "FirstName"
123
- print "renaming field #{x} \n"
124
- x = "First Name"
125
- elsif x == "LastName"
126
- print "renaming field #{x} \n"
127
- x = "Last Name"
128
- elsif x == "Address"
129
- print "renaming field #{x} \n"
130
- x = "Address"
131
- elsif x == "city"
132
- print "renaming field #{x} \n"
133
- x = "city"
134
- elsif x == "State"
135
- print "renaming field #{x} \n"
136
- x = "State"
137
- elsif x == "Zipcode"
138
- print "renaming field #{x} \n"
139
- x = "Zipcode"
140
- elsif x == "Email"
141
- print "renaming field #{x} \n"
142
- x = "Email"
143
- else
144
- x=x
250
+ if row[0] == "gsv".upcase
251
+
252
+ # print row to other array and print label to a community array
253
+ row.each do |x|
254
+ gsv_array.push x
145
255
  end
146
- }
147
- # print newvar
148
- for i in 0..newvar.length
149
- for j in 1..testvar.length
150
-
256
+ unless labels.include?("gsv".upcase)
257
+ labels.push "gsv".upcase
258
+ end
259
+ end
260
+ if row[0] == "hsd".upcase
261
+
262
+ # print row to other array and print label to a community array
263
+ row.each do |x|
264
+ hsd_array.push x
265
+ end
266
+ unless labels.include?("hsd".upcase)
267
+ labels.push "hsd".upcase
268
+ end
269
+ end
270
+ if row[0] == "lhn".upcase
271
+
272
+ # print row to other array and print label to a community array
273
+ row.each do |x|
274
+ lhn_array.push x
275
+ end
276
+ unless labels.include?("lhn".upcase)
277
+ labels.push "lhn".upcase
278
+ end
279
+ end
280
+ if row[0] == "lph".upcase
281
+
282
+ # print row to other array and print label to a community array
283
+ row.each do |x|
284
+ lph_array.push x
285
+ end
286
+ unless labels.include?("lph".upcase)
287
+ labels.push "lph".upcase
288
+ end
289
+ end
290
+ if row[0] == "mgc".upcase
291
+
292
+ # print row to other array and print label to a community array
293
+ row.each do |x|
294
+ mgc_array.push x
295
+ end
296
+ unless labels.include?("mgc".upcase)
297
+ labels.push "mgc".upcase
298
+ end
299
+ end
300
+ if row[0] == "ocv".upcase
301
+
302
+ # print row to other array and print label to a community array
303
+ row.each do |x|
304
+ ocv_array.push x
305
+ end
306
+ unless labels.include?("ocv".upcase)
307
+ labels.push "ocv".upcase
308
+ end
309
+ end
310
+ if row[0] == "rwv".upcase
311
+
312
+ # print row to other array and print label to a community array
313
+ row.each do |x|
314
+ rwv_array.push x
315
+ end
316
+ unless labels.include?("rwv".upcase)
317
+ labels.push "rwv".upcase
318
+ end
319
+ end
320
+ if row[0] == "sbv".upcase
321
+
322
+ # print row to other array and print label to a community array
323
+ row.each do |x|
324
+ sbv_array.push x
325
+ end
326
+ unless labels.include?("sbv".upcase)
327
+ labels.push "sbv".upcase
328
+ end
329
+ end
330
+ if row[0] == "tck".upcase
331
+
332
+ # print row to other array and print label to a community array
333
+ row.each do |x|
334
+ tck_array.push x
335
+ end
336
+ unless labels.include?("tck".upcase)
337
+ labels.push "tck".upcase
338
+ end
339
+ end
340
+ if row[0] == "wcd".upcase
151
341
 
152
- newSheet.row(i).push newvar[(i*testvar.length)+j]
342
+ # print row to other array and print label to a community array
343
+ row.each do |x|
344
+ wcd_array.push x
345
+ end
346
+ unless labels.include?("wcd".upcase)
347
+ labels.push "wcd".upcase
153
348
  end
154
349
  end
155
- print "output file is in same file under out.xls to open, use \n \n open #{output}"
350
+ end
351
+ print "creating files for these communities:\n".blue
352
+ puts "#{labels}".blue
353
+ print rowlength
354
+ if apl_array.length > 0
355
+ printFile(apl_array, rowlength, "com_separated_files/apl.xls", "", 0, 0,1)
356
+ end
357
+ if ach_array.length > 0
358
+ printFile(ach_array, rowlength, "com_separated_files/ach.xls", "", 0, 0,1)
359
+ end
360
+ if bbv_array.length > 0
361
+ printFile(bbv_array, rowlength, "com_separated_files/bbv.xls", "", 0, 0,1)
362
+ end
363
+ if ccv_array.length > 0
364
+ printFile(ccv_array, rowlength, "com_separated_files/ccv.xls", "", 0, 0,1)
365
+ end
366
+ if cci_array.length > 0
367
+ printFile(cci_array, rowlength, "com_separated_files/cci.xls", "", 0, 0,1)
368
+ end
369
+ if dvf_array.length > 0
370
+ printFile(dvf_array, rowlength, "com_separated_files/dvf.xls", "", 0, 0,1)
371
+ end
372
+ if eth_array.length > 0
373
+ printFile(eth_array, rowlength, "com_separated_files/eth.xls", "", 0, 0,1)
374
+ end
375
+ if frv_array.length > 0
376
+ printFile(frv_array, rowlength, "com_separated_files/frv.xls", "", 0, 0,1)
377
+ end
378
+ if gsv_array.length > 0
379
+ printFile(gsv_array, rowlength, "com_separated_files/gsv.xls", "", 0, 0,1)
380
+ end
381
+ if hsd_array.length > 0
382
+ printFile(hsd_array, rowlength, "com_separated_files/hsd.xls", "", 0, 0,1)
383
+ end
384
+ if lhn_array.length > 0
385
+ printFile(lhn_array, rowlength, "com_separated_files/lhn.xls", "", 0, 0,1)
386
+ end
387
+ if lph_array.length > 0
388
+ printFile(lph_array, rowlength, "com_separated_files/lph.xls", "", 0, 0,1)
389
+ end
390
+ if mgc_array.length > 0
391
+ printFile(mgc_array, rowlength, "com_separated_files/mgc.xls", "", 0, 0,1)
392
+ end
393
+ if ocv_array.length > 0
394
+ printFile(ocv_array, rowlength, "com_separated_files/ocv.xls", "", 0, 0,1)
395
+ end
396
+ if rwv_array.length > 0
397
+ printFile(rwv_array, rowlength, "com_separated_files/rwv.xls", "", 0, 0,1)
398
+ end
399
+ if sbv_array.length > 0
400
+ printFile(sbv_array, rowlength, "com_separated_files/sbv.xls", "", 0, 0,1)
401
+ end
402
+ if tck_array.length > 0
403
+ printFile(tck_array, rowlength, "com_separated_files/tck.xls", "", 0, 0,1)
404
+ end
405
+ if wcd_array.length > 0
406
+ printFile(wcd_array, rowlength, "com_separated_files/wcd.xls", "", 0, 0,1)
407
+ end
408
+
409
+
410
+ end
411
+
412
+ # --------------------------------------------
413
+ # GRABS INFORMATION FROM COMMAND LINE AND MAKES DATA AVAILABLE FOR PROGRAM
414
+ fileName = ARGV[0]
415
+ sheetNum = ARGV[1].to_i-1
416
+ output = ARGV[2]
417
+ print "\n\n"
418
+ print "Is this an email campaign for Continuing Care? (CC) [y/n]".yellow
419
+
420
+ res = STDIN.gets.strip
421
+ print "\n\n"
422
+ if res == 'y' || res == 'Y'
423
+ il_or_cc = 'CC'
424
+ else
425
+ il_or_cc = "IL"
426
+ end
427
+ print "Do you wish to create separate files based on community names?[y/n]".yellow
428
+ comres= STDIN.gets.strip
429
+
430
+ # --------------------------------------------
431
+ # ASKING FOR HELP
432
+ if ARGV.length == 1 and ARGV[0] == "help"
433
+ print "
434
+ THANK YOU FOR USING PRUNE!! /_(O__O)_/"
435
+ print "
436
+ \n
437
+ .. ...
438
+ | | / /
439
+ | | / /
440
+ | | / /
441
+ | |/ ;-._
442
+ } ` _/ / ;
443
+ | /` ) / /
444
+ | / /_/_ /| \s
445
+ |/ / |
446
+ ( ' \ '- |
447
+ \ `. /
448
+ | |
449
+ | | \n\n\n".colorize(:light_blue)
450
+ puts "to edit a file use this format:"
451
+ puts "FOR .xls \n".yellow
452
+
453
+ puts "prune-erickson [filename.xls (string)] [sheet-number (number)] [output.xls (string)]\n\n\n"
454
+ puts "FOR .csv \n".yellow
455
+ puts "prune-erickson [filename.csv (string)] [output.xls (string)]\n\n\n"
456
+ puts "Make sure to cd into your correct directory where the file is located.
457
+ the output file will be in the same directory \n\n\n".yellow
458
+ elsif ARGV.length == 1 and (ARGV[0] == "-v" or ARGV[0] == "-version" or ARGV[0] == "version")
459
+ print "\n
460
+ -------------------
461
+ | VERSION | 0.2.1 |
462
+ -------------------
463
+ "
464
+ print "
465
+ ~~~~~~~THIS SOFTWARE IS IN ACTIVE DEVELOPMENT~~~~~
466
+ Keep in mind that this project is 0.0.* and is still
467
+ continuously being updated and user tested.
468
+ documentation, options and features are subject to change.
469
+
470
+ Stay tuned for the official release 1.0.0 which could be any
471
+ day now.
472
+ ".yellow
473
+ # --------------------------------------------
474
+ # if the user input has to do with the help or version options this code is run
475
+ elsif ARGV.length == 1 and ARGV[0] != "version" or ARGV[0] != "help" or ARGV[0] != '-version' or ARGV[0] != "-v"
476
+ # line 68 catches any user input that relates to .xls files in the form of
477
+ # prune-erickson yourfile.xls [digit] outputfile.xls
478
+ if ARGV[0] =~ /\S+.xls\b/ and ARGV[1] =~ /\d/ and ARGV[2] =~ /\S+.xls\b/
479
+
480
+ Spreadsheet.client_encoding = 'UTF-8'
481
+ print "~>reading file you have requested"
156
482
  print "\n"
157
- newBook.write output
483
+ # --------------------------------------------
484
+ # reads file
485
+ #checking if the file is not nil and then creating a new workbook to copy necessary info into.
486
+ if File.exist?(fileName.to_s)
487
+ book = Spreadsheet.open fileName
488
+ sheet1 = book.worksheet sheetNum
489
+ newBook = Spreadsheet::Workbook.new
490
+ newSheet = newBook.create_worksheet
491
+
492
+ newSheet.name = "output"
493
+ testvar = Array.new
494
+ newvar = Array.new
495
+ print "~>looking for unnecessary information"
496
+ print "\n"
497
+ if sheet1 == nil
498
+ print "\n
499
+ (_(T__T)_/ \n\n
500
+ this sheet seems to be empty...
501
+ are you selecting the wrong one? \n".red
502
+ else
503
+ labelChecker(sheet1.row(0), testvar)
504
+ fieldChecker(sheet1.row(0))
505
+ processData(sheet1, newvar, testvar)
506
+ printFile(newvar, testvar, output, il_or_cc)
507
+ if comres == 'y' || comres == 'Y'
508
+ com_separated_files(output)
509
+ end
510
+ end
511
+ else
512
+ print "\n\n
513
+ WHOOPS!!!
514
+
515
+ It looks like this file is in the wrong folder or does not exsist.
516
+ try locating the folder and inputing the correct path\n\n".red
517
+ end
518
+ elsif ARGV[0] =~ /\S+[.csv*]/ and ARGV[1] =~ /\S+.xls\b/
519
+ output = ARGV[1]
520
+ if File.exist?(fileName)
521
+ file_data = CSV.read(fileName)
522
+ newBook = Spreadsheet::Workbook.new
523
+ newSheet = newBook.create_worksheet
524
+
525
+ newSheet.name = "output"
526
+
527
+ testvar = Array.new
528
+ newvar = Array.new
529
+ print "~>looking for unnecessary information"
530
+ print "\n"
531
+
532
+ labelChecker(file_data[0], testvar)
533
+ fieldChecker(file_data[0])
534
+ processData(file_data, newvar, testvar)
535
+ printFile(newvar, testvar, output, il_or_cc)
536
+ if comres == 'y' || comres == 'Y'
537
+ com_separated_files(output)
538
+ end
539
+ else
540
+ print "\n\n
541
+ WHOOPS!!!
542
+
543
+ It looks like this file is in the wrong folder or does not exsist.
544
+ try locating the folder and inputing the correct path\n\n".red
545
+ end
546
+ elsif fileName =~ /\S+.xlsx/ and ARGV[1] =~ /\d/ and ARGV[2] =~ /\S+.xls\b/
547
+
548
+ unless File.exist?(fileName)
549
+ print "\n\n
550
+ WHOOPS!!!
551
+
552
+ It looks like this file is in the wrong folder or does not exsist.
553
+ try locating the folder and inputing the correct path\n\n".red
554
+ else
555
+
556
+ xlsx = Roo::Spreadsheet.open(fileName)
557
+ newBook = Spreadsheet::Workbook.new
558
+ newSheet = newBook.create_worksheet
559
+ xlsxSheet = xlsx.sheet(sheetNum)
560
+ if xlsxSheet == nil
561
+ print "\n
562
+ (_(T__T)_/ \n\n
563
+ this sheet seems to be empty...
564
+ are you selecting the wrong one? \n".red
565
+ else
566
+ newSheet.name = "output"
567
+ header = xlsx.sheet(sheetNum).row(1)
568
+ # take first row, and loop through the items in the array
569
+ # sort indexes that are not necessary in the array
570
+ testvar = Array.new
571
+ newvar = Array.new
572
+ labelChecker(header, testvar)
573
+ fieldChecker(header)
574
+ processData(xlsxSheet, newvar, testvar)
575
+ printFile(newvar, testvar, output, il_or_cc)
576
+ if comres == 'y' || comres == 'Y'
577
+ com_separated_files(output)
578
+ end
579
+ end
158
580
  end
581
+ else
582
+ print "\n
583
+ Are you trying to use PRUNE?
584
+ why dont you try this command:\n\n
585
+ prune-erickson help \n\n\n
586
+ "
159
587
  end
160
588
  end