integrity_metrics 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -0
- data/CHANGELOG +3 -0
- data/README.md +32 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/integrity_metrics.gemspec +64 -0
- data/lib/integrity/grader.rb +83 -0
- data/lib/integrity/metrics_extensions.rb +76 -0
- data/lib/integrity_metrics.rb +23 -0
- data/test/acceptance/acceptance_helper.rb +150 -0
- data/test/acceptance/integrity_metrics_test.rb +71 -0
- data/views/_build_info.haml +35 -0
- metadata +134 -0
data/.gitignore
ADDED
data/CHANGELOG
ADDED
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# integrity_metrics
|
2
|
+
|
3
|
+
This is an integrity plugin that automatically runs metrics on each build after it has been tested.
|
4
|
+
It is based on [report_card](https://github.com/thoughtbot/report_card) but doesn't require a
|
5
|
+
separate site, configuration or cron job.
|
6
|
+
|
7
|
+
Report_card seems to have been abandoned but this works with the current version of integrity (v22).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
in integrity's Gemfile:
|
12
|
+
|
13
|
+
gem "integrity_metrics"
|
14
|
+
|
15
|
+
in integrity's init.rb:
|
16
|
+
|
17
|
+
require 'integrity_metrics'
|
18
|
+
|
19
|
+
and in the configure block, optionally:
|
20
|
+
|
21
|
+
c.metrics_directory = "metrics"
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Metrics will be calculated automatically on the completion of each build. Metric_fu saves its output to files
|
26
|
+
in metrics_directory/:project/output/, so we redirect from /:project/metrics to those static files. You may need
|
27
|
+
to make sure that your webserver does the right thing with static html files and other assets, but it probably does.
|
28
|
+
|
29
|
+
## Copyright
|
30
|
+
|
31
|
+
Copyright (c) 2010 William Ross for spanner. Released under the same terms as Ruby and/or Integrity.
|
32
|
+
Portions based on report_card: copyright unstated but presumably Nick Quaranto/Thoughtbot.
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "integrity_metrics"
|
8
|
+
gem.summary = %Q{Post-build metrics for integrity}
|
9
|
+
gem.description = %Q{Integrates metric_fu into integrity so that metrics are run on every build.}
|
10
|
+
gem.email = "will@spanner.org"
|
11
|
+
gem.homepage = "http://github.com/spanner/integrity_metrics"
|
12
|
+
gem.authors = ["William Ross"]
|
13
|
+
gem.add_dependency "metric_fu"
|
14
|
+
gem.add_dependency "reek"
|
15
|
+
gem.add_dependency "roodi"
|
16
|
+
gem.add_dependency "Saikuro"
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'rake/testtask'
|
24
|
+
Rake::TestTask.new(:test) do |test|
|
25
|
+
test.libs << 'lib' << 'test'
|
26
|
+
test.pattern = 'test/**/*_test.rb'
|
27
|
+
test.verbose = true
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
require 'rcov/rcovtask'
|
32
|
+
Rcov::RcovTask.new do |test|
|
33
|
+
test.libs << 'test'
|
34
|
+
test.pattern = 'test/**/*_test.rb'
|
35
|
+
test.verbose = true
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
task :rcov do
|
39
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install rcov"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
if File.exist?('VERSION.yml')
|
48
|
+
config = YAML.load(File.read('VERSION.yml'))
|
49
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
50
|
+
else
|
51
|
+
version = ""
|
52
|
+
end
|
53
|
+
|
54
|
+
rdoc.rdoc_dir = 'rdoc'
|
55
|
+
rdoc.title = "integrity_metrics #{version}"
|
56
|
+
rdoc.rdoc_files.include('README*')
|
57
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
58
|
+
end
|
59
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.2
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{integrity_metrics}
|
8
|
+
s.version = "0.1.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["William Ross"]
|
12
|
+
s.date = %q{2010-11-19}
|
13
|
+
s.description = %q{Integrates metric_fu into integrity so that metrics are run on every build.}
|
14
|
+
s.email = %q{will@spanner.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"CHANGELOG",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"integrity_metrics.gemspec",
|
25
|
+
"lib/integrity/grader.rb",
|
26
|
+
"lib/integrity/metrics_extensions.rb",
|
27
|
+
"lib/integrity_metrics.rb",
|
28
|
+
"test/acceptance/acceptance_helper.rb",
|
29
|
+
"test/acceptance/integrity_metrics_test.rb",
|
30
|
+
"views/_build_info.haml"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/spanner/integrity_metrics}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.7}
|
36
|
+
s.summary = %q{Post-build metrics for integrity}
|
37
|
+
s.test_files = [
|
38
|
+
"test/acceptance/acceptance_helper.rb",
|
39
|
+
"test/acceptance/integrity_metrics_test.rb"
|
40
|
+
]
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<metric_fu>, [">= 0"])
|
48
|
+
s.add_runtime_dependency(%q<reek>, [">= 0"])
|
49
|
+
s.add_runtime_dependency(%q<roodi>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<Saikuro>, [">= 0"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<metric_fu>, [">= 0"])
|
53
|
+
s.add_dependency(%q<reek>, [">= 0"])
|
54
|
+
s.add_dependency(%q<roodi>, [">= 0"])
|
55
|
+
s.add_dependency(%q<Saikuro>, [">= 0"])
|
56
|
+
end
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<metric_fu>, [">= 0"])
|
59
|
+
s.add_dependency(%q<reek>, [">= 0"])
|
60
|
+
s.add_dependency(%q<roodi>, [">= 0"])
|
61
|
+
s.add_dependency(%q<Saikuro>, [">= 0"])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'metric_fu'
|
2
|
+
|
3
|
+
module Integrity
|
4
|
+
class Grader
|
5
|
+
# Adapted from report_card to apply metric_fu to each just-completed build.
|
6
|
+
# Reports are saved to /metrics/:project/output
|
7
|
+
# and previous data stored in /metrics/:project/report.yml.
|
8
|
+
# Everything else is standard metric_fu.
|
9
|
+
|
10
|
+
def self.grade(_build, data_directory, report_directory, logger)
|
11
|
+
new(_build, data_directory, report_directory, logger).grade
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(build, data_directory, report_directory, logger)
|
15
|
+
@build = build
|
16
|
+
@data_directory = data_directory
|
17
|
+
@report_directory = report_directory || "metrics"
|
18
|
+
@logger = logger
|
19
|
+
end
|
20
|
+
|
21
|
+
def grade
|
22
|
+
start
|
23
|
+
configure
|
24
|
+
generate
|
25
|
+
wrapup
|
26
|
+
end
|
27
|
+
|
28
|
+
def start
|
29
|
+
@logger.info "Build metrics for #{@build.project.name}"
|
30
|
+
ENV['CC_BUILD_ARTIFACTS'] = File.join("../../public/", @report_directory, @build.project.permalink)
|
31
|
+
@old_dir = Dir.getwd
|
32
|
+
Dir.chdir directory
|
33
|
+
end
|
34
|
+
|
35
|
+
def directory
|
36
|
+
@directory ||= @data_directory.join(@build.id.to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
def configure
|
40
|
+
MetricFu::Configuration.run do |config|
|
41
|
+
config.reset
|
42
|
+
config.template_class = AwesomeTemplate
|
43
|
+
config.file_globs_to_ignore = ['lib/generators/**/*']
|
44
|
+
config.code_dirs << 'vendor/extensions'
|
45
|
+
config.rcov = { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb' ],
|
46
|
+
:rcov_opts => ["--sort coverage",
|
47
|
+
"--no-html",
|
48
|
+
"--text-coverage",
|
49
|
+
"--no-color",
|
50
|
+
"--profile",
|
51
|
+
"--rails",
|
52
|
+
"--include test",
|
53
|
+
"--exclude /gems/,/usr/local/lib/site_ruby/1.8/,spec"]}
|
54
|
+
end
|
55
|
+
MetricFu.report.instance_variable_set(:@report_hash, {})
|
56
|
+
end
|
57
|
+
|
58
|
+
def generate
|
59
|
+
begin
|
60
|
+
MetricFu.metrics.each { |metric| MetricFu.report.add(metric) }
|
61
|
+
MetricFu.graphs.each { |graph| MetricFu.graph.add(graph, :bluff) }
|
62
|
+
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.base_directory, 'report.yml')
|
63
|
+
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.data_directory, "#{Time.now.strftime("%Y%m%d")}.yml")
|
64
|
+
MetricFu.report.save_templatized_report
|
65
|
+
MetricFu.graph.generate
|
66
|
+
@success = true
|
67
|
+
rescue Exception => e
|
68
|
+
@logger.error "Problem generating the reports: #{e}"
|
69
|
+
@success = false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def wrapup
|
74
|
+
Dir.chdir @old_dir
|
75
|
+
end
|
76
|
+
|
77
|
+
def success?
|
78
|
+
@success
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Integrity
|
2
|
+
module AppExt
|
3
|
+
# Interferes with haml rendering to give priority to extension templates.
|
4
|
+
# Crudely done here in preparation for a more general solution in Integrity.
|
5
|
+
|
6
|
+
def haml(template, options = {}, locals = {})
|
7
|
+
options[:views] = extension_view_path if extension_template_exists?(:haml, template)
|
8
|
+
super(template, options, locals)
|
9
|
+
end
|
10
|
+
|
11
|
+
def extension_template_exists?(engine, template)
|
12
|
+
File.exist?(File.join(extension_view_path, "#{template}.#{engine}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
def extension_view_path
|
16
|
+
File.join(File.dirname(__FILE__), '/../../views')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module BuilderExt
|
21
|
+
# Inserts metrics into the build execution sequence between complete and notify.
|
22
|
+
|
23
|
+
def self.included(base)
|
24
|
+
base.class_eval {
|
25
|
+
include InstanceMethods
|
26
|
+
alias_method_chain :complete, :metrics
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
module InstanceMethods
|
31
|
+
def complete_with_metrics
|
32
|
+
complete_without_metrics
|
33
|
+
metrics
|
34
|
+
end
|
35
|
+
|
36
|
+
def metrics
|
37
|
+
@build.grade
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module BuildExt
|
43
|
+
# Adds a #grade call structured very similarly to #build.
|
44
|
+
|
45
|
+
def grade
|
46
|
+
Grader.grade(self, Integrity.config.directory, Integrity.config.metrics_directory, Integrity.logger)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module ConfigExt
|
51
|
+
# Supports the configuration of metric paths and (later) options.
|
52
|
+
|
53
|
+
def self.included(base)
|
54
|
+
base.class_eval {
|
55
|
+
attr_reader :metrics_directory
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def metrics_directory=(dir)
|
60
|
+
@metrics_directory = Pathname(dir)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
module MetricsHelpers
|
65
|
+
# Adds url helpers for metrics addresses.
|
66
|
+
|
67
|
+
def metrics_url(project)
|
68
|
+
project_url(project, 'metrics')
|
69
|
+
end
|
70
|
+
|
71
|
+
def metrics_path(project, *path)
|
72
|
+
project_path(project, 'metrics')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "integrity/grader"
|
2
|
+
require "integrity/metrics_extensions"
|
3
|
+
|
4
|
+
module IntegrityMetrics
|
5
|
+
def self.registered(app)
|
6
|
+
Integrity::App.send :include, Integrity::AppExt
|
7
|
+
Integrity::Configuration.send :include, Integrity::ConfigExt
|
8
|
+
Integrity::Build.send :include, Integrity::BuildExt
|
9
|
+
Integrity::Builder.send :include, Integrity::BuilderExt
|
10
|
+
|
11
|
+
app.helpers Integrity::MetricsHelpers
|
12
|
+
|
13
|
+
app.get "/:project/metrics" do
|
14
|
+
login_required unless current_project.public?
|
15
|
+
metrics_directory = Integrity.config.metrics_directory || "metrics"
|
16
|
+
redirect "/#{metrics_directory}/#{current_project.permalink}/output/index.html"
|
17
|
+
end
|
18
|
+
|
19
|
+
Integrity.logger.info "Metrics loaded"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Integrity::App.register IntegrityMetrics
|
@@ -0,0 +1,150 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + "/../lib", File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
|
5
|
+
require "test/unit"
|
6
|
+
require "rr"
|
7
|
+
require "mocha"
|
8
|
+
require "dm-sweatshop"
|
9
|
+
require "webrat/sinatra"
|
10
|
+
|
11
|
+
gem "jeremymcanally-context"
|
12
|
+
gem "jeremymcanally-matchy"
|
13
|
+
gem "jeremymcanally-pending"
|
14
|
+
require "context"
|
15
|
+
require "matchy"
|
16
|
+
require "pending"
|
17
|
+
|
18
|
+
require "integrity"
|
19
|
+
require "integrity/notifier/test/fixtures"
|
20
|
+
|
21
|
+
begin
|
22
|
+
require "ruby-debug"
|
23
|
+
require "redgreen"
|
24
|
+
rescue LoadError
|
25
|
+
end
|
26
|
+
|
27
|
+
module TestHelper
|
28
|
+
def ignore_logs!
|
29
|
+
Integrity.config[:log] = "/tmp/integrity.test.log"
|
30
|
+
end
|
31
|
+
|
32
|
+
def capture_stdout
|
33
|
+
output = StringIO.new
|
34
|
+
$stdout = output
|
35
|
+
yield
|
36
|
+
$stdout = STDOUT
|
37
|
+
output
|
38
|
+
end
|
39
|
+
|
40
|
+
def silence_warnings
|
41
|
+
$VERBOSE, v = nil, $VERBOSE
|
42
|
+
yield
|
43
|
+
ensure
|
44
|
+
$VERBOSE = v
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Test::Unit::TestCase
|
49
|
+
class << self
|
50
|
+
alias_method :specify, :test
|
51
|
+
end
|
52
|
+
|
53
|
+
include RR::Adapters::TestUnit
|
54
|
+
include Integrity
|
55
|
+
include TestHelper
|
56
|
+
|
57
|
+
before(:all) do
|
58
|
+
DataMapper.setup(:default, "sqlite3::memory:")
|
59
|
+
|
60
|
+
require "integrity/migrations"
|
61
|
+
end
|
62
|
+
|
63
|
+
before(:each) do
|
64
|
+
[Project, Build, Commit, Notifier].each{ |i| i.auto_migrate_down! }
|
65
|
+
capture_stdout { Integrity.migrate_db }
|
66
|
+
Notifier.available.clear
|
67
|
+
Integrity.instance_variable_set(:@config, nil)
|
68
|
+
end
|
69
|
+
|
70
|
+
after(:each) do
|
71
|
+
capture_stdout { Integrity::Migrations.migrate_down! }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
gem "foca-storyteller"
|
76
|
+
require "storyteller"
|
77
|
+
|
78
|
+
module AcceptanceHelper
|
79
|
+
include FileUtils
|
80
|
+
|
81
|
+
def export_directory
|
82
|
+
File.dirname(__FILE__) + "/../../exports"
|
83
|
+
end
|
84
|
+
|
85
|
+
def enable_auth!
|
86
|
+
Integrity.config[:use_basic_auth] = true
|
87
|
+
Integrity.config[:admin_username] = "admin"
|
88
|
+
Integrity.config[:admin_password] = "test"
|
89
|
+
Integrity.config[:hash_admin_password] = false
|
90
|
+
end
|
91
|
+
|
92
|
+
def login_as(user, password)
|
93
|
+
def AcceptanceHelper.logged_in; true; end
|
94
|
+
basic_auth user, password
|
95
|
+
visit "/login"
|
96
|
+
Integrity::App.before { login_required if AcceptanceHelper.logged_in }
|
97
|
+
end
|
98
|
+
|
99
|
+
def log_out
|
100
|
+
def AcceptanceHelper.logged_in; false; end
|
101
|
+
@_webrat_session = Webrat::SinatraSession.new(self)
|
102
|
+
end
|
103
|
+
|
104
|
+
def disable_auth!
|
105
|
+
Integrity.config[:use_basic_auth] = false
|
106
|
+
end
|
107
|
+
|
108
|
+
def set_and_create_export_directory!
|
109
|
+
FileUtils.rm_r(export_directory) if File.directory?(export_directory)
|
110
|
+
FileUtils.mkdir(export_directory)
|
111
|
+
Integrity.config[:export_directory] = export_directory
|
112
|
+
end
|
113
|
+
|
114
|
+
def setup_log!
|
115
|
+
log_file = Pathname(File.dirname(__FILE__) + "/../../integrity.log")
|
116
|
+
log_file.delete if log_file.exist?
|
117
|
+
Integrity.config[:log] = log_file
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class Test::Unit::AcceptanceTestCase < Test::Unit::TestCase
|
122
|
+
include AcceptanceHelper
|
123
|
+
include Test::Storyteller
|
124
|
+
include Webrat::Methods
|
125
|
+
include Webrat::Matchers
|
126
|
+
include Webrat::HaveTagMatcher
|
127
|
+
|
128
|
+
Webrat::Methods.delegate_to_session :response_code
|
129
|
+
|
130
|
+
def app
|
131
|
+
Integrity::App
|
132
|
+
end
|
133
|
+
|
134
|
+
before(:all) do
|
135
|
+
app.set(:environment, :test)
|
136
|
+
end
|
137
|
+
|
138
|
+
before(:each) do
|
139
|
+
# ensure each scenario is run in a clean sandbox
|
140
|
+
Integrity.config[:base_uri] = "http://www.example.com"
|
141
|
+
enable_auth!
|
142
|
+
setup_log!
|
143
|
+
set_and_create_export_directory!
|
144
|
+
log_out
|
145
|
+
end
|
146
|
+
|
147
|
+
after(:each) do
|
148
|
+
rm_r export_directory if File.directory?(export_directory)
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Unclear how to get ahold of Integrity's test helpers externally. For now,
|
2
|
+
# I've been copying this into an unpacked version of Integrity and running it
|
3
|
+
# there.
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + "/acceptance_helper"
|
6
|
+
require 'integrity/integritray'
|
7
|
+
|
8
|
+
class MetricsTest < Test::Unit::AcceptanceTestCase
|
9
|
+
include Integrity::Helpers::Urls
|
10
|
+
|
11
|
+
story <<-EOS
|
12
|
+
As a user,
|
13
|
+
I want to assess the code quality of my projects
|
14
|
+
EOS
|
15
|
+
|
16
|
+
scenario "projects.xml has a tag representing my project" do
|
17
|
+
project = Project.gen(:integrity, :public => true, :commits => 2.of { Commit.gen(:successful)})
|
18
|
+
commit = project.last_commit
|
19
|
+
visit "/projects.xml"
|
20
|
+
|
21
|
+
assert_have_tag("projects")
|
22
|
+
assert_have_tag("projects/project[@name='Integrity']")
|
23
|
+
assert_have_tag("projects/project[@lastbuildlabel='#{commit.short_identifier}']")
|
24
|
+
assert_have_tag("projects/project[@weburl='#{project_url(project)}']")
|
25
|
+
assert_have_tag("projects/project[@category='#{project.branch}']")
|
26
|
+
assert_have_tag("projects/project[@activity='Sleeping']")
|
27
|
+
assert_have_tag("projects/project[@lastbuildstatus='Success']")
|
28
|
+
end
|
29
|
+
|
30
|
+
scenario "projects.xml has a tag representing my pending project" do
|
31
|
+
project = Project.gen(:integrity, :public => true, :commits => 2.of { Commit.gen(:pending)})
|
32
|
+
commit = project.last_commit
|
33
|
+
visit "/projects.xml"
|
34
|
+
|
35
|
+
assert_have_tag("projects")
|
36
|
+
assert_have_tag("projects/project[@name='Integrity']")
|
37
|
+
assert_have_tag("projects/project[@lastbuildlabel='#{commit.short_identifier}']")
|
38
|
+
assert_have_tag("projects/project[@weburl='#{project_url(project)}']")
|
39
|
+
assert_have_tag("projects/project[@category='#{project.branch}']")
|
40
|
+
assert_have_tag("projects/project[@activity='Building']")
|
41
|
+
assert_have_tag("projects/project[@lastbuildstatus='Success']")
|
42
|
+
end
|
43
|
+
|
44
|
+
scenario "projects.xml has a tag representing my failed project" do
|
45
|
+
project = Project.gen(:integrity, :public => true, :commits => 2.of { Commit.gen(:failed)})
|
46
|
+
commit = project.last_commit
|
47
|
+
visit "/projects.xml"
|
48
|
+
|
49
|
+
assert_have_tag("projects")
|
50
|
+
assert_have_tag("projects/project[@name='Integrity']")
|
51
|
+
assert_have_tag("projects/project[@lastbuildlabel='#{commit.short_identifier}']")
|
52
|
+
assert_have_tag("projects/project[@weburl='#{project_url(project)}']")
|
53
|
+
assert_have_tag("projects/project[@category='#{project.branch}']")
|
54
|
+
assert_have_tag("projects/project[@activity='Sleeping']")
|
55
|
+
assert_have_tag("projects/project[@lastbuildstatus='Failure']")
|
56
|
+
end
|
57
|
+
|
58
|
+
scenario "projects.xml has a tag representing my unbuilt project" do
|
59
|
+
project = Project.gen(:integrity, :public => true)
|
60
|
+
commit = project.last_commit
|
61
|
+
puts commit.inspect
|
62
|
+
visit "/projects.xml"
|
63
|
+
|
64
|
+
assert_have_tag("projects")
|
65
|
+
assert_have_tag("projects/project[@name='Integrity']")
|
66
|
+
assert_have_tag("projects/project[@weburl='#{project_url(project)}']")
|
67
|
+
assert_have_tag("projects/project[@category='#{project.branch}']")
|
68
|
+
assert_have_no_tag("projects/project[@activity]")
|
69
|
+
assert_have_no_tag("projects/project[@lastbuildstatus]")
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
%h1&= build.human_status
|
2
|
+
|
3
|
+
%form{ :action => build_path(build), :method => :post }
|
4
|
+
%p.submit
|
5
|
+
%button{ :type => :submit, :title => "Rebuild this commit" }<
|
6
|
+
Rebuild
|
7
|
+
|
8
|
+
%blockquote
|
9
|
+
%p&= build.message
|
10
|
+
%p.meta<
|
11
|
+
%span.who<
|
12
|
+
&== by: #{build.author}
|
13
|
+
|
|
14
|
+
%span.when{ :title => build.committed_at }<
|
15
|
+
&= pretty_date build.committed_at
|
16
|
+
- if build.project.github?
|
17
|
+
|
|
18
|
+
%span.github<
|
19
|
+
%a{ :href => github_commit_url(build) } view on GitHub
|
20
|
+
|
|
21
|
+
- if build.completed?
|
22
|
+
%span.metrics<
|
23
|
+
%a{ :href => metrics_url(build.project) } metrics
|
24
|
+
|
25
|
+
- if build.completed?
|
26
|
+
%h2
|
27
|
+
Metrics
|
28
|
+
|
29
|
+
%h2
|
30
|
+
Build Output
|
31
|
+
%a{:href => build_path(build, :raw)} (raw)
|
32
|
+
|
33
|
+
%pre.output
|
34
|
+
:preserve
|
35
|
+
#{bash_color_codes h(build.output)}
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: integrity_metrics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- William Ross
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-19 00:00:00 +00:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: metric_fu
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: reek
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: roodi
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: Saikuro
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :runtime
|
76
|
+
version_requirements: *id004
|
77
|
+
description: Integrates metric_fu into integrity so that metrics are run on every build.
|
78
|
+
email: will@spanner.org
|
79
|
+
executables: []
|
80
|
+
|
81
|
+
extensions: []
|
82
|
+
|
83
|
+
extra_rdoc_files:
|
84
|
+
- README.md
|
85
|
+
files:
|
86
|
+
- .gitignore
|
87
|
+
- CHANGELOG
|
88
|
+
- README.md
|
89
|
+
- Rakefile
|
90
|
+
- VERSION
|
91
|
+
- integrity_metrics.gemspec
|
92
|
+
- lib/integrity/grader.rb
|
93
|
+
- lib/integrity/metrics_extensions.rb
|
94
|
+
- lib/integrity_metrics.rb
|
95
|
+
- test/acceptance/acceptance_helper.rb
|
96
|
+
- test/acceptance/integrity_metrics_test.rb
|
97
|
+
- views/_build_info.haml
|
98
|
+
has_rdoc: true
|
99
|
+
homepage: http://github.com/spanner/integrity_metrics
|
100
|
+
licenses: []
|
101
|
+
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options:
|
104
|
+
- --charset=UTF-8
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
requirements: []
|
126
|
+
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.3.7
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: Post-build metrics for integrity
|
132
|
+
test_files:
|
133
|
+
- test/acceptance/acceptance_helper.rb
|
134
|
+
- test/acceptance/integrity_metrics_test.rb
|