auto-print 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/auto-print +122 -26
  3. data/lib/auto-print.rb +121 -25
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfa12db539878c55d00f42b6fdd44ed0918c9fd7
4
- data.tar.gz: d3a1617c5f6c6aaf8fb3ac0d76f960cfb634d93e
3
+ metadata.gz: c5aef95d69a946760da06e9650ba5782c6bf4361
4
+ data.tar.gz: 561857a7ebced312a7bac4782ce8532319d163ea
5
5
  SHA512:
6
- metadata.gz: d8ac04a388347f44028b1ea8f6fbd45771566fbaf997644d8e070d8114e7976820a18f1d0e33dde1cc67fa2440b41a0cac002202b9165c10419be726efe28e1f
7
- data.tar.gz: 888cb81a0b24546252311a4c3dce994b679d76afd878b85e16bb55ce042da3fe23c5e56a9072e07858ebb56d0e97d1536d6bb93c8f48279c3fbdbb2fa310bebc
6
+ metadata.gz: 7fa6e39464cfcdd334793b09ab995e45ae73366d77ff40ef334f096fb43ba55921ff0b6a3abd19468e422bf6a468f02b097f2dee335703cb160b53bbabda9917
7
+ data.tar.gz: 40512edb6c7beac8c91ba548f5b2c91176cd43d74a0511bde70d3e0ae8a06f765eaf147024fa244f74510b5ecf583b498ab33c987f0161bb197007757c1e760a
@@ -10,12 +10,7 @@ require 'colorize'
10
10
  url = ARGV[0]
11
11
  puts url
12
12
  com_codes = ['apl', 'ach', 'bbv', 'ccv', 'cci', 'cwf', 'dvf', 'eth', 'frv', 'gsv', 'hsd', 'lhn', 'lph', 'mgc', 'ocv', 'rwv', 'sbv', 'tck', 'wcd']
13
- size = {
14
- 'medium' => 1200,
15
- 'small' =>992,
16
- 'xsmall' => 768,
17
- 'mobile' => 400
18
- }
13
+
19
14
 
20
15
 
21
16
 
