corundum 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/corundum/gemcutter.rb +11 -4
- data/lib/corundum/qa-report.rb +111 -0
- data/lib/corundum/simplecov.rb +1 -0
- metadata +4 -3
data/lib/corundum/gemcutter.rb
CHANGED
@@ -10,6 +10,7 @@ module Corundum
|
|
10
10
|
setting(:build_finished_path)
|
11
11
|
setting(:gem_name)
|
12
12
|
setting(:package_dir)
|
13
|
+
setting(:qa_rejections)
|
13
14
|
|
14
15
|
def default_configuration(toolkit, build)
|
15
16
|
super
|
@@ -18,6 +19,7 @@ module Corundum
|
|
18
19
|
self.build_finished_path = toolkit.finished_files.build
|
19
20
|
self.gem_name = toolkit.gemspec.full_name
|
20
21
|
self.package_dir = build.package_dir
|
22
|
+
self.qa_rejections = toolkit.qa_rejections
|
21
23
|
end
|
22
24
|
|
23
25
|
def resolve_configuration
|
@@ -75,14 +77,18 @@ module Corundum
|
|
75
77
|
|
76
78
|
task :reinstall => [:uninstall, :install]
|
77
79
|
|
78
|
-
task :dependencies_available
|
80
|
+
task :dependencies_available do
|
81
|
+
require 'corundum/qa-report'
|
79
82
|
checker = Gem::SpecFetcher.new
|
83
|
+
report = QA::Report.new("Gem dependencies")
|
84
|
+
qa_rejections << report
|
80
85
|
gemspec.runtime_dependencies.each do |dep|
|
81
86
|
fulfilling = checker.find_matching(dep,true,false,false)
|
82
87
|
if fulfilling.empty?
|
83
|
-
|
88
|
+
report.add("missing", File::basename(gemspec.loaded_from), nil, dep)
|
89
|
+
report.fail "Dependency unfulfilled remotely"
|
84
90
|
else
|
85
|
-
|
91
|
+
report.add("fulfilled", File::basename(gemspec.loaded_from), nil, dep)
|
86
92
|
end
|
87
93
|
end
|
88
94
|
end
|
@@ -106,7 +112,8 @@ module Corundum
|
|
106
112
|
task :push => build_finished_path
|
107
113
|
end
|
108
114
|
task :release => in_namespace(:push)
|
109
|
-
task :preflight => in_namespace(:
|
115
|
+
task :preflight => in_namespace(:is_unpushed)
|
116
|
+
task :qa => in_namespace(:dependencies_available)
|
110
117
|
end
|
111
118
|
end
|
112
119
|
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Corundum
|
2
|
+
module QA
|
3
|
+
#Adopted gratefully from Xavier Shay's Cane
|
4
|
+
class ReportFormatter
|
5
|
+
def initialize(reports)
|
6
|
+
@reports = reports
|
7
|
+
end
|
8
|
+
attr_reader :reports
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
return "" if reports.empty?
|
12
|
+
|
13
|
+
widths = column_widths(reports)
|
14
|
+
|
15
|
+
reports.map do |report|
|
16
|
+
report.to_s(widths)
|
17
|
+
end.join("\n") + "\n\n" + totals + "\n\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def max_width(name, &block)
|
23
|
+
reports.map(&:rejects).flatten.map do |reject|
|
24
|
+
yield(reject).to_s.length
|
25
|
+
end.max
|
26
|
+
end
|
27
|
+
|
28
|
+
def column_widths(reports)
|
29
|
+
Hash[[:file_and_line, :label, :value].map do |name|
|
30
|
+
[name, max_width(name, &name)]
|
31
|
+
end]
|
32
|
+
end
|
33
|
+
|
34
|
+
def totals
|
35
|
+
"Total QA report items: #{reports.inject(0){|sum, report| sum + report.length}}"
|
36
|
+
"Total QA failing reports: #{reports.inject(0){|sum, report| sum + (report.passed ? 0 : 1)}}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Rejection
|
41
|
+
def initialize(label, file, line = nil, value = nil)
|
42
|
+
@file, @line, @label, @value = file, line, label, value
|
43
|
+
end
|
44
|
+
attr_reader :file, :line, :label, :value
|
45
|
+
|
46
|
+
def file_and_line
|
47
|
+
@file_and_line ||=
|
48
|
+
begin
|
49
|
+
if line.nil?
|
50
|
+
file
|
51
|
+
else
|
52
|
+
[file, line].join(":")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_s(column_widths=nil)
|
58
|
+
column_widths ||= {}
|
59
|
+
[:file_and_line, :label, :value].map do |name|
|
60
|
+
if column_widths.has_key?(name)
|
61
|
+
self.send(name).to_s.ljust(column_widths[name])
|
62
|
+
else
|
63
|
+
self.send(name).to_s
|
64
|
+
end
|
65
|
+
end.join(' ')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class Report
|
70
|
+
def initialize(name)
|
71
|
+
@name = name
|
72
|
+
@rejects = []
|
73
|
+
@passed = true
|
74
|
+
@summary = ""
|
75
|
+
end
|
76
|
+
attr_reader :name, :rejects
|
77
|
+
attr_accessor :summary, :passed
|
78
|
+
|
79
|
+
def <<(reject)
|
80
|
+
@rejects << reject
|
81
|
+
end
|
82
|
+
|
83
|
+
def add(*args)
|
84
|
+
self << Rejection.new(*args)
|
85
|
+
end
|
86
|
+
|
87
|
+
def fail(summary)
|
88
|
+
@passed = false
|
89
|
+
@summary = summary
|
90
|
+
end
|
91
|
+
|
92
|
+
def length
|
93
|
+
@rejects.length
|
94
|
+
end
|
95
|
+
alias count length
|
96
|
+
|
97
|
+
def empty?
|
98
|
+
@rejects.empty?
|
99
|
+
end
|
100
|
+
|
101
|
+
def to_s(widths=nil)
|
102
|
+
(passed ? "Ok" : "FAIL") +
|
103
|
+
": #{name} (#{length})\n" +
|
104
|
+
(summary.empty? ? "" : (summary + "\n")) +
|
105
|
+
rejects.map do |reject|
|
106
|
+
" " + reject.to_s(widths) + "\n"
|
107
|
+
end.join("")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/corundum/simplecov.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: corundum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.30
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Judson Lester
|
@@ -321,6 +321,7 @@ files:
|
|
321
321
|
- lib/corundum.rb
|
322
322
|
- lib/corundum/configuration-store.rb
|
323
323
|
- lib/corundum/core.rb
|
324
|
+
- lib/corundum/qa-report.rb
|
324
325
|
- lib/corundum/browser-task.rb
|
325
326
|
- lib/corundum/github-pages.rb
|
326
327
|
- lib/corundum/rspec.rb
|
@@ -414,7 +415,7 @@ licenses:
|
|
414
415
|
post_install_message:
|
415
416
|
rdoc_options:
|
416
417
|
- --title
|
417
|
-
- corundum-0.0.
|
418
|
+
- corundum-0.0.30 RDoc
|
418
419
|
require_paths:
|
419
420
|
- lib/
|
420
421
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -423,7 +424,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
423
424
|
- !ruby/object:Gem::Version
|
424
425
|
segments:
|
425
426
|
- 0
|
426
|
-
hash: -
|
427
|
+
hash: -251699523
|
427
428
|
version: '0'
|
428
429
|
none: false
|
429
430
|
required_rubygems_version: !ruby/object:Gem::Requirement
|