-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompile_results.rb
executable file
·96 lines (77 loc) · 3.84 KB
/
compile_results.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
require 'terminal-table'
# The results file looks like -
# +--------------------------+-----------------------------------------------+
# | MLPNeuralNet-results |
# +--------------------------+-----------------------------------------------+
# | ProjectName | MLPNeuralNet |
# | RepoURL | https://github.com/nikolaypavlov/MLPNeuralNet |
# | HEAD SHA | a70d51708cd235bebbb9c4ef70aaab68d5c02b49 |
# | # Commits | 75 |
# | # Merges | 7 |
# | # Reverts - Message | 0 |
# | # Reverts - Complete | 1 |
# | # Reverts - Partial | 4 |
# | # Cherrypicks - Complete | 2 |
# | # Cherrypicks - Partial | 0 |
# +--------------------------+-----------------------------------------------+
def ExtractInfoFromFileContents file_contents
data = file_contents.split('|')
# Remove the first line
# Remove the project_name from data
# Remove the line below project_name
data = data.drop(3)
# Now, everything is in 3-tuple <key, value, "\n">
data.shift
project_name = data.first
project_name = project_name.gsub(/\s+/, "")
data = data.drop(3)
repo_url = data.first
repo_url = repo_url.gsub(/\s+/, "")
data = data.drop(3)
head_sha = data.first
head_sha = head_sha.gsub(/\s+/, "")
data = data.drop(3)
num_commits = data.first
num_commits = num_commits.gsub(/\s+/, "")
data = data.drop(3)
num_merges = data.first
num_merges = num_merges.gsub(/\s+/, "")
data = data.drop(3)
reverts_msg = data.first
reverts_msg = reverts_msg.gsub(/\s+/, "")
data = data.drop(3)
reverts_complete = data.first
reverts_complete = reverts_complete.gsub(/\s+/, "")
data = data.drop(3)
reverts_partial = data.first
reverts_partial = reverts_partial.gsub(/\s+/, "")
data = data.drop(3)
cps_complete = data.first
cps_complete = cps_complete.gsub(/\s+/, "")
data = data.drop(3)
cps_partial = data.first
cps_partial = cps_partial.gsub(/\s+/, "")
data = data.drop(2)
project_name_repo_url_head_sha_combined = project_name + "\n" + repo_url + "\n" + head_sha
return [project_name_repo_url_head_sha_combined, num_commits, num_merges, reverts_msg, reverts_complete, reverts_partial, cps_complete, cps_partial]
end
results_file_name = "results.txt"
op_file = File.open(results_file_name, "w")
rows = []
num = 0
# Compiling results in a specific order to easily identify any changes
projects = ["backbone-fundamentals", "catalyst-runtime", "jshint", "MLPNeuralNet", "mojo", "ninja", "sails", "sinatra", "stylus", "MapDB", "codebox", "flockdb", "lime", "neovim", "pouchdb", "redis", "sharelatex", "slap", "textmate", "zed", "couchdb", "orientdb", "vim.js", "moloch", "ossec-hids", "cuckoo", "brakeman", "sleuthkit", "mig", "MozDef", "hoosegow", "backbone", "ember.js", "knockout", "todomvc", "spine", "polymer", "brick", "rubocop", "hlint", "coffeelint", "csslint", "scss-lint", "shellcheck", "puppet-lint", "eslint", "oclint", "toaruos", "phaser", "melonJS", "Crafty", "cocos2d-html5", "engine", "panda.js"]
projects.each do |file|
file = file + "-results.txt"
next if file.match(/.*-results.txt$/).nil?
complete_file_name = "Logs/" + file.to_s
f = File.open("#{complete_file_name}", "r")
info = ExtractInfoFromFileContents(f.read)
num = num.succ
info.insert(0, num)
rows << info
rows << ["","","","","","","","",""]
end
table = Terminal::Table.new :title => "Results", :headings => ['#', "ProjectName-\nRepoURL-\nHEAD SHA", "#\nCommit", "#\nMerges", "#RV-\nMsg" , "#RV-\nFull", "#RV-\nPart", "#CP-\nFull", "#CP-\nPart"], :rows => rows
puts table
op_file.puts table