@@ -59,7 +54,7 @@ elsif ARGV.length == 1 and (ARGV[0] == "-v" or ARGV[0] == "-version" or ARGV[0]
59
54
 
60
55
  puts "
61
56
  __________________________
62
- | VERSION 0.1.0 |
57
+ | VERSION 0.2.0 |
63
58
  --------------------------
64
59
  ".colorize(:yellow)
65
60
  puts " the use of this program is open source, but intended for the needs of Erickson Living employees only. if you wish to make a pull request you may do so at \n\n".yellow
@@ -70,28 +65,129 @@ elsif ARGV.length == 1 and (ARGV[0] == "-v" or ARGV[0] == "-version" or ARGV[0]
70
65
  elsif ARGV.length == 1 and ARGV[0] != "version" or ARGV[0] != "help" or ARGV[0] != '-version' or ARGV[0] != "-v"
71
66
  # line 68 catches any user input that relates to .xls files in the form of
72
67
  # prune-erickson yourfile.xls [digit] outputfile.xls
73
- if ARGV[0] =~ /(http)+[\S]*/
74
- puts "program"
75
- driver = Selenium::WebDriver.for :firefox
76
- com_codes.each do |com|
77
- driver.navigate.to "#{url}"+"?from="+"#{com}".upcase
78
- driver.save_screenshot("#{com}".upcase+".png")
79
- puts "#{com}".upcase
68
+
69
+ def url_question(url, com_codes)
70
+ puts "\n\n"
71
+ puts "Do you wish to screenshot of".yellow
72
+ puts " #{url} ".red
73
+ print "without additional versioning? [Y/N/X]\n\n".yellow
74
+ puts "you can exit this form at any time by pressing the X key on your keyboard".upcase.yellow
75
+
76
+ versioningResponse = STDIN.gets.strip.upcase
77
+ print "\n\n"
78
+
79
+ if versioningResponse == 'Y'
80
+ puts "what do you wish to name the file?".green
81
+ name = STDIN.gets.strip.upcase
82
+ screenshot(name, url)
83
+ elsif versioningResponse =='X'
84
+ puts "exiting sequence"
85
+ else
86
+ version_question(url, com_codes)
87
+ end
88
+ end
89
+ def version_question(url, com_codes)
90
+ puts "\n\n"
91
+ puts "Is this campaign versioned? [Y/N/X]".yellow
92
+ # puts "you can exit this form at any time by pressing the X key on your keyboard".yellow
93
+
94
+ campaignResponse = STDIN.gets.strip.upcase
95
+ print "\n\n"
96
+
97
+ if campaignResponse =='Y'
98
+ email_question( url, com_codes)
99
+ else
100
+ puts "which community do you wish to print please insert a 3 letter com code".yellow
101
+ com = STDIN.gets.strip.upcase
102
+ email_question(url, com_codes, com)
103
+ end
104
+ end
105
+
106
+ def email_question(url, com_codes, com = '')
107
+ puts "are these emails?[Y/N/X]".yellow
108
+ emailResponse = STDIN.gets.strip.upcase
109
+ print"\n\n"
110
+ if emailResponse == 'Y'
111
+ puts "is this a landing page connected to the email?".yellow
112
+ emailLPresponse = STDIN.gets.strip.upcase
113
+ print "\n\n"
114
+ end
115
+
116
+ unless com.length < 3
117
+ com_codes = ["#{com}"]
80
118
  end
81
119
 
82
- size.each do |key, number|
83
- driver.navigate.to "#{url}"
84
- puts key
85
- driver.manage.window.resize_to(number-50,800)
86
- driver.save_screenshot("#{number}".upcase+".png")
120
+ if emailResponse == 'Y'
121
+
122
+ if emailLPresponse == 'Y'
123
+ LP_email_screenshot(url, com_codes)
124
+ else
125
+ email_screenshot(url, com_codes)
126
+ end
127
+ elsif emailResponse == 'N'
128
+ LP_screenshot(url, com_codes)
129
+ else
130
+ print "exiting sequence".red
87
131
  end
132
+ end
133
+
134
+ def screenshot(name, url=ARGV[0])
135
+ driver = Selenium::WebDriver.for :firefox
136
+ driver.navigate.to url
137
+ driver.save_screenshot("#{name}"+".png")
138
+ end
139
+
140
+ def LP_email_screenshot(url, com_codes)
141
+ # if url =~ /(http)+[\S]*/
142
+ puts "printing versioned landing pages for the followign communities".blink
143
+ driver = Selenium::WebDriver.for :firefox
144
+ com_codes.each do |com|
145
+ # printing email CS
146
+ driver.navigate.to "#{url}"+"?from="+"#{com}-email".upcase
147
+ driver.save_screenshot("#{com}".upcase+"-email.png")
148
+ print "#{com}-EMAIL ".upcase
149
+ end
150
+ # end
151
+ end
152
+ def LP_screenshot(url, com_codes)
153
+ # if url =~ /(http)+[\S]*/
88
154
 
155
+ puts "printing versioned emails for the following communities".blink
156
+ driver = Selenium::WebDriver.for :firefox
157
+ com_codes.each do |com|
158
+ # landing pages
159
+ driver.navigate.to "#{url}"+"?from="+"#{com}".upcase
160
+ driver.save_screenshot("#{com}".upcase+".png")
161
+ print "#{com} ".upcase
162
+ end
163
+ # end
164
+ end
165
+ def email_screenshot(url, com_codes)
166
+ # if url =~ /(http)+[\S]*/
89
167
 
90
- else
91
- print "\n
92
- Are you trying to use auto-print?
93
- why dont you try this command:\n\n
94
- auto-print help \n\n\n
95
- "
168
+ puts "printing versioned emails for the following communities".blink
169
+ driver = Selenium::WebDriver.for :firefox
170
+ com_codes.each do |com|
171
+ # landing pages
172
+ driver.navigate.to "#{url}"+"#{com}".upcase+"_email.html"
173
+ driver.save_screenshot("#{com}".upcase+".png")
174
+ print "#{com} ".upcase
175
+ end
176
+ # end
96
177
  end
97
- end
178
+ url_question(url, com_codes)
179
+ # size.each do |key, number|
180
+ # driver.navigate.to "#{url}"
181
+ # puts key
182
+ # driver.manage.window.resize_to(number-50,800)
183
+ # driver.save_screenshot("#{number}".upcase+".png")
184
+ # end
185
+
186
+
187
+ else
188
+ print "\n
189
+ Are you trying to use auto-print?
190
+ why dont you try this command:\n\n
191
+ auto-print help \n\n\n
192
+ "
193
+ end
@@ -8,12 +8,7 @@ require 'colorize'
8
8
  url = ARGV[0]
9
9
  puts url
10
10
  com_codes = ['apl', 'ach', 'bbv', 'ccv', 'cci', 'cwf', 'dvf', 'eth', 'frv', 'gsv', 'hsd', 'lhn', 'lph', 'mgc', 'ocv', 'rwv', 'sbv', 'tck', 'wcd']
11
- size = {
12
- 'medium' => 1200,
13
- 'small' =>992,
14
- 'xsmall' => 768,
15
- 'mobile' => 400
16
- }
11
+
17
12
 
18
13
 
19
14
 
@@ -57,7 +52,7 @@ elsif ARGV.length == 1 and (ARGV[0] == "-v" or ARGV[0] == "-version" or ARGV[0]
57
52
 
58
53
  puts "
59
54
  __________________________
60
- | VERSION 0.1.0 |
55
+ | VERSION 0.2.0 |
61
56
  --------------------------
62
57
  ".colorize(:yellow)
63
58
  puts " the use of this program is open source, but intended for the needs of Erickson Living employees only. if you wish to make a pull request you may do so at \n\n".yellow
@@ -68,28 +63,129 @@ elsif ARGV.length == 1 and (ARGV[0] == "-v" or ARGV[0] == "-version" or ARGV[0]
68
63
  elsif ARGV.length == 1 and ARGV[0] != "version" or ARGV[0] != "help" or ARGV[0] != '-version' or ARGV[0] != "-v"
69
64
  # line 68 catches any user input that relates to .xls files in the form of
70
65
  # prune-erickson yourfile.xls [digit] outputfile.xls
71
- if ARGV[0] =~ /(http)+[\S]*/
72
- puts "program"
73
- driver = Selenium::WebDriver.for :firefox
74
- com_codes.each do |com|
75
- driver.navigate.to "#{url}"+"?from="+"#{com}".upcase
76
- driver.save_screenshot("#{com}".upcase+".png")
77
- puts "#{com}".upcase
66
+
67
+ def url_question(url, com_codes)
68
+ puts "\n\n"
69
+ puts "Do you wish to screenshot of".yellow
70
+ puts " #{url} ".red
71
+ print "without additional versioning? [Y/N/X]\n\n".yellow
72
+ puts "you can exit this form at any time by pressing the X key on your keyboard".upcase.yellow
73
+
74
+ versioningResponse = STDIN.gets.strip.upcase
75
+ print "\n\n"
76
+
77
+ if versioningResponse == 'Y'
78
+ puts "what do you wish to name the file?".green
79
+ name = STDIN.gets.strip.upcase
80
+ screenshot(name, url)
81
+ elsif versioningResponse =='X'
82
+ puts "exiting sequence"
83
+ else
84
+ version_question(url, com_codes)
85
+ end
86
+ end
87
+ def version_question(url, com_codes)
88
+ puts "\n\n"
89
+ puts "Is this campaign versioned? [Y/N/X]".yellow
90
+ # puts "you can exit this form at any time by pressing the X key on your keyboard".yellow
91
+
92
+ campaignResponse = STDIN.gets.strip.upcase
93
+ print "\n\n"
94
+
95
+ if campaignResponse =='Y'
96
+ email_question( url, com_codes)
97
+ else
98
+ puts "which community do you wish to print please insert a 3 letter com code".yellow
99
+ com = STDIN.gets.strip.upcase
100
+ email_question(url, com_codes, com)
101
+ end
102
+ end
103
+
104
+ def email_question(url, com_codes, com = '')
105
+ puts "are these emails?[Y/N/X]".yellow
106
+ emailResponse = STDIN.gets.strip.upcase
107
+ print"\n\n"
108
+ if emailResponse == 'Y'
109
+ puts "is this a landing page connected to the email?".yellow
110
+ emailLPresponse = STDIN.gets.strip.upcase
111
+ print "\n\n"
112
+ end
113
+
114
+ unless com.length < 3
115
+ com_codes = ["#{com}"]
78
116
  end
79
117
 
80
- size.each do |key, number|
81
- driver.navigate.to "#{url}"
82
- puts key
83
- driver.manage.window.resize_to(number-50,800)
84
- driver.save_screenshot("#{number}".upcase+".png")
118
+ if emailResponse == 'Y'
119
+
120
+ if emailLPresponse == 'Y'
121
+ LP_email_screenshot(url, com_codes)
122
+ else
123
+ email_screenshot(url, com_codes)
124
+ end
125
+ elsif emailResponse == 'N'
126
+ LP_screenshot(url, com_codes)
127
+ else
128
+ print "exiting sequence".red
85
129
  end
130
+ end
131
+
132
+ def screenshot(name, url=ARGV[0])
133
+ driver = Selenium::WebDriver.for :firefox
134
+ driver.navigate.to url
135
+ driver.save_screenshot("#{name}"+".png")
136
+ end
137
+
138
+ def LP_email_screenshot(url, com_codes)
139
+ # if url =~ /(http)+[\S]*/
140
+ puts "printing versioned landing pages for the followign communities".blink
141
+ driver = Selenium::WebDriver.for :firefox
142
+ com_codes.each do |com|
143
+ # printing email CS
144
+ driver.navigate.to "#{url}"+"?from="+"#{com}-email".upcase
145
+ driver.save_screenshot("#{com}".upcase+"-email.png")
146
+ print "#{com}-EMAIL ".upcase
147
+ end
148
+ # end
149
+ end
150
+ def LP_screenshot(url, com_codes)
151
+ # if url =~ /(http)+[\S]*/
86
152
 
153
+ puts "printing versioned emails for the following communities".blink
154
+ driver = Selenium::WebDriver.for :firefox
155
+ com_codes.each do |com|
156
+ # landing pages
157
+ driver.navigate.to "#{url}"+"?from="+"#{com}".upcase
158
+ driver.save_screenshot("#{com}".upcase+".png")
159
+ print "#{com} ".upcase
160
+ end
161
+ # end
162
+ end
163
+ def email_screenshot(url, com_codes)
164
+ # if url =~ /(http)+[\S]*/
87
165
 
88
- else
89
- print "\n
90
- Are you trying to use auto-print?
91
- why dont you try this command:\n\n
92
- auto-print help \n\n\n
93
- "
166
+ puts "printing versioned emails for the following communities".blink
167
+ driver = Selenium::WebDriver.for :firefox
168
+ com_codes.each do |com|
169
+ # landing pages
170
+ driver.navigate.to "#{url}"+"#{com}".upcase+"_email.html"
171
+ driver.save_screenshot("#{com}".upcase+".png")
172
+ print "#{com} ".upcase
173
+ end
174
+ # end
94
175
  end
176
+ url_question(url, com_codes)
177
+ # size.each do |key, number|
178
+ # driver.navigate.to "#{url}"
179
+ # puts key
180
+ # driver.manage.window.resize_to(number-50,800)
181
+ # driver.save_screenshot("#{number}".upcase+".png")
182
+ # end
183
+
184
+
185
+ else
186
+ print "\n
187
+ Are you trying to use auto-print?
188
+ why dont you try this command:\n\n
189
+ auto-print help \n\n\n
190
+ "
95
191
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto-print
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Londono