sitediff 0.0.6 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.eslintignore +1 -0
  3. data/.eslintrc.json +28 -0
  4. data/.project +11 -0
  5. data/.rubocop.yml +179 -0
  6. data/.rubocop_todo.yml +51 -0
  7. data/CHANGELOG.md +28 -0
  8. data/Dockerfile +33 -0
  9. data/Gemfile +11 -0
  10. data/Gemfile.lock +85 -0
  11. data/INSTALLATION.md +146 -0
  12. data/LICENSE +339 -0
  13. data/README.md +810 -0
  14. data/Rakefile +12 -0
  15. data/Thorfile +135 -0
  16. data/bin/sitediff +9 -2
  17. data/config/.gitkeep +0 -0
  18. data/config/sanitize_domains.example.yaml +8 -0
  19. data/config/sitediff.example.yaml +81 -0
  20. data/docker-compose.test.yml +3 -0
  21. data/lib/sitediff/api.rb +276 -0
  22. data/lib/sitediff/cache.rb +57 -8
  23. data/lib/sitediff/cli.rb +156 -176
  24. data/lib/sitediff/config/creator.rb +61 -77
  25. data/lib/sitediff/config/preset.rb +75 -0
  26. data/lib/sitediff/config.rb +436 -31
  27. data/lib/sitediff/crawler.rb +27 -21
  28. data/lib/sitediff/diff.rb +32 -9
  29. data/lib/sitediff/fetch.rb +10 -3
  30. data/lib/sitediff/files/diff.html.erb +20 -2
  31. data/lib/sitediff/files/jquery.min.js +2 -0
  32. data/lib/sitediff/files/normalize.css +349 -0
  33. data/lib/sitediff/files/report.html.erb +171 -0
  34. data/lib/sitediff/files/sidebyside.html.erb +5 -2
  35. data/lib/sitediff/files/sitediff.css +303 -30
  36. data/lib/sitediff/files/sitediff.js +367 -0
  37. data/lib/sitediff/presets/drupal.yaml +63 -0
  38. data/lib/sitediff/report.rb +254 -0
  39. data/lib/sitediff/result.rb +50 -20
  40. data/lib/sitediff/sanitize/dom_transform.rb +47 -8
  41. data/lib/sitediff/sanitize/regexp.rb +24 -3
  42. data/lib/sitediff/sanitize.rb +81 -12
  43. data/lib/sitediff/uriwrapper.rb +65 -23
  44. data/lib/sitediff/webserver/resultserver.rb +30 -33
  45. data/lib/sitediff/webserver.rb +15 -3
  46. data/lib/sitediff.rb +130 -83
  47. data/misc/sitediff - overview report.png +0 -0
  48. data/misc/sitediff - page report.png +0 -0
  49. data/package-lock.json +878 -0
  50. data/package.json +25 -0
  51. data/sitediff.gemspec +51 -0
  52. metadata +91 -29
  53. data/lib/sitediff/files/html_report.html.erb +0 -66
  54. data/lib/sitediff/files/rules/drupal.yaml +0 -63
  55. data/lib/sitediff/rules.rb +0 -65
