deprecations_detector 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/.rubocop.yml +22 -0
  4. data/Gemfile +6 -0
  5. data/LICENSE +21 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +74 -0
  8. data/Rakefile +28 -0
  9. data/deprecations_detector.gemspec +38 -0
  10. data/lib/deprecations_detector/active_support/deprecation_decorator.rb +17 -0
  11. data/lib/deprecations_detector/formatters/html/assets/javascripts/application.js +213 -0
  12. data/lib/deprecations_detector/formatters/html/assets/javascripts/libraries/jquery-1.6.2.min.js +18 -0
  13. data/lib/deprecations_detector/formatters/html/assets/javascripts/plugins/highlight.pack.js +1 -0
  14. data/lib/deprecations_detector/formatters/html/assets/javascripts/plugins/jquery.colorbox.js +1090 -0
  15. data/lib/deprecations_detector/formatters/html/assets/javascripts/plugins/jquery.dataTables.min.js +152 -0
  16. data/lib/deprecations_detector/formatters/html/assets/javascripts/plugins/jquery.timeago.js +141 -0
  17. data/lib/deprecations_detector/formatters/html/assets/javascripts/plugins/jquery.url.js +174 -0
  18. data/lib/deprecations_detector/formatters/html/assets/javascripts/settings.js +1 -0
  19. data/lib/deprecations_detector/formatters/html/assets/javascripts/treeview.js +261 -0
  20. data/lib/deprecations_detector/formatters/html/assets/stylesheets/application.css +4 -0
  21. data/lib/deprecations_detector/formatters/html/assets/stylesheets/plugins/highlight.css +129 -0
  22. data/lib/deprecations_detector/formatters/html/assets/stylesheets/plugins/jquery-ui-1.8.4.custom.css +295 -0
  23. data/lib/deprecations_detector/formatters/html/assets/stylesheets/plugins/jquery.colorbox.css +52 -0
  24. data/lib/deprecations_detector/formatters/html/assets/stylesheets/reset.css +103 -0
  25. data/lib/deprecations_detector/formatters/html/assets/stylesheets/screen.css.sass +249 -0
  26. data/lib/deprecations_detector/formatters/html/assets/stylesheets/treeview.css +12 -0
  27. data/lib/deprecations_detector/formatters/html/formatter.rb +169 -0
  28. data/lib/deprecations_detector/formatters/html/public/application.css +852 -0
  29. data/lib/deprecations_detector/formatters/html/public/application.js +2050 -0
  30. data/lib/deprecations_detector/formatters/html/public/colorbox/border.png +0 -0
  31. data/lib/deprecations_detector/formatters/html/public/colorbox/controls.png +0 -0
  32. data/lib/deprecations_detector/formatters/html/public/colorbox/loading.gif +0 -0
  33. data/lib/deprecations_detector/formatters/html/public/colorbox/loading_background.png +0 -0
  34. data/lib/deprecations_detector/formatters/html/public/favicon.png +0 -0
  35. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  36. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  37. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  38. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  39. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  40. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  41. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  42. data/lib/deprecations_detector/formatters/html/public/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  43. data/lib/deprecations_detector/formatters/html/public/images/ui-icons_222222_256x240.png +0 -0
  44. data/lib/deprecations_detector/formatters/html/public/images/ui-icons_2e83ff_256x240.png +0 -0
  45. data/lib/deprecations_detector/formatters/html/public/images/ui-icons_454545_256x240.png +0 -0
  46. data/lib/deprecations_detector/formatters/html/public/images/ui-icons_888888_256x240.png +0 -0
  47. data/lib/deprecations_detector/formatters/html/public/images/ui-icons_cd0a0a_256x240.png +0 -0
  48. data/lib/deprecations_detector/formatters/html/public/loading.gif +0 -0
  49. data/lib/deprecations_detector/formatters/html/public/magnify.png +0 -0
  50. data/lib/deprecations_detector/formatters/html/public/settings.js +1 -0
  51. data/lib/deprecations_detector/formatters/html/views/file_list.erb +24 -0
  52. data/lib/deprecations_detector/formatters/html/views/layout.erb +39 -0
  53. data/lib/deprecations_detector/formatters/html/views/source_file.erb +24 -0
  54. data/lib/deprecations_detector/main.rb +113 -0
  55. data/lib/deprecations_detector/version.rb +5 -0
  56. data/lib/deprecations_detector.rb +10 -0
  57. data/lib/tasks/deprecations/combine.rake +30 -0
  58. data/lib/tasks/deprecations/format.rake +14 -0
  59. metadata +254 -0
