how_is 19.0.0 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +1 -0
- data/.rubocop.yml +16 -0
- data/CHANGELOG.md +30 -3
- data/Gemfile +0 -6
- data/README.md +5 -2
- data/exe/how_is +7 -2
- data/fixtures/vcr_cassettes/how-is-example-empty-repository.yml +446 -727
- data/fixtures/vcr_cassettes/how-is-example-repository.yml +508 -727
- data/fixtures/vcr_cassettes/how-is-from-config-frontmatter.yml +43522 -1218
- data/fixtures/vcr_cassettes/how-is-how-is-travis-api-repos-builds.yml +287 -0
- data/fixtures/vcr_cassettes/how-is-with-config-file.yml +44307 -23286
- data/fixtures/vcr_cassettes/how_is_contributions_additions_count.yml +307 -0
- data/fixtures/vcr_cassettes/how_is_contributions_all_contributors.yml +81 -0
- data/fixtures/vcr_cassettes/how_is_contributions_changed_files.yml +307 -0
- data/fixtures/vcr_cassettes/how_is_contributions_changes.yml +307 -0
- data/fixtures/vcr_cassettes/how_is_contributions_commits.yml +307 -0
- data/fixtures/vcr_cassettes/how_is_contributions_compare_url.yml +74 -0
- data/fixtures/vcr_cassettes/how_is_contributions_deletions_count.yml +307 -0
- data/fixtures/vcr_cassettes/how_is_contributions_new_contributors.yml +234 -0
- data/fixtures/vcr_cassettes/how_is_contributions_summary.yml +378 -0
- data/fixtures/vcr_cassettes/how_is_contributions_summary_2.yml +378 -0
- data/fixtures/vcr_cassettes/how_is_fetcher_call.yml +572 -0
- data/how_is.gemspec +3 -2
- data/lib/how_is/cli.rb +4 -6
- data/lib/how_is/frontmatter.rb +46 -0
- data/lib/how_is/report.rb +59 -63
- data/lib/how_is/sources/github/contributions.rb +164 -0
- data/lib/how_is/sources/github/issues.rb +142 -0
- data/lib/how_is/sources/github/pulls.rb +20 -0
- data/lib/how_is/sources/github.rb +11 -0
- data/lib/how_is/sources/github_helpers.rb +191 -0
- data/lib/how_is/sources/travis.rb +34 -0
- data/lib/how_is/sources.rb +9 -0
- data/lib/how_is/templates/issues_or_pulls_partial.html_template +7 -0
- data/lib/how_is/templates/report.html_template +27 -0
- data/lib/how_is/templates/report_partial.html_template +12 -0
- data/lib/how_is/version.rb +2 -2
- data/lib/how_is.rb +59 -158
- metadata +42 -16
- data/lib/how_is/analyzer.rb +0 -222
- data/lib/how_is/builds.rb +0 -36
- data/lib/how_is/contributions.rb +0 -156
- data/lib/how_is/fetcher.rb +0 -77
- data/lib/how_is/pulse.rb +0 -47
- data/lib/how_is/report/base_report.rb +0 -148
- data/lib/how_is/report/html.rb +0 -120
- data/lib/how_is/report/json.rb +0 -34
data/lib/how_is/report/html.rb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "how_is/report/base_report"
|
5
|
-
|
6
|
-
class HowIs
|
7
|
-
# HTML Report implementation
|
8
|
-
class HtmlReport < BaseReport
|
9
|
-
def format
|
10
|
-
:html
|
11
|
-
end
|
12
|
-
|
13
|
-
def title(content)
|
14
|
-
@title = content
|
15
|
-
@r += "\n<h1>#{content}</h1>\n"
|
16
|
-
end
|
17
|
-
|
18
|
-
def header(content)
|
19
|
-
@r += "\n<h2>#{content}</h2>\n"
|
20
|
-
end
|
21
|
-
|
22
|
-
def link(content, url)
|
23
|
-
%[<a href="#{url}">#{content}</a>]
|
24
|
-
end
|
25
|
-
|
26
|
-
def text(content)
|
27
|
-
@r += "<p>#{content}</p>\n"
|
28
|
-
end
|
29
|
-
|
30
|
-
def unordered_list(arr)
|
31
|
-
@r += "\n<ul>\n"
|
32
|
-
arr.each do |item|
|
33
|
-
@r += " <li>#{item}</li>\n"
|
34
|
-
end
|
35
|
-
@r += "</ul>\n\n"
|
36
|
-
end
|
37
|
-
|
38
|
-
ROW_HTML_GRAPH = <<-EOF
|
39
|
-
<tr>
|
40
|
-
<td style="width: %{label_width}">%{label_text}</td>
|
41
|
-
<td><span class="fill" style="width: %{percentage}%%">%{link_text}</span></td>
|
42
|
-
</tr>
|
43
|
-
|
44
|
-
EOF
|
45
|
-
|
46
|
-
def horizontal_bar_graph(data)
|
47
|
-
if data.length == 1 && data[0][0] == "(No label)"
|
48
|
-
text "There are no open issues to graph."
|
49
|
-
return
|
50
|
-
end
|
51
|
-
|
52
|
-
biggest = data.map { |x| x[1] }.max
|
53
|
-
get_percentage = ->(number_of_issues) { number_of_issues * 100 / biggest }
|
54
|
-
|
55
|
-
longest_label_length = data.map(&:first).map(&:length).max
|
56
|
-
label_width = "#{longest_label_length}ch"
|
57
|
-
|
58
|
-
@r += "<table class=\"horizontal-bar-graph\">\n"
|
59
|
-
data.each do |row|
|
60
|
-
@r += Kernel.format(ROW_HTML_GRAPH, label_width: label_width,
|
61
|
-
label_text: label_text_for(row),
|
62
|
-
percentage: get_percentage.call(row[1]),
|
63
|
-
link_text: row[1])
|
64
|
-
end
|
65
|
-
@r += "</table>\n"
|
66
|
-
end
|
67
|
-
|
68
|
-
def export
|
69
|
-
@r = ""
|
70
|
-
generate_report_text!
|
71
|
-
end
|
72
|
-
|
73
|
-
HTML_DOC_TEMPLATE = <<~EOF
|
74
|
-
<!DOCTYPE html>
|
75
|
-
<html>
|
76
|
-
<head>
|
77
|
-
<title>%{title}</title>
|
78
|
-
<style>
|
79
|
-
body { font: sans-serif; }
|
80
|
-
main {
|
81
|
-
max-width: 600px;
|
82
|
-
max-width: 72ch;
|
83
|
-
margin: auto;
|
84
|
-
}
|
85
|
-
.horizontal-bar-graph {
|
86
|
-
position: relative;
|
87
|
-
width: 100%;
|
88
|
-
}
|
89
|
-
.horizontal-bar-graph .fill {
|
90
|
-
display: inline-block;
|
91
|
-
background: #CCC;
|
92
|
-
}
|
93
|
-
</style>
|
94
|
-
</head>
|
95
|
-
<body>
|
96
|
-
<main>
|
97
|
-
%{report}
|
98
|
-
</main>
|
99
|
-
</body>
|
100
|
-
</html>
|
101
|
-
EOF
|
102
|
-
|
103
|
-
def export_file(file)
|
104
|
-
content = Kernel.format(HTML_DOC_TEMPLATE, title: @title, report: export)
|
105
|
-
File.open(file, "w") do |f|
|
106
|
-
f.puts content
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
|
112
|
-
def label_text_for(row)
|
113
|
-
if row[2]
|
114
|
-
link(row[0], row[2])
|
115
|
-
else
|
116
|
-
row[0]
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
data/lib/how_is/report/json.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "how_is/report/base_report"
|
4
|
-
|
5
|
-
class HowIs
|
6
|
-
##
|
7
|
-
# A JSON report.
|
8
|
-
class JsonReport < BaseReport
|
9
|
-
# A JSON report is simply a JSON dump of the corresponding
|
10
|
-
# HowIs::Analysis instance.
|
11
|
-
|
12
|
-
##
|
13
|
-
# The format of the report.
|
14
|
-
#
|
15
|
-
# @return [Symbol] The name of the format.
|
16
|
-
def format
|
17
|
-
:json
|
18
|
-
end
|
19
|
-
|
20
|
-
##
|
21
|
-
# Generates a report.
|
22
|
-
def export
|
23
|
-
to_json
|
24
|
-
end
|
25
|
-
|
26
|
-
##
|
27
|
-
# Generates a report and writes it to a file.
|
28
|
-
def export_file(file)
|
29
|
-
File.open(file, "w") do |f|
|
30
|
-
f.write export
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|