cerberus 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.txt +9 -0
- data/Rakefile +17 -13
- data/Readme.markdown +135 -0
- data/lib/cerberus/builder/rake.rb +4 -0
- data/lib/cerberus/builder/rant.rb +4 -0
- data/lib/cerberus/builder/ruby.rb +33 -0
- data/lib/cerberus/builder/ruby_base.rb +1 -1
- data/lib/cerberus/component_lazy_loader.rb +2 -1
- data/lib/cerberus/constants.rb +1 -1
- data/lib/cerberus/manager.rb +4 -3
- data/lib/cerberus/publisher/base.rb +5 -5
- data/lib/cerberus/publisher/twitter.rb +1 -1
- data/lib/cerberus/scm/git.rb +42 -19
- data/lib/cerberus/utils.rb +2 -2
- data/test/functional_test.rb +1 -1
- data/test/mail_publisher_test.rb +1 -1
- data/test/mock/twitter.rb +1 -1
- data/test/ruby_builder_test.rb +77 -0
- metadata +6 -4
- data/Readme.txt +0 -104
- data/test/data/git.zip.bak +0 -0
data/Changelog.txt
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
= Cerberus Changelog
|
2
2
|
|
3
|
+
== Version 0.6
|
4
|
+
New Ruby builder, bugfixes, and refactoring
|
5
|
+
|
6
|
+
* added new Ruby builder for using custom ruby scripts to build projects
|
7
|
+
* fixed issue with require explicit version of the twitter4r gem
|
8
|
+
* refactoring and cleanup of the git SCM code
|
9
|
+
* some cleanup of the 'cerberus status' command output
|
10
|
+
* only check for process exit status or abort message for ruby_base builder
|
11
|
+
|
3
12
|
== Version 0.5
|
4
13
|
Bugfixes and Ticket Support
|
5
14
|
|
data/Rakefile
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
%w(rubygems rake rake/clean rake/testtask fileutils newgem rubigen).each { |f| require f }
|
2
|
+
require File.join( File.dirname(__FILE__), 'lib', 'cerberus', 'constants.rb' )
|
3
|
+
|
1
4
|
require 'rubygems'
|
2
5
|
require 'rake'
|
3
6
|
require 'rake/testtask'
|
4
7
|
require 'rake/packagetask'
|
5
8
|
require 'rake/gempackagetask'
|
6
9
|
|
7
|
-
require "./lib/cerberus/constants"
|
8
|
-
|
9
10
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
10
11
|
PKG_NAME = 'cerberus'
|
11
12
|
PKG_VERSION = Cerberus::VERSION + PKG_BUILD
|
@@ -34,6 +35,15 @@ task :clean => :clobber_package do
|
|
34
35
|
rm_rf "#{root}/doc/site/webgen.cache"
|
35
36
|
end
|
36
37
|
|
38
|
+
# $hoe = Hoe.new('cerberus', Cerberus::VERSION) do |p|
|
39
|
+
# p.rubyforge_name = p.name
|
40
|
+
# p.developer( 'Craig P Jolicoeur', 'cpjolicoeur@gmail.com' )
|
41
|
+
# p.url = 'http://cerberus.rubyforge.org'
|
42
|
+
# p.need_tar = true
|
43
|
+
# p.need_zip = true
|
44
|
+
#
|
45
|
+
# p.changes = p.paragraphs_of( 'Changelog.txt', 0..1 ).join( "\n\n" )
|
46
|
+
# end
|
37
47
|
|
38
48
|
GEM_SPEC = Gem::Specification.new do |s|
|
39
49
|
s.name = PKG_NAME
|
@@ -58,7 +68,7 @@ GEM_SPEC = Gem::Specification.new do |s|
|
|
58
68
|
s.add_dependency 'twitter4r', '>= 0.3.0'
|
59
69
|
|
60
70
|
s.files = Dir.glob("{bin,lib,test}/**/*").delete_if { |item| item.include?('__workdir') }
|
61
|
-
s.files += %w(License.txt Readme.
|
71
|
+
s.files += %w(License.txt Readme.markdown Changelog.txt Rakefile)
|
62
72
|
s.files += Dir.glob("doc/*").delete_if { |item| item.include?('__workdir') }
|
63
73
|
|
64
74
|
s.bindir = "bin"
|
@@ -126,8 +136,6 @@ task :release_files => [:clean, :package] do
|
|
126
136
|
release.files = release_files.to_a
|
127
137
|
release.package_name = PKG_NAME
|
128
138
|
release.release_name = "Cerberus #{PKG_VERSION}"
|
129
|
-
release.release_notes = IO.read( File.dirname( __FILE__ ) + '/Changelog.txt' )
|
130
|
-
release.release_changes = IO.read( File.dirname( __FILE__ ) + '/Changelog.txt' )
|
131
139
|
end
|
132
140
|
|
133
141
|
end
|
@@ -145,16 +153,12 @@ task :publish_news do
|
|
145
153
|
end
|
146
154
|
|
147
155
|
require 'webgen/webgentask'
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
t.directory = File.join( File.dirname( __FILE__ ), 'doc/site')
|
152
|
-
t.clobber_outdir = true
|
153
|
-
end
|
154
|
-
|
156
|
+
Webgen::WebgenTask.new do |t|
|
157
|
+
t.directory = File.join( File.dirname( __FILE__ ), 'doc/site')
|
158
|
+
t.clobber_outdir = true
|
155
159
|
end
|
156
160
|
|
157
|
-
task :publish_site => :
|
161
|
+
task :publish_site => :webgen do
|
158
162
|
sh %{scp -r -q doc/site/out/* #{RUBYFORGE_USER}@rubyforge.org:/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/}
|
159
163
|
end
|
160
164
|
|
data/Readme.markdown
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# Description
|
2
|
+
|
3
|
+
Cerberus is a Continuous Integration software written in Ruby. Cerberus can be periodically run from scheduler to check if application tests are broken. In the case of test failure, Cerberus will send notification alerts via various methods. Cerberus perfectly works both on Windows and *nix platforms.
|
4
|
+
|
5
|
+
For more CI theory, [read this document from Martin Fowler][1].
|
6
|
+
|
7
|
+
Cerberus's website is at [http://cerberus.rubyforge.org][6].
|
8
|
+
|
9
|
+
***
|
10
|
+
|
11
|
+
What does the 'Cerberus' name mean?
|
12
|
+
> Quote from Wikipedia (http://en.wikipedia.org/wiki/Cerberus)
|
13
|
+
>
|
14
|
+
> Cerberus or Kerberos (Kerberos, demon of the pit), was the hound of Hades-a monstrous three-headed dog (sometimes said to have 50 or 100 heads) with a snake for a tail and innumerable snake heads on his back.
|
15
|
+
He guarded the gate to Hades (the Greek underworld) and ensured that the dead could not leave and the living could not enter. His brother was Orthrus. He is the offspring of Echidna and Typhon.
|
16
|
+
|
17
|
+
So, put simply, Cerberus will guard your tests and not allow your project to go to the world of dead.
|
18
|
+
|
19
|
+
***
|
20
|
+
|
21
|
+
There are several CI solutions already present, why do you need to use Cerberus?
|
22
|
+
|
23
|
+
Main advantages of Cerberus over other solutions include:
|
24
|
+
|
25
|
+
1. Cerberus could be installed on any machine not only where the repository is located.
|
26
|
+
2. Cerberus works not only for Rails projects, but for any other Ruby projects as well as for other platforms (Maven2 for Java)
|
27
|
+
3. Cerberus multi-platform solution: it runs excellent both on *nix and Windows.
|
28
|
+
4. Cerberus is distributed via RubyGems, making it very easy to install and very easy to update to the latest stable version
|
29
|
+
5. Cerberus is very easy to start using. Just type 'cerberus add PROJECT_URL|PROJECT_DIR'
|
30
|
+
6. Cerberus is a lightweight solution: a simple command line CI tool that only runs when the repository has changes
|
31
|
+
|
32
|
+
## Requirements
|
33
|
+
|
34
|
+
* ruby - 1.8.2 or higher
|
35
|
+
* rake - 0.7.3 or higher (optional)
|
36
|
+
* actionmailer - 1.3.3 or higher (optional)
|
37
|
+
* activesupport - 1.4.2 or higher (optional)
|
38
|
+
* xmpp4r - 0.3.1 or higher (optional)
|
39
|
+
* Ruby-IRC - 1.0.7 or higher (optional)
|
40
|
+
* gmailer - 0.1.7 or higher (optional)
|
41
|
+
* twitter4r - 0.3.0 or higher (optional)
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
Cerberus is installed like any other Ruby gem.
|
46
|
+
|
47
|
+
gem install cerberus
|
48
|
+
|
49
|
+
Alternatively, you can get Cerberus in gem, zip or tarball right from [the RubyForge download page][5]
|
50
|
+
|
51
|
+
Next, add a project that will be watched by Cerberus.
|
52
|
+
|
53
|
+
cerberus add _REPOSITORY_
|
54
|
+
|
55
|
+
The repository can be either a file path or URL. Additional parameters can be found in the [wiki][2].
|
56
|
+
|
57
|
+
Next, go to ~/.cerberus and edit the config.yml file (only needed once after installing Cerberus). Enter your configuration options here like email server, password, user_name and other options. See ActionMailer description - Cerberus uses it as notification layer. An example config file looks like this:
|
58
|
+
|
59
|
+
publisher:
|
60
|
+
mail:
|
61
|
+
address: mail.someserver.com
|
62
|
+
user_name: foobar
|
63
|
+
password: foobaz
|
64
|
+
domain: someserver.com
|
65
|
+
authentication: login
|
66
|
+
|
67
|
+
Also check ~/.cerberus/config/<PROJECT_NAME>.yml and make sure that you have right settings specific to the project.
|
68
|
+
|
69
|
+
Next run Cerberus
|
70
|
+
|
71
|
+
cerberus build PROJECT_NAME # Run project
|
72
|
+
|
73
|
+
or
|
74
|
+
|
75
|
+
cerberus buildall # Run all available projects
|
76
|
+
|
77
|
+
|
78
|
+
Cerberus will check out the latest repository sources and run tests for your project. If tests fail, the notification alerts will be sent
|
79
|
+
|
80
|
+
You can also schedule Cerberus to run via CRON to automate the process.
|
81
|
+
|
82
|
+
|
83
|
+
## Features
|
84
|
+
|
85
|
+
Cerberus currently supports the following SCM tools:
|
86
|
+
|
87
|
+
* Subversion
|
88
|
+
* Git
|
89
|
+
* Darcs
|
90
|
+
* Perforce
|
91
|
+
* CVS
|
92
|
+
|
93
|
+
Cerberus currently supports the following notification systems:
|
94
|
+
|
95
|
+
* Email
|
96
|
+
* Jabber
|
97
|
+
* IRC
|
98
|
+
* RSS
|
99
|
+
* Campfire
|
100
|
+
* Twitter
|
101
|
+
|
102
|
+
Cerberus currently supports the following build systems:
|
103
|
+
|
104
|
+
* Rake
|
105
|
+
* Ruby script
|
106
|
+
* RSpec
|
107
|
+
* Rant
|
108
|
+
* Maven2
|
109
|
+
* Bjam
|
110
|
+
|
111
|
+
|
112
|
+
## Documentation
|
113
|
+
|
114
|
+
For instructions, guides and documentation, [please refer to the GitHub wiki][2].
|
115
|
+
|
116
|
+
## Mailing List / Public Forums
|
117
|
+
|
118
|
+
[http://groups.google.com/group/cerberusci][3]
|
119
|
+
|
120
|
+
## Issue Tracker
|
121
|
+
|
122
|
+
[http://cpjolicoeur.lighthouseapp.com/projects/22299-cerberus][4]
|
123
|
+
|
124
|
+
## License
|
125
|
+
|
126
|
+
This plugin is licensed under the MIT license. Complete license text
|
127
|
+
is included in the License.txt file.
|
128
|
+
|
129
|
+
|
130
|
+
[1]:http://www.martinfowler.com/articles/continuousIntegration.html
|
131
|
+
[2]:http://wiki.github.com/cpjolicoeur/cerberusci
|
132
|
+
[3]:http://groups.google.com/group/cerberusci
|
133
|
+
[4]:http://cpjolicoeur.lighthouseapp.com/projects/22299-cerberus
|
134
|
+
[5]:http://rubyforge.org/frs/?group_id=1794
|
135
|
+
[6]:http://cerberus.rubyforge.org
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'cerberus/builder/ruby_base'
|
2
|
+
|
3
|
+
class Cerberus::Builder::Ruby < Cerberus::Builder::RubyBase
|
4
|
+
def initialize(config)
|
5
|
+
super(config, "ruby")
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
ENV['PATH'] = "#{@config[:builder, @name.to_sym, :ruby_path]}::#{ENV['PATH']}"
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def successful?
|
14
|
+
if ( @config[:builder, @name.to_sym, :failure] and @config[:builder, @name.to_sym, :success] )
|
15
|
+
$?.exitstatus == 0 and !@output.include?(@config[:builder, @name.to_sym, :failure]) and @output.include?(@config[:builder, @name.to_sym, :success])
|
16
|
+
else
|
17
|
+
super # use RubyBase default if custom :success and :failure not specified
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def brokeness
|
22
|
+
if @config[:builder, @name.to_sym, :brokeness]
|
23
|
+
re = Regexp.new( @config[:builder, @name.to_sym, :brokeness] )
|
24
|
+
md = re.match( @output )
|
25
|
+
if md
|
26
|
+
return md.captures.inject( 0 ) { |sum, n| sum += n.to_i }
|
27
|
+
end
|
28
|
+
else
|
29
|
+
super # use RubyBase default if custom :brokeness not specified
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -16,7 +16,7 @@ class Cerberus::Builder::RubyBase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def successful?
|
19
|
-
$?.exitstatus == 0 and not @output.include?("#{@cmd} aborted!")
|
19
|
+
$?.exitstatus == 0 and not @output.include?("#{@cmd} aborted!")
|
20
20
|
end
|
21
21
|
|
22
22
|
def brokeness
|
data/lib/cerberus/constants.rb
CHANGED
data/lib/cerberus/manager.rb
CHANGED
@@ -37,9 +37,10 @@ module Cerberus
|
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
40
|
+
|
40
41
|
def extract_project_name(path)
|
41
42
|
path = File.expand_path(path) if test(?d, path)
|
42
|
-
File.basename(path).strip
|
43
|
+
File.basename(path).strip.gsub( /\.git$/, '' )
|
43
44
|
end
|
44
45
|
|
45
46
|
def create_example_config
|
@@ -241,9 +242,9 @@ module Cerberus
|
|
241
242
|
delim = ' | '
|
242
243
|
cols = [
|
243
244
|
['Project Name', 30, lambda { |p, s| p }],
|
244
|
-
['Revision', 10, lambda { |p, s| "
|
245
|
+
['Revision', 10, lambda { |p, s| "#{s.revision.to_s.slice( 0, 8 ) }"}],
|
245
246
|
['Status', 10, lambda { |p, s| s.previous_build_successful ? 'Pass' : 'Fail' }],
|
246
|
-
['Last Success', 10, lambda { |p, s| "
|
247
|
+
['Last Success', 10, lambda { |p, s| "#{s.successful_build_revision.to_s.slice( 0, 8 )}"}],
|
247
248
|
]
|
248
249
|
header = cols.map { |head, size, lamb| head.ljust(size) }.join(delim)
|
249
250
|
puts '-' * header.length
|
@@ -7,7 +7,7 @@ module Cerberus
|
|
7
7
|
subject =
|
8
8
|
case state.current_state
|
9
9
|
when :setup
|
10
|
-
"Cerberus set up for project (
|
10
|
+
"Cerberus set up for project (#{manager.scm.current_revision})"
|
11
11
|
when :broken
|
12
12
|
additional_message = nil
|
13
13
|
if state.previous_brokeness and state.current_brokeness
|
@@ -19,15 +19,15 @@ module Cerberus
|
|
19
19
|
' and getting worse'
|
20
20
|
end
|
21
21
|
end
|
22
|
-
"Build still broken#{additional_message} (
|
22
|
+
"Build still broken#{additional_message} (#{manager.scm.current_revision})"
|
23
23
|
|
24
24
|
#FIXME instead of using last author as person that broken build try to guess it. I.e. only if one author since last commit did commit - then he broken it.
|
25
25
|
when :failed
|
26
|
-
"Build broken by #{manager.scm.last_author} (
|
26
|
+
"Build broken by #{manager.scm.last_author} (#{manager.scm.current_revision})"
|
27
27
|
when :revival
|
28
|
-
"Build fixed by #{manager.scm.last_author} (
|
28
|
+
"Build fixed by #{manager.scm.last_author} (#{manager.scm.current_revision})"
|
29
29
|
when :successful
|
30
|
-
"Build successful (
|
30
|
+
"Build successful (#{manager.scm.current_revision})"
|
31
31
|
else
|
32
32
|
raise "Unknown build state '#{state.current_state.to_s}'"
|
33
33
|
end
|
@@ -13,7 +13,7 @@ require 'cerberus/utils'
|
|
13
13
|
class Cerberus::Publisher::Twitter < Cerberus::Publisher::Base
|
14
14
|
def self.publish(state, manager, options)
|
15
15
|
begin
|
16
|
-
gem 'twitter4r', '0.3.0'
|
16
|
+
gem 'twitter4r', '>=0.3.0'
|
17
17
|
require 'twitter'
|
18
18
|
|
19
19
|
twitter_options = options[:publisher, :twitter]
|
data/lib/cerberus/scm/git.rb
CHANGED
@@ -14,29 +14,31 @@ class Cerberus::SCM::Git
|
|
14
14
|
|
15
15
|
def update!
|
16
16
|
if test(?d, @path + '/.git')
|
17
|
-
|
18
|
-
|
17
|
+
get_updates
|
18
|
+
execute("reset", "--hard #{remote_head}")
|
19
19
|
else
|
20
20
|
FileUtils.rm_rf(@path) if test(?d, @path)
|
21
21
|
encoded_url = (@config[:scm, :url].include?(' ') ? "\"#{@config[:scm, :url]}\"" : @config[:scm, :url])
|
22
|
+
@new = true
|
22
23
|
@status = execute("clone", "#{encoded_url} #{@path}", false)
|
23
|
-
if @config[:scm, :branch]
|
24
|
-
branch
|
25
|
-
execute('branch', "--track #{branch} origin/#{branch}")
|
24
|
+
if branch = @config[:scm, :branch]
|
25
|
+
execute('branch', "--track #{branch} #{remote_head}")
|
26
26
|
execute('checkout', branch)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def has_changes?
|
32
|
-
|
33
|
-
|
34
|
-
return true if @status =~ /Initialized empty Git repository/
|
35
|
-
return false
|
32
|
+
extract_current_head_revision
|
33
|
+
new? or ( last_tested_revision != @revision )
|
36
34
|
end
|
37
35
|
|
38
|
-
def
|
39
|
-
@
|
36
|
+
def new?
|
37
|
+
@new == true
|
38
|
+
end
|
39
|
+
|
40
|
+
def current_revision( _full=false )
|
41
|
+
_full ? @revision : @revision.slice(0,8)
|
40
42
|
end
|
41
43
|
|
42
44
|
def url
|
@@ -56,6 +58,15 @@ class Cerberus::SCM::Git
|
|
56
58
|
end
|
57
59
|
|
58
60
|
private
|
61
|
+
|
62
|
+
def get_updates
|
63
|
+
execute("fetch")
|
64
|
+
end
|
65
|
+
|
66
|
+
def remote_head
|
67
|
+
branch = @config[:scm, :branch]
|
68
|
+
branch ? "origin/#{branch}" : "origin"
|
69
|
+
end
|
59
70
|
|
60
71
|
def execute(command, parameters = nil, with_path = true)
|
61
72
|
if with_path
|
@@ -67,13 +78,25 @@ class Cerberus::SCM::Git
|
|
67
78
|
`#{cmd}`
|
68
79
|
end
|
69
80
|
|
70
|
-
def
|
71
|
-
message = execute("show", "--pretty='format:%an(%ae)|%ai|%H|%s'")
|
72
|
-
message
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
81
|
+
def extract_commit_info( commit=remote_head )
|
82
|
+
message = execute("show", "#{ commit } --pretty='format:%an(%ae)|%ai|%H|%s'").split("|")
|
83
|
+
{ :author => message[0], :date => message[1], :revision => message[2], :message => message[3] }
|
84
|
+
end
|
85
|
+
|
86
|
+
def last_tested_revision
|
87
|
+
# TODO Is there a better way to extract the last tested commit?
|
88
|
+
app_name = @config['application_name']
|
89
|
+
app_root = "#{Cerberus::HOME}/work/#{app_name}"
|
90
|
+
status = Cerberus::Status.new("#{app_root}/status.log")
|
91
|
+
commit_info = extract_commit_info(status.revision)
|
92
|
+
@last_tested_revision ||= commit_info[:revision]
|
93
|
+
end
|
94
|
+
|
95
|
+
def extract_current_head_revision
|
96
|
+
commit_info = extract_commit_info
|
97
|
+
@author = commit_info[:author]
|
98
|
+
@date = commit_info[:date]
|
99
|
+
@revision = commit_info[:revision]
|
100
|
+
@message = commit_info[:message]
|
78
101
|
end
|
79
102
|
end
|
data/lib/cerberus/utils.rb
CHANGED
data/test/functional_test.rb
CHANGED
@@ -63,7 +63,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
63
63
|
#Check outpus that run needed tasks
|
64
64
|
assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output
|
65
65
|
assert output !~ /Task 'custom1' has been invoked/
|
66
|
-
assert_equal '[myapp] Cerberus set up for project (
|
66
|
+
assert_equal '[myapp] Cerberus set up for project (2)', mail.subject
|
67
67
|
assert output =~ %r{http://someurl.changeset.com/2}
|
68
68
|
|
69
69
|
status_file = HOME + '/work/myapp/status.log'
|
data/test/mail_publisher_test.rb
CHANGED
@@ -21,6 +21,6 @@ class MailPublisherTest < Test::Unit::TestCase
|
|
21
21
|
assert_equal 1, mails.size
|
22
22
|
mail = mails[0]
|
23
23
|
assert_equal 'haha', mail.from_addrs[0].address
|
24
|
-
assert_equal '[MyApp] Cerberus set up for project (
|
24
|
+
assert_equal '[MyApp] Cerberus set up for project (1232)', mail.subject
|
25
25
|
end
|
26
26
|
end
|
data/test/mock/twitter.rb
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
require 'cerberus/builder/ruby'
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
class Cerberus::Builder::Ruby
|
7
|
+
attr_writer :output
|
8
|
+
end
|
9
|
+
|
10
|
+
class RubyBuilderTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
tmp = Dir::tmpdir
|
14
|
+
@cfg = Cerberus::Config.new( nil, { :application_root => tmp } )
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_builder
|
18
|
+
@cfg.merge!(:builder => {:ruby => {:success => 'Build successful', :failure => 'Build failed', :brokeness => '(\d+) failures, (\d+) errors'}})
|
19
|
+
builder = Cerberus::Builder::Ruby.new(@cfg)
|
20
|
+
|
21
|
+
builder.output = SUCCESS_OUTPUT
|
22
|
+
assert builder.successful?
|
23
|
+
|
24
|
+
builder.output = FAILURE_OUTPUT
|
25
|
+
assert !builder.successful?
|
26
|
+
assert_equal 10, builder.brokeness
|
27
|
+
|
28
|
+
|
29
|
+
@cfg.merge!(:builder => {:ruby => {:success => 'Build successful', :failure => '[Build] FAILURE', :brokeness => '(\d+) failures, (\d+) errors, (\d+) huge problems'}})
|
30
|
+
builder.output = CUSTOM_FAILURE_OUTPUT
|
31
|
+
assert !builder.successful?
|
32
|
+
assert_equal 19, builder.brokeness
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_builder_without_custom_config
|
36
|
+
@cfg.merge!( :builder => { :ruby => {} } )
|
37
|
+
builder = Cerberus::Builder::Ruby.new( @cfg )
|
38
|
+
|
39
|
+
builder.output = DEFAULT_SUCCESS_OUTPUT
|
40
|
+
assert builder.successful?
|
41
|
+
assert_equal 0, builder.brokeness
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
SUCCESS_OUTPUT=<<-END
|
47
|
+
A
|
48
|
+
Bunch
|
49
|
+
Of
|
50
|
+
Output
|
51
|
+
Build successful
|
52
|
+
END
|
53
|
+
|
54
|
+
DEFAULT_SUCCESS_OUTPUT=<<-END
|
55
|
+
A
|
56
|
+
Bunch of
|
57
|
+
Output
|
58
|
+
23 tests, 46 assertions, 0 failures, 0 errors
|
59
|
+
END
|
60
|
+
|
61
|
+
FAILURE_OUTPUT=<<-END
|
62
|
+
A
|
63
|
+
Bunch
|
64
|
+
Of
|
65
|
+
Output
|
66
|
+
Build failed
|
67
|
+
7 failures, 3 errors
|
68
|
+
END
|
69
|
+
|
70
|
+
CUSTOM_FAILURE_OUTPUT=<<-END
|
71
|
+
A
|
72
|
+
Bunch
|
73
|
+
Of
|
74
|
+
Output
|
75
|
+
[Build] FAILURE
|
76
|
+
7 failures, 3 errors, 9 huge problems
|
77
|
+
END
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cerberus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.6"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig P Jolicoeur
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-29 00:00:00 -04:00
|
13
13
|
default_executable: cerberus
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/cerberus/builder/rake.rb
|
101
101
|
- lib/cerberus/builder/rant.rb
|
102
102
|
- lib/cerberus/builder/rspec.rb
|
103
|
+
- lib/cerberus/builder/ruby.rb
|
103
104
|
- lib/cerberus/builder/ruby_base.rb
|
104
105
|
- lib/cerberus/cli.rb
|
105
106
|
- lib/cerberus/component_lazy_loader.rb
|
@@ -132,7 +133,6 @@ files:
|
|
132
133
|
- test/data
|
133
134
|
- test/data/darcs.zip
|
134
135
|
- test/data/git.zip
|
135
|
-
- test/data/git.zip.bak
|
136
136
|
- test/data/subversion.dump
|
137
137
|
- test/functional_test.rb
|
138
138
|
- test/integration_test.rb
|
@@ -149,10 +149,11 @@ files:
|
|
149
149
|
- test/perforce_scm_test.rb
|
150
150
|
- test/rspec_builder_test.rb
|
151
151
|
- test/rss_publisher_test.rb
|
152
|
+
- test/ruby_builder_test.rb
|
152
153
|
- test/test_helper.rb
|
153
154
|
- test/twitter_publisher_test.rb
|
154
155
|
- License.txt
|
155
|
-
- Readme.
|
156
|
+
- Readme.markdown
|
156
157
|
- Changelog.txt
|
157
158
|
- Rakefile
|
158
159
|
- doc/site
|
@@ -195,4 +196,5 @@ test_files:
|
|
195
196
|
- test/perforce_scm_test.rb
|
196
197
|
- test/rspec_builder_test.rb
|
197
198
|
- test/rss_publisher_test.rb
|
199
|
+
- test/ruby_builder_test.rb
|
198
200
|
- test/twitter_publisher_test.rb
|
data/Readme.txt
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
Cerberus is a Continuous Builder software. Cerberus could be periodically run from scheduler and check if application tests are broken. If it happens then Cerberus will send notification to developers. Cerberus perfectly works both on Windows and *nix platforms.
|
2
|
-
|
3
|
-
For more CI theory read this document from Martin Fowler
|
4
|
-
http://www.martinfowler.com/articles/continuousIntegration.html.
|
5
|
-
|
6
|
-
Requirements:
|
7
|
-
ruby - 1.8.2 or higher
|
8
|
-
rake - 0.7 or higher
|
9
|
-
|
10
|
-
What 'Cerberus' name means?
|
11
|
-
Quote from Wikipedia (http://en.wikipedia.org/wiki/Cerberus)
|
12
|
-
|
13
|
-
Cerberus or Kerberos (Kerberos, demon of the pit), was the hound of Hades-a monstrous three-headed dog (sometimes said to have 50 or 100 heads) with a snake for a tail and innumerable snake heads on his back.
|
14
|
-
He guarded the gate to Hades (the Greek underworld) and ensured that the dead could not leave and the living could not enter. His brother was Orthrus. He is the offspring of Echidna and Typhon.
|
15
|
-
|
16
|
-
|
17
|
-
So Cerberus will guard your tests and not allow your project to go to the world of dead.
|
18
|
-
|
19
|
-
There are several CI solutions already present, why do you need to use Cerberus?
|
20
|
-
Main advantages of Cerberus over other solutions are:
|
21
|
-
1) Cerberus could be installed on any machine not only where SVN repository located.
|
22
|
-
2) Cerberus works not only for Rails projects, but for any other Ruby projects as well as for other platforms (Maven2 for Java)
|
23
|
-
3) Cerberus multiplatform solution: it runs excellent both on *nix and Windows.
|
24
|
-
4) Cerberus distributed via RubyGems, so it is very easy to install and very easy to update to the latest stable version
|
25
|
-
5) Cerberus very easy to start using. Just type 'cerberus add PROJECT_URL|PROJECT_DIR'
|
26
|
-
6) Cerberus is lightweight solution: most of the time ruby process even not runs - Rake runs only in case if changes in project sources are found.
|
27
|
-
|
28
|
-
|
29
|
-
To use Cerberus it is very easy. First install it. Easiest way to do it through RubyGems package manager.
|
30
|
-
|
31
|
-
'gem install cerberus'
|
32
|
-
|
33
|
-
or get Cerberus distribution package right from download page http://rubyforge.org/frs/?group_id=1794&release_id=6442
|
34
|
-
|
35
|
-
then you need to add project that will be watched by Cerberus. Do it by
|
36
|
-
|
37
|
-
cerberus add (DIR|SVN_URL) APPLICATION_NAME=some_app RECIPIENTS=dev1@project.com,dev2@project.com
|
38
|
-
|
39
|
-
as second parameter you could pass URL to subversion repository or directory with working SVN folder.
|
40
|
-
|
41
|
-
Go to ~/.cerberus and edit config.yml file (only once after installing Cerberus). Enter your configuration options here like email server, password, user_name and other options. See ActiveMailer description - Cerberus uses it as notification layer. My config file looks like this
|
42
|
-
|
43
|
-
publisher:
|
44
|
-
mail:
|
45
|
-
address: mail.somesever.com
|
46
|
-
user_name: anatol
|
47
|
-
password: anatol
|
48
|
-
domain: somesever.com
|
49
|
-
authentication: login
|
50
|
-
|
51
|
-
Also check ~/.cerberus/config/<APPLICATION_NAME>.yml and make sure that you have right options.
|
52
|
-
|
53
|
-
And then run Cerberus
|
54
|
-
|
55
|
-
cerberus build APPLICATION_NAME # Run project
|
56
|
-
|
57
|
-
or
|
58
|
-
|
59
|
-
cerberus buildall # Run all available projects
|
60
|
-
|
61
|
-
|
62
|
-
It will check out latest sources and run tests for your application. If tests are broken - recipients will receive notifications.
|
63
|
-
|
64
|
-
But of course better run Cerberus automatically from Cron. Run Cerberus for project each 10 minutes would be ok.
|
65
|
-
|
66
|
-
== Features
|
67
|
-
|
68
|
-
Cerberus currently supports the following SCM tools:
|
69
|
-
|
70
|
-
* Subversion
|
71
|
-
* Git
|
72
|
-
* Darcs
|
73
|
-
* Perforce
|
74
|
-
* CVS
|
75
|
-
|
76
|
-
Cerberus currently supports the following notification systems:
|
77
|
-
|
78
|
-
* Email
|
79
|
-
* Jabber
|
80
|
-
* IRC
|
81
|
-
* RSS
|
82
|
-
* Campfire
|
83
|
-
* Twitter
|
84
|
-
|
85
|
-
Cerberus currently supports the following build systems:
|
86
|
-
|
87
|
-
* Rake
|
88
|
-
* RSpec
|
89
|
-
* Rant
|
90
|
-
* Maven2
|
91
|
-
* Bjam
|
92
|
-
|
93
|
-
== Mailing List / Public Forums
|
94
|
-
|
95
|
-
http://groups.google.com/group/cerberusci
|
96
|
-
|
97
|
-
== Issue Tracker
|
98
|
-
|
99
|
-
http://cpjolicoeur.lighthouseapp.com/projects/22299-cerberus
|
100
|
-
|
101
|
-
== License
|
102
|
-
|
103
|
-
This plugin is licensed under the MIT license. Complete license text
|
104
|
-
is included in the License.txt file.
|
data/test/data/git.zip.bak
DELETED
Binary file
|