prune-erickson 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/prune-erickson +122 -102
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b58440e742b79b1f8af460a8f642adb48ee2f5f
|
4
|
+
data.tar.gz: 29d4af0e353050a5c0bbd372b35d12373b55ea3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25a37a4daa446f5bd82e7469a8169d5acad6935a853ec46bb199a41fd22beaa251c7bafa83d79f739e008079d8d81313121a4591f81677414cc0f930c4522005
|
7
|
+
data.tar.gz: f183396d625c7a144c688c64689d8b6e4e677d7dff6e8dcc3141580615ce68204256a1d6ea340877689fdf6cb272b38e7cf45dfefc50e68b73863ead2c5cdcd9
|
data/bin/prune-erickson
CHANGED
@@ -38,119 +38,139 @@ if ARGV.length == 1 and ARGV[0] == "help"
|
|
38
38
|
|
39
39
|
prune-erickson [filename.xls (string)] [sheet-number (number)] [output.xls (string)]\n\n\n\n
|
40
40
|
"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
# reads file
|
47
|
-
book = Spreadsheet.open fileName
|
48
|
-
sheet1 = book.worksheet sheetNum
|
41
|
+
elsif ARGV.length == 1 and (ARGV[0] == "-v" or ARGV[0] == "-version" or ARGV[0] == "version")
|
42
|
+
print "\n
|
43
|
+
-------------------
|
44
|
+
| VERSION | 0.0.2 |
|
45
|
+
-------------------
|
49
46
|
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
~~~~~~~THIS SOFTWARE IS IN ACTIVE DEVELOPMENT~~~~~
|
48
|
+
Keep in mind that this project is 0.0.* and is still
|
49
|
+
continuously being updated and user tested.
|
50
|
+
documentation, options and features are subject to change.
|
53
51
|
|
54
|
-
|
52
|
+
Stay tuned for the official release 1.0.0 which could be any
|
53
|
+
day now.
|
54
|
+
"
|
55
|
+
elsif ARGV[0] != "version" or ARGV[0] != "help" or ARGV[0] != '-version' or ARGV[0] != "-v"
|
56
|
+
print "\n
|
57
|
+
Are you trying to use PRUNE?
|
58
|
+
why dont you try this command:\n\n
|
59
|
+
prune-erickson help \n\n\n
|
60
|
+
"
|
61
|
+
else
|
62
|
+
# --------------------------------------------
|
63
|
+
Spreadsheet.client_encoding = 'UTF-8'
|
64
|
+
print "~>reading file you have requested"
|
65
|
+
print "\n"
|
66
|
+
# reads file
|
67
|
+
book = Spreadsheet.open fileName
|
68
|
+
sheet1 = book.worksheet sheetNum
|
55
69
|
|
56
|
-
|
70
|
+
print '\n'
|
71
|
+
newBook = Spreadsheet::Workbook.new
|
72
|
+
newSheet = newBook.create_worksheet
|
57
73
|
|
58
|
-
|
59
|
-
print "\n"
|
60
|
-
sheet1.row(0).each_with_index{|val, index|
|
74
|
+
newSheet.name = "output"
|
61
75
|
|
62
|
-
|
63
|
-
testvar.push(index)
|
64
|
-
end
|
65
|
-
}
|
76
|
+
testvar = Array.new
|
66
77
|
|
67
|
-
|
68
|
-
print "
|
69
|
-
|
78
|
+
print "~>looking for unnecessary information"
|
79
|
+
print "\n"
|
80
|
+
sheet1.row(0).each_with_index{|val, index|
|
70
81
|
|
71
|
-
|
72
|
-
|
73
|
-
print "you are missing the FirstName field\n".upcase
|
74
|
-
end
|
75
|
-
unless sheet1.row(0).include? "LastName"
|
76
|
-
print "you are missing the LastName field\n".upcase
|
77
|
-
end
|
78
|
-
unless sheet1.row(0).include? "Phone"
|
79
|
-
print "you are missing the phone field\n".upcase
|
80
|
-
end
|
81
|
-
unless sheet1.row(0).include? "Address"
|
82
|
-
print "you are missing the Address field\n".upcase
|
83
|
-
end
|
84
|
-
unless sheet1.row(0).include? "City"
|
85
|
-
print "you are missing the City field\n".upcase
|
86
|
-
end
|
87
|
-
unless sheet1.row(0).include? "State"
|
88
|
-
print "you are missing the State field\n".upcase
|
89
|
-
end
|
90
|
-
unless sheet1.row(0).include? "Zipcode"
|
91
|
-
print "you are missing the Zipcode field\n".upcase
|
92
|
-
end
|
93
|
-
unless sheet1.row(0).include? "Address"
|
94
|
-
print "you are missing the Address field\n".upcase
|
95
|
-
end
|
96
|
-
unless sheet1.row(0).include? "Address"
|
97
|
-
print "you are missing the Address field\n".upcase
|
98
|
-
end
|
99
|
-
unless sheet1.row(0).include? "Email"
|
100
|
-
print "you are missing the Email field\n".upcase
|
101
|
-
end
|
102
|
-
# puts testvar
|
103
|
-
newvar = Array.new
|
104
|
-
newvar.push "zero"
|
105
|
-
sheet1.each do |row|
|
106
|
-
row.each_with_index {|val, index|
|
107
|
-
if testvar.include? index
|
108
|
-
|
109
|
-
newvar.push val
|
82
|
+
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"
|
83
|
+
testvar.push(index)
|
110
84
|
end
|
111
85
|
}
|
112
|
-
end
|
113
|
-
print "~~>writing new file \n\n"
|
114
|
-
# print newvar
|
115
|
-
newvar.map! { |x|
|
116
86
|
|
117
|
-
|
118
|
-
print "
|
119
|
-
x = "Community"
|
120
|
-
elsif x == "FirstName"
|
121
|
-
print "renaming field #{x} \n"
|
122
|
-
x = "First Name"
|
123
|
-
elsif x == "LastName"
|
124
|
-
print "renaming field #{x} \n"
|
125
|
-
x = "Last Name"
|
126
|
-
elsif x == "Address"
|
127
|
-
print "renaming field #{x} \n"
|
128
|
-
x = "Address"
|
129
|
-
elsif x == "city"
|
130
|
-
print "renaming field #{x} \n"
|
131
|
-
x = "city"
|
132
|
-
elsif x == "State"
|
133
|
-
print "renaming field #{x} \n"
|
134
|
-
x = "State"
|
135
|
-
elsif x == "Zipcode"
|
136
|
-
print "renaming field #{x} \n"
|
137
|
-
x = "Zipcode"
|
138
|
-
elsif x == "Email"
|
139
|
-
print "renaming field #{x} \n"
|
140
|
-
x = "Email"
|
87
|
+
unless sheet1.row(0).include? "OppCommunity"
|
88
|
+
print "you are missing the OppCommunity field\n".upcase
|
141
89
|
else
|
142
|
-
|
90
|
+
|
91
|
+
end
|
92
|
+
unless sheet1.row(0).include? "FirstName"
|
93
|
+
print "you are missing the FirstName field\n".upcase
|
94
|
+
end
|
95
|
+
unless sheet1.row(0).include? "LastName"
|
96
|
+
print "you are missing the LastName field\n".upcase
|
97
|
+
end
|
98
|
+
unless sheet1.row(0).include? "Phone"
|
99
|
+
print "you are missing the phone field\n".upcase
|
143
100
|
end
|
144
|
-
|
145
|
-
|
146
|
-
for i in 0..newvar.length
|
147
|
-
for j in 1..testvar.length
|
148
|
-
|
149
|
-
|
150
|
-
newSheet.row(i).push newvar[(i*testvar.length)+j]
|
101
|
+
unless sheet1.row(0).include? "Address"
|
102
|
+
print "you are missing the Address field\n".upcase
|
151
103
|
end
|
152
|
-
|
153
|
-
print "
|
154
|
-
|
155
|
-
|
104
|
+
unless sheet1.row(0).include? "City"
|
105
|
+
print "you are missing the City field\n".upcase
|
106
|
+
end
|
107
|
+
unless sheet1.row(0).include? "State"
|
108
|
+
print "you are missing the State field\n".upcase
|
109
|
+
end
|
110
|
+
unless sheet1.row(0).include? "Zipcode"
|
111
|
+
print "you are missing the Zipcode field\n".upcase
|
112
|
+
end
|
113
|
+
unless sheet1.row(0).include? "Address"
|
114
|
+
print "you are missing the Address field\n".upcase
|
115
|
+
end
|
116
|
+
unless sheet1.row(0).include? "Address"
|
117
|
+
print "you are missing the Address field\n".upcase
|
118
|
+
end
|
119
|
+
unless sheet1.row(0).include? "Email"
|
120
|
+
print "you are missing the Email field\n".upcase
|
121
|
+
end
|
122
|
+
# puts testvar
|
123
|
+
newvar = Array.new
|
124
|
+
newvar.push "zero"
|
125
|
+
sheet1.each do |row|
|
126
|
+
row.each_with_index {|val, index|
|
127
|
+
if testvar.include? index
|
128
|
+
|
129
|
+
newvar.push val
|
130
|
+
end
|
131
|
+
}
|
132
|
+
end
|
133
|
+
print "~~>writing new file \n\n"
|
134
|
+
# print newvar
|
135
|
+
newvar.map! { |x|
|
136
|
+
|
137
|
+
if x == "OppCommunity"
|
138
|
+
print "renaming field #{x} \n"
|
139
|
+
x = "Community"
|
140
|
+
elsif x == "FirstName"
|
141
|
+
print "renaming field #{x} \n"
|
142
|
+
x = "First Name"
|
143
|
+
elsif x == "LastName"
|
144
|
+
print "renaming field #{x} \n"
|
145
|
+
x = "Last Name"
|
146
|
+
elsif x == "Address"
|
147
|
+
print "renaming field #{x} \n"
|
148
|
+
x = "Address"
|
149
|
+
elsif x == "city"
|
150
|
+
print "renaming field #{x} \n"
|
151
|
+
x = "city"
|
152
|
+
elsif x == "State"
|
153
|
+
print "renaming field #{x} \n"
|
154
|
+
x = "State"
|
155
|
+
elsif x == "Zipcode"
|
156
|
+
print "renaming field #{x} \n"
|
157
|
+
x = "Zipcode"
|
158
|
+
elsif x == "Email"
|
159
|
+
print "renaming field #{x} \n"
|
160
|
+
x = "Email"
|
161
|
+
else
|
162
|
+
x=x
|
163
|
+
end
|
164
|
+
}
|
165
|
+
# print newvar
|
166
|
+
for i in 0..newvar.length
|
167
|
+
for j in 1..testvar.length
|
168
|
+
|
169
|
+
|
170
|
+
newSheet.row(i).push newvar[(i*testvar.length)+j]
|
171
|
+
end
|
172
|
+
end
|
173
|
+
print "output file is in same file under out.xls to open, use \n \n open #{output}"
|
174
|
+
print "\n"
|
175
|
+
newBook.write output
|
156
176
|
end
|