@@ -0,0 +1,52 @@
1
+ /*
2
+ ColorBox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
6
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
7
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8
+ #cboxContent{position:relative;}
9
+ #cboxLoadedContent{overflow:auto;}
10
+ #cboxTitle{margin:0;}
11
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
12
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13
+ .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
14
+ .cboxIframe{width:100%; height:100%; display:block; border:0;}
15
+ #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box;}
16
+
17
+ /*
18
+ User Style:
19
+ Change the following styles to modify the appearance of ColorBox. They are
20
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
21
+ */
22
+ #cboxOverlay{background:#000;}
23
+ #colorbox{}
24
+ #cboxTopLeft{width:14px; height:14px; background:url(colorbox/controls.png) no-repeat 0 0;}
25
+ #cboxTopCenter{height:14px; background:url(colorbox/border.png) repeat-x top left;}
26
+ #cboxTopRight{width:14px; height:14px; background:url(colorbox/controls.png) no-repeat -36px 0;}
27
+ #cboxBottomLeft{width:14px; height:43px; background:url(colorbox/controls.png) no-repeat 0 -32px;}
28
+ #cboxBottomCenter{height:43px; background:url(colorbox/border.png) repeat-x bottom left;}
29
+ #cboxBottomRight{width:14px; height:43px; background:url(colorbox/controls.png) no-repeat -36px -32px;}
30
+ #cboxMiddleLeft{width:14px; background:url(colorbox/controls.png) repeat-y -175px 0;}
31
+ #cboxMiddleRight{width:14px; background:url(colorbox/controls.png) repeat-y -211px 0;}
32
+ #cboxContent{background:#fff; overflow:visible;}
33
+ .cboxIframe{background:#fff;}
34
+ #cboxError{padding:50px; border:1px solid #ccc;}
35
+ #cboxLoadedContent{margin-bottom:5px;}
36
+ #cboxLoadingOverlay{background:url(colorbox/loading_background.png) no-repeat center center;}
37
+ #cboxLoadingGraphic{background:url(colorbox/loading.gif) no-repeat center center;}
38
+ #cboxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;}
39
+ #cboxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;}
40
+
41
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{position:absolute; bottom:-29px; background:url(colorbox/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;}
42
+ #cboxPrevious{left:0px; background-position: -51px -25px;}
43
+ #cboxPrevious:hover{background-position:-51px 0px;}
44
+ #cboxNext{left:27px; background-position:-75px -25px;}
45
+ #cboxNext:hover{background-position:-75px 0px;}
46
+ #cboxClose{right:0; background-position:-100px -25px;}
47
+ #cboxClose:hover{background-position:-100px 0px;}
48
+
49
+ .cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;}
50
+ .cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;}
51
+ .cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;}
52
+ .cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;}
@@ -0,0 +1,103 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.9
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* reset.css */
15
+ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
16
+ article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;}
17
+ body {line-height:1.5;}
18
+ table {border-collapse:separate;border-spacing:0;}
19
+ caption, th, td {text-align:left;font-weight:normal;}
20
+ table, td, th {vertical-align:middle;}
21
+ blockquote:before, blockquote:after, q:before, q:after {content:"";}
22
+ blockquote, q {quotes:"" "";}
23
+ a img {border:none;}
24
+
25
+ /* typography.css */
26
+ html {font-size:100.01%;}
27
+ body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
28
+ h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
29
+ h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
30
+ h2 {font-size:2em;margin-bottom:0.75em;}
31
+ h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
32
+ h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
33
+ h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
34
+ h6 {font-size:1em;font-weight:bold;}
35
+ h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
36
+ p {margin:0 0 1.5em;}
37
+ p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
38
+ p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
39
+ a:focus, a:hover {color:#000;}
40
+ a {color:#009;text-decoration:underline;}
41
+ blockquote {margin:1.5em;color:#666;font-style:italic;}
42
+ strong {font-weight:bold;}
43
+ em, dfn {font-style:italic;}
44
+ dfn {font-weight:bold;}
45
+ sup, sub {line-height:0;}
46
+ abbr, acronym {border-bottom:1px dotted #666;}
47
+ address {margin:0 0 1.5em;font-style:italic;}
48
+ del {color:#666;}
49
+ pre {margin:1.5em 0;white-space:pre;}
50
+ pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
51
+ li ul, li ol {margin:0;}
52
+ ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;}
53
+ ul {list-style-type:disc;}
54
+ ol {list-style-type:decimal;}
55
+ dl {margin:0 0 1.5em 0;}
56
+ dl dt {font-weight:bold;}
57
+ dd {margin-left:1.5em;}
58
+ table {margin-bottom:1.4em;width:100%;}
59
+ th {font-weight:bold;}
60
+ thead th {background:#c3d9ff;}
61
+ th, td, caption {padding:4px 10px 4px 5px;}
62
+ tr.even td {background:#efefef;}
63
+ tfoot {font-style:italic;}
64
+ caption {background:#eee;}
65
+ .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
66
+ .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
67
+ .hide {display:none;}
68
+ .quiet {color:#666;}
69
+ .loud {color:#000;}
70
+ .highlight {background:#ff0;}
71
+ .added {background:#060;color:#fff;}
72
+ .removed {background:#900;color:#fff;}
73
+ .first {margin-left:0;padding-left:0;}
74
+ .last {margin-right:0;padding-right:0;}
75
+ .top {margin-top:0;padding-top:0;}
76
+ .bottom {margin-bottom:0;padding-bottom:0;}
77
+
78
+ /* forms.css */
79
+ label {font-weight:bold;}
80
+ fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
81
+ legend {font-weight:bold;font-size:1.2em;}
82
+ input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;}
83
+ input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;}
84
+ input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;}
85
+ input.text, input.title {width:300px;padding:5px;}
86
+ input.title {font-size:1.5em;}
87
+ textarea {width:390px;height:250px;padding:5px;}
88
+ input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;}
89
+ form.inline {line-height:3;}
90
+ form.inline p {margin-bottom:0;}
91
+ .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
92
+ .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
93
+ .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
94
+ .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
95
+ .error a {color:#8a1f11;}
96
+ .notice a {color:#514721;}
97
+ .success a {color:#264409;}
98
+ .box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
99
+ hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
100
+ hr.space {background:#fff;color:#fff;visibility:hidden;}
101
+ .clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
102
+ .clearfix, .container {display:block;}
103
+ .clear {clear:both;}
@@ -0,0 +1,249 @@
1
+ #loading
2
+ position: fixed
3
+ left: 40%
4
+ top: 50%
5
+
6
+ a
7
+ color: #333
8
+ text-decoration: none
9
+ &:hover
10
+ color: #000
11
+ text-decoration: underline
12
+
13
+ body
14
+ font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif
15
+ padding: 12px
16
+ background-color: #333
17
+
18
+ h1, h2, h3, h4
19
+ color: #1C2324
20
+ margin: 0
21
+ padding: 0
22
+ margin-bottom: 12px
23
+
24
+ table
25
+ width: 100%
26
+
27
+ #content
28
+ clear: left
29
+ background-color: white
30
+ border: 2px solid #ddd
31
+ border-top: 8px solid #ddd
32
+ padding: 18px
33
+ -webkit-border-bottom-left-radius: 5px
34
+ -webkit-border-bottom-right-radius: 5px
35
+ -webkit-border-top-right-radius: 5px
36
+ -moz-border-radius-bottomleft: 5px
37
+ -moz-border-radius-bottomright: 5px
38
+ -moz-border-radius-topright: 5px
39
+ border-bottom-left-radius: 5px
40
+ border-bottom-right-radius: 5px
41
+ border-top-right-radius: 5px
42
+
43
+ .dataTables_filter, .dataTables_info
44
+ padding: 2px 6px
45
+
46
+ abbr.timeago
47
+ text-decoration: none
48
+ border: none
49
+ font-weight: bold
50
+
51
+ .timestamp
52
+ float: right
53
+ color: #ddd
54
+
55
+ .group_tabs
56
+ list-style: none
57
+ float: left
58
+ margin: 0
59
+ padding: 0
60
+ li
61
+ display: inline
62
+ float: left
63
+ a
64
+ font-family: Helvetica, Arial, sans-serif
65
+ display: block
66
+ float: left
67
+ text-decoration: none
68
+ padding: 4px 8px
69
+ background-color: #aaa
70
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#dddddd), to(#aaaaaa))
71
+ background: -moz-linear-gradient(#dddddd, #aaaaaa)
72
+ background: linear-gradient(#dddddd, #aaaaaa)
73
+ text-shadow: #e5e5e5 1px 1px 0px
74
+ border-bottom: none
75
+ color: #333
76
+ font-weight: bold
77
+ margin-right: 8px
78
+ border-top: 1px solid #efefef
79
+ -webkit-border-top-left-radius: 2px
80
+ -webkit-border-top-right-radius: 2px
81
+ -moz-border-radius-topleft: 2px
82
+ -moz-border-radius-topright: 2px
83
+ border-top-left-radius: 2px
84
+ border-top-right-radius: 2px
85
+ &:hover
86
+ background-color: #ccc
87
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eeeeee), to(#aaaaaa))
88
+ background: -moz-linear-gradient(#eeeeee, #aaaaaa)
89
+ background: linear-gradient(#eeeeee, #aaaaaa)
90
+ &:active
91
+ padding-top: 5px
92
+ padding-bottom: 3px
93
+ &.active a
94
+ color: black
95
+ text-shadow: #fff 1px 1px 0px
96
+ background-color: #ddd
97
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(white), to(#dddddd))
98
+ background: -moz-linear-gradient(white, #dddddd)
99
+ background: linear-gradient(white, #dddddd)
100
+
101
+ .file_list
102
+ margin-bottom: 18px
103
+
104
+ a.src_link
105
+ background: url('./magnify.png') no-repeat left 50%
106
+ padding-left: 18px
107
+
108
+ tr, td
109
+ margin: 0
110
+ padding: 0
111
+
112
+ th
113
+ white-space: nowrap
114
+ &.ui-state-default
115
+ cursor: pointer
116
+ span.ui-icon
117
+ float: left
118
+
119
+ td
120
+ padding: 4px 8px
121
+ &.strong
122
+ font-weight: bold
123
+
124
+ .source_table
125
+ h3, h4
126
+ padding: 0
127
+ margin: 0
128
+ margin-bottom: 4px
129
+ .header
130
+ padding: 10px
131
+ pre
132
+ margin: 0
133
+ padding: 0
134
+ white-space: normal
135
+ color: #000
136
+ font-family: "Monaco", "Inconsolata", "Consolas", monospace
137
+ code
138
+ color: #000
139
+ font-family: "Monaco", "Inconsolata", "Consolas", monospace
140
+ pre
141
+ background-color: #333
142
+ ol
143
+ margin: 0px
144
+ padding: 0px
145
+ margin-left: 45px
146
+ font-size: 12px
147
+ color: white
148
+ li
149
+ margin: 0px
150
+ padding: 2px 6px
151
+ border-left: 5px solid white
152
+ code
153
+ white-space: pre
154
+ white-space: pre-wrap
155
+ .hits
156
+ float: right
157
+ margin-left: 10px
158
+ padding: 2px 4px
159
+ background-color: #444
160
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#222222), to(#666666))
161
+ background: -moz-linear-gradient(#222222, #666666)
162
+ background: linear-gradient(#222222, #666666)
163
+ color: white
164
+ font-family: Helvetica, "Helvetica Neue", Arial, sans-serif
165
+ font-size: 10px
166
+ font-weight: bold
167
+ text-align: center
168
+ border-radius: 6px
169
+
170
+ #footer
171
+ color: #ddd
172
+ font-size: 12px
173
+ font-weight: bold
174
+ margin-top: 12px
175
+ text-align: right
176
+ a
177
+ color: #eee
178
+ text-decoration: underline
179
+ &:hover
180
+ color: #fff
181
+ text-decoration: none
182
+
183
+ .green
184
+ color: #090
185
+
186
+ .red
187
+ color: #900
188
+
189
+ .yellow
190
+ color: #da0
191
+
192
+ .source_table
193
+ pre li
194
+ padding: 2px 0 0 0
195
+
196
+ .covered
197
+ border-color: #090
198
+ .missed
199
+ border-color: #900
200
+ .never
201
+ border-color: black
202
+ .skipped
203
+ border-color: #fc0
204
+ .covered
205
+ cursor: pointer
206
+ &:nth-child(odd)
207
+ background-color: #CDF2CD
208
+ &:nth-child(even)
209
+ background-color: #DBF2DB
210
+ .missed
211
+ &:nth-child(odd)
212
+ background-color: #F7C0C0
213
+ &:nth-child(even)
214
+ background-color: #F7CFCF
215
+ .never
216
+ &:nth-child(odd)
217
+ background-color: #efefef
218
+ &:nth-child(even)
219
+ background-color: #f4f4f4
220
+ .skipped
221
+ &:nth-child(odd)
222
+ background-color: #FBF0C0
223
+ &:nth-child(even)
224
+ background-color: #FBFfCf
225
+
226
+ .deprecations_detector
227
+ background: #fed
228
+ color: #333
229
+ display: none
230
+ padding: 2px 6px
231
+ >.example_data
232
+ &:nth-child(odd)
233
+ background-color: #FBF0C0
234
+ &:nth-child(even)
235
+ background-color: #FBFfCf
236
+ >.file_path
237
+ padding-left: 14px
238
+
239
+ .tree-leaf .tree-child-leaves
240
+ border-left: 1px dashed #bbb
241
+ padding-left: 11px
242
+ margin-left: 4px
243
+
244
+ .tree-expando.hidden + .tree-leaf-text
245
+ color: #000
246
+ font-weight: bold
247
+
248
+ &:before
249
+ content: '↳ '
@@ -0,0 +1,12 @@
1
+ /* https://github.com/justinchmura/js-treeview/blob/1.1.5/src/treeview.css */
2
+
3
+ .tree-leaf { position: relative; }
4
+ .tree-leaf .tree-child-leaves { display: block; margin-left: 15px; }
5
+ .tree-leaf .hidden { display: none; }
6
+ .tree-leaf .tree-expando { background: #ddd; border-radius: 3px; cursor: pointer; float: left; height: 10px; line-height: 10px; position: relative; text-align: center; top: 5px; width: 10px; }
7
+ .tree-leaf .hidden { visibility: hidden; }
8
+ .tree-leaf .tree-expando:hover { background: #aaa; }
9
+ .tree-leaf .tree-leaf-text { cursor: pointer; float: left; margin-left: 5px; }
10
+ .tree-leaf .tree-leaf-text:hover { color: blue; }
11
+ .tree-leaf .tree-leaf-content:before, .tree-leaf .tree-leaf-content:after { content: " "; display: table; }
12
+ .tree-leaf .tree-leaf-content:after { clear: both; }
@@ -0,0 +1,169 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "erb"
4
+ require "cgi"
5
+ require "fileutils"
6
+ require "digest/sha1"
7
+ require "time"
8
+ require "json"
9
+
10
+ module DeprecationsDetector
11
+ module Formatters
12
+ module HTML
13
+ class Formatter
14
+ def format(result, output_path: DeprecationsDetector::Main.output_path)
15
+ public_r = './public/*'
16
+ Dir[File.join(File.dirname(__FILE__), public_r)].each do |path|
17
+ FileUtils.cp_r(path, asset_output_path(output_path))
18
+ end
19
+
20
+ File.open(File.join(output_path, "index.html"), "wb") do |file|
21
+ file.puts template("layout").result(binding)
22
+ end
23
+ puts output_message(result, output_path)
24
+ end
25
+
26
+ def output_message(result, output_path)
27
+ "Coverage report generated for #{result.count} files to #{output_path}."
28
+ end
29
+
30
+ def asset_output_path(output_path)
31
+ return @asset_output_path if defined?(@asset_output_path) && @asset_output_path
32
+
33
+ @asset_output_path = File.join(output_path, "assets", DeprecationsDetector::VERSION)
34
+ FileUtils.mkdir_p(@asset_output_path)
35
+ @asset_output_path
36
+ end
37
+
38
+ private
39
+
40
+ # Returns the an erb instance for the template of given name
41
+ def template(name)
42
+ ERB.new(File.read(File.join(File.dirname(__FILE__), "views", "#{name}.erb")))
43
+ end
44
+
45
+ def assets_path(name)
46
+ File.join("./assets", DeprecationsDetector::VERSION, name)
47
+ end
48
+
49
+ # Returns the html for the given source_file
50
+ def formatted_source_file(source_file)
51
+ template("source_file").result(binding)
52
+ rescue Encoding::CompatibilityError => e
53
+ puts "Encoding problems with file #{filename(source_file)}. Simplecov/ERB can't handle non ASCII characters in filenames. Error: #{e.message}."
54
+ end
55
+
56
+ def readfile(source_file)
57
+ load_source(filename(source_file))
58
+ end
59
+
60
+ def load_source(file_name)
61
+ lines = []
62
+ # The default encoding is UTF-8
63
+ File.open(file_name, "rb:UTF-8") do |file|
64
+ line = file.gets
65
+
66
+ # Check for shbang
67
+ if /\A#!/.match?(line)
68
+ lines << line
69
+ line = file.gets
70
+ end
71
+ return lines unless line
72
+
73
+ check_magic_comment(file, line)
74
+ lines.concat([line], file.readlines)
75
+ end
76
+
77
+ lines
78
+ end
79
+
80
+ def check_magic_comment(file, line)
81
+ # Check for encoding magic comment
82
+ # Encoding magic comment must be placed at first line except for shbang
83
+ if (match = /\A#\s*(?:-\*-)?\s*(?:en)?coding:\s*(\S+)\s*(?:-\*-)?\s*\z/.match(line))
84
+ file.set_encoding(match[1], "UTF-8")
85
+ end
86
+ end
87
+
88
+ def grouped(files)
89
+ groups = files.group_by do |file_name, lines|
90
+ lines.map do |line, examples|
91
+ examples.map { |example| example[:deprecation_message] }
92
+ end
93
+ end.keys.flatten.uniq
94
+
95
+ grouped = {}
96
+ grouped_files = []
97
+
98
+ groups.each do |deprecation_message|
99
+ grouped[deprecation_message] = files.select { |source_file, lines| lines.detect { |line, examples| examples.detect { |example| example[:deprecation_message] == deprecation_message } } }
100
+ grouped_files += grouped[deprecation_message].keys
101
+ end
102
+ if !groups.empty? && !(other_files = files.reject { |source_file| grouped_files.include?(source_file) }).empty?
103
+ grouped["Ungrouped"] = other_files
104
+ end
105
+
106
+ arr = grouped.map do |deprecation_message, objects|
107
+ [
108
+ deprecation_message,
109
+ -objects.to_a.sum { |file, lines| lines.sum { |line, examples| examples.count } }
110
+ ]
111
+ end.sort_by { |group| group[1] }.to_h.keys[0..6] # filter just the 6 most frequent deprecations
112
+
113
+ arr.map { |k| [k, grouped[k]] }.to_h
114
+ end
115
+
116
+ # Returns a table containing the given source files
117
+ def formatted_file_list(title, source_files)
118
+ title_id = title.gsub(/^[^a-zA-Z]+/, "").gsub(/[^a-zA-Z0-9\-\_]/, "")
119
+ # Silence a warning by using the following variable to assign to itself:
120
+ # "warning: possibly useless use of a variable in void context"
121
+ # The variable is used by ERB via binding.
122
+ title_id = title_id
123
+ template("file_list").result(binding)
124
+ end
125
+
126
+ def coverage_css_class(covered_percent)
127
+ if covered_percent > 90
128
+ "green"
129
+ elsif covered_percent > 80
130
+ "yellow"
131
+ else
132
+ "red"
133
+ end
134
+ end
135
+
136
+ def strength_css_class(covered_strength)
137
+ if covered_strength > 1
138
+ "green"
139
+ elsif covered_strength == 1
140
+ "yellow"
141
+ else
142
+ "red"
143
+ end
144
+ end
145
+
146
+ def filename(source_file)
147
+ source_file.first.to_s
148
+ end
149
+
150
+ # Return a (kind of) unique id for the source file given. Uses SHA1 on path for the id
151
+ def id(source_file)
152
+ Digest::SHA1.hexdigest(filename(source_file))
153
+ end
154
+
155
+ def timeago(time)
156
+ "<abbr class=\"timeago\" title=\"#{time.iso8601}\">#{time.iso8601}</abbr>"
157
+ end
158
+
159
+ def shortened_filename(source_file)
160
+ filename(source_file).sub(Dir.pwd, '.').gsub(%r{^./}, "")
161
+ end
162
+
163
+ def link_to_source_file(source_file)
164
+ %(<a href="##{id source_file}" class="src_link" title="#{shortened_filename source_file}">#{shortened_filename source_file}</a>)
165
+ end
166
+ end
167
+ end
168
+ end
169
+ end