@@ -0,0 +1,349 @@
1
+ /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2
+
3
+ /* Document
4
+ ========================================================================== */
5
+
6
+ /**
7
+ * 1. Correct the line height in all browsers.
8
+ * 2. Prevent adjustments of font size after orientation changes in iOS.
9
+ */
10
+
11
+ html {
12
+ line-height: 1.15; /* 1 */
13
+ -webkit-text-size-adjust: 100%; /* 2 */
14
+ }
15
+
16
+ /* Sections
17
+ ========================================================================== */
18
+
19
+ /**
20
+ * Remove the margin in all browsers.
21
+ */
22
+
23
+ body {
24
+ margin: 0;
25
+ }
26
+
27
+ /**
28
+ * Render the `main` element consistently in IE.
29
+ */
30
+
31
+ main {
32
+ display: block;
33
+ }
34
+
35
+ /**
36
+ * Correct the font size and margin on `h1` elements within `section` and
37
+ * `article` contexts in Chrome, Firefox, and Safari.
38
+ */
39
+
40
+ h1 {
41
+ font-size: 2em;
42
+ margin: 0.67em 0;
43
+ }
44
+
45
+ /* Grouping content
46
+ ========================================================================== */
47
+
48
+ /**
49
+ * 1. Add the correct box sizing in Firefox.
50
+ * 2. Show the overflow in Edge and IE.
51
+ */
52
+
53
+ hr {
54
+ box-sizing: content-box; /* 1 */
55
+ height: 0; /* 1 */
56
+ overflow: visible; /* 2 */
57
+ }
58
+
59
+ /**
60
+ * 1. Correct the inheritance and scaling of font size in all browsers.
61
+ * 2. Correct the odd `em` font sizing in all browsers.
62
+ */
63
+
64
+ pre {
65
+ font-family: monospace, monospace; /* 1 */
66
+ font-size: 1em; /* 2 */
67
+ }
68
+
69
+ /* Text-level semantics
70
+ ========================================================================== */
71
+
72
+ /**
73
+ * Remove the gray background on active links in IE 10.
74
+ */
75
+
76
+ a {
77
+ background-color: transparent;
78
+ }
79
+
80
+ /**
81
+ * 1. Remove the bottom border in Chrome 57-
82
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
83
+ */
84
+
85
+ abbr[title] {
86
+ border-bottom: none; /* 1 */
87
+ text-decoration: underline; /* 2 */
88
+ text-decoration: underline dotted; /* 2 */
89
+ }
90
+
91
+ /**
92
+ * Add the correct font weight in Chrome, Edge, and Safari.
93
+ */
94
+
95
+ b,
96
+ strong {
97
+ font-weight: bolder;
98
+ }
99
+
100
+ /**
101
+ * 1. Correct the inheritance and scaling of font size in all browsers.
102
+ * 2. Correct the odd `em` font sizing in all browsers.
103
+ */
104
+
105
+ code,
106
+ kbd,
107
+ samp {
108
+ font-family: monospace, monospace; /* 1 */
109
+ font-size: 1em; /* 2 */
110
+ }
111
+
112
+ /**
113
+ * Add the correct font size in all browsers.
114
+ */
115
+
116
+ small {
117
+ font-size: 80%;
118
+ }
119
+
120
+ /**
121
+ * Prevent `sub` and `sup` elements from affecting the line height in
122
+ * all browsers.
123
+ */
124
+
125
+ sub,
126
+ sup {
127
+ font-size: 75%;
128
+ line-height: 0;
129
+ position: relative;
130
+ vertical-align: baseline;
131
+ }
132
+
133
+ sub {
134
+ bottom: -0.25em;
135
+ }
136
+
137
+ sup {
138
+ top: -0.5em;
139
+ }
140
+
141
+ /* Embedded content
142
+ ========================================================================== */
143
+
144
+ /**
145
+ * Remove the border on images inside links in IE 10.
146
+ */
147
+
148
+ img {
149
+ border-style: none;
150
+ }
151
+
152
+ /* Forms
153
+ ========================================================================== */
154
+
155
+ /**
156
+ * 1. Change the font styles in all browsers.
157
+ * 2. Remove the margin in Firefox and Safari.
158
+ */
159
+
160
+ button,
161
+ input,
162
+ optgroup,
163
+ select,
164
+ textarea {
165
+ font-family: inherit; /* 1 */
166
+ font-size: 100%; /* 1 */
167
+ line-height: 1.15; /* 1 */
168
+ margin: 0; /* 2 */
169
+ }
170
+
171
+ /**
172
+ * Show the overflow in IE.
173
+ * 1. Show the overflow in Edge.
174
+ */
175
+
176
+ button,
177
+ input { /* 1 */
178
+ overflow: visible;
179
+ }
180
+
181
+ /**
182
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
183
+ * 1. Remove the inheritance of text transform in Firefox.
184
+ */
185
+
186
+ button,
187
+ select { /* 1 */
188
+ text-transform: none;
189
+ }
190
+
191
+ /**
192
+ * Correct the inability to style clickable types in iOS and Safari.
193
+ */
194
+
195
+ button,
196
+ [type="button"],
197
+ [type="reset"],
198
+ [type="submit"] {
199
+ -webkit-appearance: button;
200
+ }
201
+
202
+ /**
203
+ * Remove the inner border and padding in Firefox.
204
+ */
205
+
206
+ button::-moz-focus-inner,
207
+ [type="button"]::-moz-focus-inner,
208
+ [type="reset"]::-moz-focus-inner,
209
+ [type="submit"]::-moz-focus-inner {
210
+ border-style: none;
211
+ padding: 0;
212
+ }
213
+
214
+ /**
215
+ * Restore the focus styles unset by the previous rule.
216
+ */
217
+
218
+ button:-moz-focusring,
219
+ [type="button"]:-moz-focusring,
220
+ [type="reset"]:-moz-focusring,
221
+ [type="submit"]:-moz-focusring {
222
+ outline: 1px dotted ButtonText;
223
+ }
224
+
225
+ /**
226
+ * Correct the padding in Firefox.
227
+ */
228
+
229
+ fieldset {
230
+ padding: 0.35em 0.75em 0.625em;
231
+ }
232
+
233
+ /**
234
+ * 1. Correct the text wrapping in Edge and IE.
235
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
236
+ * 3. Remove the padding so developers are not caught out when they zero out
237
+ * `fieldset` elements in all browsers.
238
+ */
239
+
240
+ legend {
241
+ box-sizing: border-box; /* 1 */
242
+ color: inherit; /* 2 */
243
+ display: table; /* 1 */
244
+ max-width: 100%; /* 1 */
245
+ padding: 0; /* 3 */
246
+ white-space: normal; /* 1 */
247
+ }
248
+
249
+ /**
250
+ * Add the correct vertical alignment in Chrome, Firefox, and Opera.
251
+ */
252
+
253
+ progress {
254
+ vertical-align: baseline;
255
+ }
256
+
257
+ /**
258
+ * Remove the default vertical scrollbar in IE 10+.
259
+ */
260
+
261
+ textarea {
262
+ overflow: auto;
263
+ }
264
+
265
+ /**
266
+ * 1. Add the correct box sizing in IE 10.
267
+ * 2. Remove the padding in IE 10.
268
+ */
269
+
270
+ [type="checkbox"],
271
+ [type="radio"] {
272
+ box-sizing: border-box; /* 1 */
273
+ padding: 0; /* 2 */
274
+ }
275
+
276
+ /**
277
+ * Correct the cursor style of increment and decrement buttons in Chrome.
278
+ */
279
+
280
+ [type="number"]::-webkit-inner-spin-button,
281
+ [type="number"]::-webkit-outer-spin-button {
282
+ height: auto;
283
+ }
284
+
285
+ /**
286
+ * 1. Correct the odd appearance in Chrome and Safari.
287
+ * 2. Correct the outline style in Safari.
288
+ */
289
+
290
+ [type="search"] {
291
+ -webkit-appearance: textfield; /* 1 */
292
+ outline-offset: -2px; /* 2 */
293
+ }
294
+
295
+ /**
296
+ * Remove the inner padding in Chrome and Safari on macOS.
297
+ */
298
+
299
+ [type="search"]::-webkit-search-decoration {
300
+ -webkit-appearance: none;
301
+ }
302
+
303
+ /**
304
+ * 1. Correct the inability to style clickable types in iOS and Safari.
305
+ * 2. Change font properties to `inherit` in Safari.
306
+ */
307
+
308
+ ::-webkit-file-upload-button {
309
+ -webkit-appearance: button; /* 1 */
310
+ font: inherit; /* 2 */
311
+ }
312
+
313
+ /* Interactive
314
+ ========================================================================== */
315
+
316
+ /*
317
+ * Add the correct display in Edge, IE 10+, and Firefox.
318
+ */
319
+
320
+ details {
321
+ display: block;
322
+ }
323
+
324
+ /*
325
+ * Add the correct display in all browsers.
326
+ */
327
+
328
+ summary {
329
+ display: list-item;
330
+ }
331
+
332
+ /* Misc
333
+ ========================================================================== */
334
+
335
+ /**
336
+ * Add the correct display in IE 10+.
337
+ */
338
+
339
+ template {
340
+ display: none;
341
+ }
342
+
343
+ /**
344
+ * Add the correct display in IE 10.
345
+ */
346
+
347
+ [hidden] {
348
+ display: none;
349
+ }
@@ -0,0 +1,171 @@
1
+ <%
2
+ # Changed pages.
3
+ changed_pages = results.count { |result| !result.success? }
4
+
5
+ # Pages compared.
6
+ compared_pages = results.length
7
+ %>
8
+ <!DOCTYPE html>
9
+ <html>
10
+ <head>
11
+ <%# Important: without charset, chrome chokes on non-ascii characters %>
12
+ <title> SiteDiff Report</title>
13
+ <meta charset="utf-8" />
14
+ <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
15
+ <meta http-equiv="Pragma" content="no-cache" />
16
+ <meta http-equiv="Expires" content="0" />
17
+ <style>
18
+ <%= SiteDiff::Report.css %>
19
+ </style>
20
+ <script>
21
+ <%= SiteDiff::Report.js %>
22
+ </script>
23
+ </head>
24
+ <body class="page-overview" data-page="overview">
25
+ <div id="layout">
26
+ <div class="container">
27
+ <div class="heading">
28
+ <h1><%= report["title"] %></h1>
29
+ <p><%= report["details"] %></p>
30
+ </div>
31
+ </div>
32
+ <div class="container">
33
+ <div class="statistical-info">
34
+ <div class="changed-pages">
35
+ <h3>Changed pages</h3>
36
+ <span class="count">
37
+ <%= changed_pages %>
38
+ </span>
39
+ </div>
40
+
41
+ <div class="compared-pages">
42
+ <h3>Pages compared</h3>
43
+ <span class="count">
44
+ <%= compared_pages %>
45
+ </span>
46
+ </div>
47
+ </div>
48
+ </div>
49
+
50
+ <div class="container">
51
+ <div class="site-info">
52
+ <% tags = %w[before after] %>
53
+ <% tags.each do |tag| %>
54
+ <div class="site site-<%= tag %>">
55
+ <% notes = ['base url']
56
+ notes << 'cached' if cache.read_tags.include?(tag.to_sym) %>
57
+ <div>
58
+ <h3 class="site__tag"><%= tag.capitalize %></h3>
59
+ </div>
60
+ <div>
61
+ <% if display_url = report[tag + '_url_report'] %>
62
+ <a href="<%= display_url %>" class="site__url"><%= display_url %></a>
63
+ <% else %>
64
+ <a href="<%= eval(tag) %>" class="site__url"><%= eval(tag) %></a>
65
+ <% if cache.read_tags.include?(tag.to_sym) %>
66
+ (<%= 'cached' if cache.read_tags.include?(tag.to_sym) %>)
67
+ <% end %>
68
+ <% end %>
69
+ </div>
70
+ <div>
71
+ Crawled on: <%= report[tag + '_time'] %>
72
+ </div>
73
+ <div>
74
+ <%= report[tag + '_note'] %>
75
+ </div>
76
+
77
+ </div>
78
+ <% end %>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="sitediff-toolbar">
83
+ <div class="container">
84
+ <div class="toolbar__left">
85
+ <form class="filter-form">
86
+
87
+ <div class="form-item form-search form-item--search">
88
+ <label>Search</label>
89
+ <input type="search" id="input-search" autofocus placeholder="Search" />
90
+ </div>
91
+
92
+ <div class="form-item form-checkboxes form-item--status">
93
+ <div class="form-checkbox">
94
+ <input type="checkbox" id="input-status-changed" value="changed" />
95
+ <label for="input-status-changed">Changed</label>
96
+ </div>
97
+ <div class="form-checkbox">
98
+ <input type="checkbox" id="input-status-unchanged" value="unchanged" />
99
+ <label for="input-status-unchanged">Unchanged</label>
100
+ </div>
101
+ <div class="form-checkbox">
102
+ <input type="checkbox" id="input-status-error" value="error" />
103
+ <label for="input-status-error">Errors</label>
104
+ </div>
105
+ </div>
106
+
107
+ </form>
108
+ </div>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="container">
113
+ <table id="sitediff-report" cellspacing="0" cellpadding="0">
114
+
115
+ <colgroup>
116
+ <col class="path-col">
117
+ <col class="icon-col">
118
+ <col class="status-col">
119
+ </colgroup>
120
+
121
+ <thead>
122
+ <tr>
123
+ <th>Path</th>
124
+ <th>&nbsp;</th>
125
+ <th>Status</th>
126
+ </tr>
127
+ </thead>
128
+
129
+ <tbody>
130
+ <% results.each do |result| %>
131
+ <tr class="sitediff-result sitediff-result--<%= result.status_text %>" data-status="<%= result.status_text %>">
132
+ <td class="description">
133
+ <span class="path"><%= result.path %></span>
134
+ <div class="buttons">
135
+ <% unless relative %>
136
+ <% unless report['before_url_report'] === false %>
137
+ <a href="<%= result.url(:before, before_url_report || before, cache) %>" class="button-before" target="_blank">Before</a>
138
+ <% end %>
139
+ <% unless report['after_url_report'] === false %>
140
+ <a href="<%= result.url(:after, after_url_report || after, cache) %>" class="button-after" target="_blank">After</a>
141
+ <% end %>
142
+ <% unless report['before_url_report'] === false || report['after_url_report'] === false %>
143
+ <a href="/sidebyside<%= result.path %>" class="button-both">Both</a>
144
+ <% end %>
145
+ <% end %>
146
+ <% unless result.diff_url.nil? %>
147
+ <a href="<%= result.diff_url(relative: relative) %>" class="button button-diff">View diff</a>
148
+ <% end %>
149
+ </div>
150
+ </td>
151
+ <td class="icon">
152
+ <span class="icon icon-result-<%= result.status_text %>"></span>
153
+ </td>
154
+ <td class="status">
155
+ <%= result.status_text.capitalize %>
156
+ </td>
157
+ </tr>
158
+ <% end %>
159
+ </tbody>
160
+
161
+ </table>
162
+ </div>
163
+
164
+ <footer id="footer">
165
+ <div class="credit">
166
+ Brought to you by <a href="https://evolvingweb.ca/?utm_source=sitediff&utm_medium=report&utm_content=footer-link" target="_blank">Evolving Web</a>.
167
+ </div>
168
+ </footer>
169
+ </div>
170
+ </body>
171
+ </html>
@@ -1,10 +1,13 @@
1
1
  <html>
2
2
  <head>
3
3
  <title>Comparison for <%= path %></title>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
6
+ <meta http-equiv="Pragma" content="no-cache" />
7
+ <meta http-equiv="Expires" content="0" />
4
8
  <style>
5
- <%= SiteDiff::Diff.css %>
9
+ <%= SiteDiff::Report.css %>
6
10
  </style>
7
- <meta charset="utf-8" />
8
11
  </head>
9
12
  <body id="sidebyside">
10
13
  <iframe src="<%= before %>"></iframe>