cerberus 0.4.5.1 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGES → Changelog.txt} +6 -0
- data/{LICENSE → License.txt} +1 -2
- data/Rakefile +11 -13
- data/{README → Readme.txt} +1 -11
- data/lib/cerberus/builder/maven2.rb +23 -1
- data/lib/cerberus/cli.rb +6 -1
- data/lib/cerberus/constants.rb +1 -1
- data/lib/cerberus/manager.rb +56 -8
- data/lib/cerberus/scm/git.rb +6 -1
- data/test/data/git.zip +0 -0
- data/test/data/git.zip.bak +0 -0
- data/test/functional_test.rb +78 -72
- data/test/integration_test.rb +6 -1
- data/test/maven2_builer_test.rb +2 -2
- data/test/mock/manager.rb +1 -1
- data/test/rspec_builder_test.rb +2 -0
- data/test/rss_publisher_test.rb +1 -1
- data/test/test_helper.rb +6 -4
- data/test/twitter_publisher_test.rb +0 -1
- metadata +9 -8
data/{CHANGES → Changelog.txt}
RENAMED
data/{LICENSE → License.txt}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2006
|
1
|
+
Copyright (c) 2006-2009 by individual contributors (see: Copyright.txt)
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -18,4 +18,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
data/Rakefile
CHANGED
@@ -14,11 +14,11 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
14
14
|
RELEASE_NAME = "REL #{PKG_VERSION}"
|
15
15
|
|
16
16
|
RUBYFORGE_PROJECT = "cerberus"
|
17
|
-
RUBYFORGE_USER = ENV['RUBYFORGE_USER'] || "
|
17
|
+
RUBYFORGE_USER = ENV['RUBYFORGE_USER'] || "cpjolicoeur"
|
18
18
|
|
19
19
|
task :default => [:test, :clean]
|
20
20
|
|
21
|
-
desc "Run the
|
21
|
+
desc "Run the tests in the test/ directory"
|
22
22
|
Rake::TestTask.new(:test) do |t|
|
23
23
|
t.libs << "test"
|
24
24
|
t.pattern = 'test/*_test.rb'
|
@@ -46,9 +46,6 @@ GEM_SPEC = Gem::Specification.new do |s|
|
|
46
46
|
Cerberus is a Continuous Integration software for Ruby projects. CI helps you keep your project
|
47
47
|
in a good shape.
|
48
48
|
|
49
|
-
For now Cerberus only work with projects that use Subversion but in the future it would be provided
|
50
|
-
support for other VCS.
|
51
|
-
|
52
49
|
Cerberus could be easily invoked from Cron (for Unix) or nnCron (for Windows) utilities.
|
53
50
|
DESC
|
54
51
|
|
@@ -61,21 +58,18 @@ GEM_SPEC = Gem::Specification.new do |s|
|
|
61
58
|
s.add_dependency 'twitter4r', '>= 0.3.0'
|
62
59
|
|
63
60
|
s.files = Dir.glob("{bin,lib,test}/**/*").delete_if { |item| item.include?('__workdir') }
|
64
|
-
s.files += %w(
|
61
|
+
s.files += %w(License.txt Readme.txt Changelog.txt Rakefile)
|
65
62
|
s.files += Dir.glob("doc/*").delete_if { |item| item.include?('__workdir') }
|
66
63
|
|
67
64
|
s.bindir = "bin"
|
68
65
|
s.executables = ["cerberus"]
|
69
66
|
s.default_executable = "cerberus"
|
70
|
-
|
71
67
|
s.require_path = 'lib'
|
72
|
-
|
73
68
|
s.has_rdoc = false
|
74
|
-
|
75
69
|
s.test_files = Dir.glob('test/*_test.rb')
|
76
70
|
|
77
|
-
s.author = "
|
78
|
-
s.email = "
|
71
|
+
s.author = "Craig P Jolicoeur"
|
72
|
+
s.email = "cpjolicoeur@gmail.com"
|
79
73
|
s.homepage = "http://rubyforge.org/projects/cerberus"
|
80
74
|
s.rubyforge_project = RUBYFORGE_PROJECT
|
81
75
|
end
|
@@ -132,6 +126,8 @@ task :release_files => [:clean, :package] do
|
|
132
126
|
release.files = release_files.to_a
|
133
127
|
release.package_name = PKG_NAME
|
134
128
|
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' )
|
135
131
|
end
|
136
132
|
|
137
133
|
end
|
@@ -144,18 +140,20 @@ task :publish_news do
|
|
144
140
|
publisher.user_name = RUBYFORGE_USER
|
145
141
|
publisher.password = ENV['RUBYFORGE_PASSWORD']
|
146
142
|
publisher.subject = "[ANN] Cerberus #{PKG_VERSION} Released"
|
147
|
-
publisher.details = IO.read(File.dirname(__FILE__) + '/
|
143
|
+
publisher.details = IO.read(File.dirname(__FILE__) + '/Changelog.txt')
|
148
144
|
end
|
149
145
|
end
|
150
146
|
|
151
147
|
require 'webgen/webgentask'
|
152
|
-
task :generate_site => :webgen
|
148
|
+
task :generate_site => :webgen do
|
153
149
|
|
154
150
|
Webgen::WebgenTask.new do |t|
|
155
151
|
t.directory = File.join( File.dirname( __FILE__ ), 'doc/site')
|
156
152
|
t.clobber_outdir = true
|
157
153
|
end
|
158
154
|
|
155
|
+
end
|
156
|
+
|
159
157
|
task :publish_site => :generate_site do
|
160
158
|
sh %{scp -r -q doc/site/out/* #{RUBYFORGE_USER}@rubyforge.org:/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/}
|
161
159
|
end
|
data/{README → Readme.txt}
RENAMED
@@ -101,14 +101,4 @@ http://cpjolicoeur.lighthouseapp.com/projects/22299-cerberus
|
|
101
101
|
== License
|
102
102
|
|
103
103
|
This plugin is licensed under the MIT license. Complete license text
|
104
|
-
is included in the
|
105
|
-
|
106
|
-
== Author
|
107
|
-
|
108
|
-
This software was created by Anatol Pomozov <anatol.pomozov@gmail.com> and is
|
109
|
-
located at http://cerberus.rubyforge.org.
|
110
|
-
|
111
|
-
== Contributors
|
112
|
-
|
113
|
-
Craig P Jolicoeur <http://github.com/cpjolicoeur>
|
114
|
-
Rob Kaufman <http://github.com/notch8>
|
104
|
+
is included in the License.txt file.
|
@@ -11,7 +11,7 @@ class Cerberus::Builder::Maven2
|
|
11
11
|
Dir.chdir @config[:application_root]
|
12
12
|
cmd = @config[:builder, :maven2, :cmd] || 'mvn'
|
13
13
|
task = @config[:builder, :maven2, :task] || 'test'
|
14
|
-
@output = `#{@config[:bin_path]}#{cmd} #{task} 2>&1`
|
14
|
+
@output = `#{@config[:bin_path]}#{cmd} #{system_properties} #{settings} #{task} 2>&1`
|
15
15
|
add_error_information
|
16
16
|
successful?
|
17
17
|
end
|
@@ -20,6 +20,28 @@ class Cerberus::Builder::Maven2
|
|
20
20
|
$?.exitstatus == 0 and not @output.include?('[ERROR] BUILD FAILURE')
|
21
21
|
end
|
22
22
|
|
23
|
+
private
|
24
|
+
|
25
|
+
def system_properties
|
26
|
+
properties = []
|
27
|
+
system_properties = @config[:builder, :maven2, :system_properties]
|
28
|
+
if system_properties
|
29
|
+
system_properties.each do |p|
|
30
|
+
properties << %Q(-D#{p[0]}="#{p[1]}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
properties.join(' ')
|
34
|
+
end
|
35
|
+
|
36
|
+
def settings
|
37
|
+
settings_file = @config[:builder, :maven2, :settings]
|
38
|
+
if settings_file
|
39
|
+
return "-s #{settings_file}"
|
40
|
+
else
|
41
|
+
return ''
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
23
45
|
def add_error_information
|
24
46
|
str = @output
|
25
47
|
@output = ''
|
data/lib/cerberus/cli.rb
CHANGED
@@ -8,7 +8,6 @@ module Cerberus
|
|
8
8
|
say HELP if args.empty?
|
9
9
|
|
10
10
|
command = args.shift
|
11
|
-
say HELP unless %w(add remove build buildall list).include?(command)
|
12
11
|
|
13
12
|
cli_options = extract_options(args)
|
14
13
|
|
@@ -33,6 +32,11 @@ module Cerberus
|
|
33
32
|
when 'list'
|
34
33
|
command = Cerberus::ListCommand.new(cli_options)
|
35
34
|
command.run
|
35
|
+
when 'status'
|
36
|
+
command = Cerberus::StatusCommand.new(cli_options)
|
37
|
+
command.run
|
38
|
+
else
|
39
|
+
say HELP
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
@@ -68,6 +72,7 @@ module Cerberus
|
|
68
72
|
cerberus build <NAME> --- build watched application
|
69
73
|
cerberus buildall --- build all watched applications
|
70
74
|
cerberus list --- see the list of all watched applications
|
75
|
+
cerberus status --- see the current status of all cerberus projects
|
71
76
|
|
72
77
|
Version: #{Cerberus::VERSION}
|
73
78
|
Cerberus Path: "#{Cerberus::HOME}"
|
data/lib/cerberus/constants.rb
CHANGED
data/lib/cerberus/manager.rb
CHANGED
@@ -228,16 +228,62 @@ module Cerberus
|
|
228
228
|
end
|
229
229
|
end
|
230
230
|
end
|
231
|
+
|
232
|
+
class StatusCommand
|
233
|
+
def initialize(cli_options = {})
|
234
|
+
end
|
235
|
+
|
236
|
+
def run
|
237
|
+
projects = Dir["#{HOME}/config/*.yml"].map { |fn| fn.gsub(/.*\/(.*).yml$/, '\1') }
|
238
|
+
if projects.empty?
|
239
|
+
puts "There are not any active projects"
|
240
|
+
else
|
241
|
+
delim = ' | '
|
242
|
+
cols = [
|
243
|
+
['Project Name', 30, lambda { |p, s| p }],
|
244
|
+
['Revision', 10, lambda { |p, s| "r#{s.revision.to_s.slice( 0, 8 ) }"}],
|
245
|
+
['Status', 10, lambda { |p, s| s.previous_build_successful ? 'Pass' : 'Fail' }],
|
246
|
+
['Last Success', 10, lambda { |p, s| "r#{s.successful_build_revision.to_s.slice( 0, 8 )}"}],
|
247
|
+
]
|
248
|
+
header = cols.map { |head, size, lamb| head.ljust(size) }.join(delim)
|
249
|
+
puts '-' * header.length
|
250
|
+
puts header
|
251
|
+
puts '-' * header.length
|
252
|
+
projects.each do |proj|
|
253
|
+
status = Status.read("#{HOME}/work/#{proj}/status.log")
|
254
|
+
row = cols.map { |head, size, lamb| lamb.call(proj, status).to_s.ljust(size) }.join(delim)
|
255
|
+
puts status.previous_build_successful ? ansi_green(row) : ansi_red(row)
|
256
|
+
end
|
257
|
+
puts '-' * header.length
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def ansi_green(str)
|
262
|
+
ansi_escape('32m', str)
|
263
|
+
end
|
264
|
+
|
265
|
+
def ansi_red(str)
|
266
|
+
ansi_escape('31m', str)
|
267
|
+
end
|
268
|
+
|
269
|
+
def ansi_escape(code, str)
|
270
|
+
"\033[#{code}" + str + "\033[0m"
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
231
274
|
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
275
|
+
#
|
276
|
+
# Fields that are contained in status file
|
277
|
+
#
|
278
|
+
# successful_build_timestamp
|
279
|
+
# timestamp
|
280
|
+
# successful (true mean previous build was successful, otherwise - false)
|
281
|
+
# revision
|
282
|
+
# brokeness
|
283
|
+
# successful_build_revision
|
284
|
+
#
|
239
285
|
class Status
|
240
|
-
attr_reader :previous_build_successful, :previous_brokeness, :current_build_successful, :current_brokeness
|
286
|
+
attr_reader :previous_build_successful, :previous_brokeness, :current_build_successful, :current_brokeness, :revision, :successful_build_revision
|
241
287
|
|
242
288
|
def initialize(param)
|
243
289
|
if param.is_a? Hash
|
@@ -262,6 +308,8 @@ module Cerberus
|
|
262
308
|
@already_kept = false
|
263
309
|
end
|
264
310
|
|
311
|
+
@revision = @hash['revision']
|
312
|
+
@successful_build_revision = @hash['successful_build_revision']
|
265
313
|
@previous_build_successful = @hash['successful']
|
266
314
|
@previous_brokeness = @hash['brokeness']
|
267
315
|
end
|
data/lib/cerberus/scm/git.rb
CHANGED
@@ -15,12 +15,16 @@ class Cerberus::SCM::Git
|
|
15
15
|
def update!
|
16
16
|
if test(?d, @path + '/.git')
|
17
17
|
extract_last_commit_info
|
18
|
-
#@status = execute('pull', '')
|
19
18
|
@status = execute("reset", "--hard #{@revision}") + execute('pull')
|
20
19
|
else
|
21
20
|
FileUtils.rm_rf(@path) if test(?d, @path)
|
22
21
|
encoded_url = (@config[:scm, :url].include?(' ') ? "\"#{@config[:scm, :url]}\"" : @config[:scm, :url])
|
23
22
|
@status = execute("clone", "#{encoded_url} #{@path}", false)
|
23
|
+
if @config[:scm, :branch]
|
24
|
+
branch = @config[:scm, :branch]
|
25
|
+
execute('branch', "--track #{branch} origin/#{branch}")
|
26
|
+
execute('checkout', branch)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
@@ -52,6 +56,7 @@ class Cerberus::SCM::Git
|
|
52
56
|
end
|
53
57
|
|
54
58
|
private
|
59
|
+
|
55
60
|
def execute(command, parameters = nil, with_path = true)
|
56
61
|
if with_path
|
57
62
|
cmd = "cd #{@config[:application_root]} && #{@config[:bin_path]}git --git-dir=#{@path}/.git #{command} #{parameters}"
|
data/test/data/git.zip
CHANGED
Binary file
|
Binary file
|
data/test/functional_test.rb
CHANGED
@@ -6,15 +6,15 @@ require 'action_mailer'
|
|
6
6
|
|
7
7
|
class FunctionalTest < Test::Unit::TestCase
|
8
8
|
def setup
|
9
|
+
# Its better to remove on setup than teardown incase we need to debug
|
9
10
|
FileUtils.rm_rf HOME
|
10
11
|
ActionMailer::Base.deliveries.clear
|
11
12
|
end
|
12
13
|
|
13
14
|
def teardown
|
14
15
|
dir = HOME + '/../'
|
15
|
-
|
16
|
-
|
17
|
-
#FileUtils.rm_rf HOME
|
16
|
+
# We need change working directory to some non-removable dir otherwise we would have warning after removing that working directory absent
|
17
|
+
Dir.chdir(dir) if test(?d, dir)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_add_by_url
|
@@ -45,8 +45,8 @@ class FunctionalTest < Test::Unit::TestCase
|
|
45
45
|
scm_conf = load_yml(project_config)['scm']
|
46
46
|
assert_equal 'svn', scm_conf['type']
|
47
47
|
scm_uri = URI.parse(scm_conf['url'])
|
48
|
-
#
|
49
|
-
#assert_match 'rubyforge.org', scm_uri.host
|
48
|
+
# FIXME - this assert needs to be fixed
|
49
|
+
# assert_match 'rubyforge.org', scm_uri.host
|
50
50
|
|
51
51
|
assert File.exists?(HOME + '/config.yml')
|
52
52
|
end
|
@@ -95,7 +95,6 @@ class FunctionalTest < Test::Unit::TestCase
|
|
95
95
|
assert_equal :broken, build.status.current_state
|
96
96
|
assert_equal 3, ActionMailer::Base.deliveries.size #We should receive mail if project fails
|
97
97
|
|
98
|
-
|
99
98
|
add_test_case_to_project('myapp', 'raise "Some exception here"') #if we have exception
|
100
99
|
build = Cerberus::BuildCommand.new('myapp', :force => true)
|
101
100
|
build.run
|
@@ -124,7 +123,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
124
123
|
end
|
125
124
|
|
126
125
|
def test_send_on_different_events
|
127
|
-
#
|
126
|
+
# FIXME - This currently throws an exit code stoping all tests
|
128
127
|
# add_application('myapp', SVN_URL, 'publisher' => {'mail' => {'on_event' => 'none'}, 'on_event' => 'all'})
|
129
128
|
# build = Cerberus::BuildCommand.new('myapp')
|
130
129
|
# build.run
|
@@ -200,66 +199,66 @@ class FunctionalTest < Test::Unit::TestCase
|
|
200
199
|
end
|
201
200
|
|
202
201
|
def test_darcs
|
203
|
-
add_application('darcsapp', DARCS_URL, :scm => {:type => 'darcs'})
|
204
|
-
|
205
|
-
build = Cerberus::BuildCommand.new('darcsapp')
|
206
|
-
build.run
|
207
|
-
assert build.scm.has_changes?
|
208
|
-
assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup
|
209
|
-
mail = ActionMailer::Base.deliveries[0]
|
210
|
-
output = mail.body
|
211
|
-
|
212
|
-
#Check outpus that run needed tasks
|
213
|
-
assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output
|
214
|
-
assert output !~ /Task 'custom1' has been invoked/
|
215
|
-
assert_equal '[darcsapp] Cerberus set up for project (#20061010090920)', mail.subject
|
216
|
-
|
217
|
-
status_file = HOME + '/work/darcsapp/status.log'
|
218
|
-
assert File.exists?(status_file)
|
219
|
-
assert build_successful?(status_file)
|
220
|
-
assert 1, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
221
|
-
|
222
|
-
#There were no changes - no reaction should be
|
223
|
-
build = Cerberus::BuildCommand.new('darcsapp')
|
224
|
-
build.run
|
225
|
-
assert_equal false, build.scm.has_changes?
|
226
|
-
assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup
|
227
|
-
assert 1, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
228
|
-
|
229
|
-
#now we add new broken test
|
230
|
-
test_case_name = "test/#{rand(10000)}_test.rb"
|
231
|
-
File.open(DARCS_REPO + '/' + test_case_name, 'w') { |f|
|
232
|
-
f << "require 'test/unit'
|
233
|
-
class A#{rand(10000)}Test < Test::Unit::TestCase
|
234
|
-
def test_ok
|
235
|
-
assert false
|
236
|
-
end
|
237
|
-
end"
|
238
|
-
}
|
239
|
-
|
240
|
-
curr_dir = Dir.pwd
|
241
|
-
Dir.chdir DARCS_REPO
|
242
|
-
`darcs add #{test_case_name}`
|
243
|
-
`darcs record -a -A test@gmail.com -m somepatch`
|
244
|
-
Dir.chdir curr_dir
|
202
|
+
# add_application('darcsapp', DARCS_URL, :scm => {:type => 'darcs'})
|
245
203
|
|
246
|
-
build = Cerberus::BuildCommand.new('darcsapp')
|
247
|
-
build.run
|
248
|
-
assert build.scm.has_changes?
|
249
|
-
assert_equal
|
250
|
-
|
204
|
+
# build = Cerberus::BuildCommand.new('darcsapp')
|
205
|
+
# build.run
|
206
|
+
# assert build.scm.has_changes?
|
207
|
+
# assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup
|
208
|
+
# mail = ActionMailer::Base.deliveries[0]
|
209
|
+
# output = mail.body
|
210
|
+
|
211
|
+
# #Check outpus that run needed tasks
|
212
|
+
# assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output
|
213
|
+
# assert output !~ /Task 'custom1' has been invoked/
|
214
|
+
# assert_equal '[darcsapp] Cerberus set up for project (#20061010090920)', mail.subject
|
215
|
+
|
216
|
+
# status_file = HOME + '/work/darcsapp/status.log'
|
217
|
+
# assert File.exists?(status_file)
|
218
|
+
# assert build_successful?(status_file)
|
219
|
+
# assert 1, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
220
|
+
|
221
|
+
# #There were no changes - no reaction should be
|
222
|
+
# build = Cerberus::BuildCommand.new('darcsapp')
|
223
|
+
# build.run
|
224
|
+
# assert_equal false, build.scm.has_changes?
|
225
|
+
# assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup
|
226
|
+
# assert 1, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
227
|
+
|
228
|
+
# #now we add new broken test
|
229
|
+
# test_case_name = "test/#{rand(10000)}_test.rb"
|
230
|
+
# File.open(DARCS_REPO + '/' + test_case_name, 'w') { |f|
|
231
|
+
# f << "require 'test/unit'
|
232
|
+
# class A#{rand(10000)}Test < Test::Unit::TestCase
|
233
|
+
# def test_ok
|
234
|
+
# assert false
|
235
|
+
# end
|
236
|
+
# end"
|
237
|
+
# }
|
238
|
+
|
239
|
+
# curr_dir = Dir.pwd
|
240
|
+
# Dir.chdir DARCS_REPO
|
241
|
+
# `darcs add #{test_case_name}`
|
242
|
+
# `darcs record -a -A test@gmail.com -m somepatch`
|
243
|
+
# Dir.chdir curr_dir
|
244
|
+
|
245
|
+
# build = Cerberus::BuildCommand.new('darcsapp')
|
246
|
+
# build.run
|
247
|
+
# assert build.scm.has_changes?
|
248
|
+
# assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup
|
249
|
+
# assert 2, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
251
250
|
|
252
|
-
build = Cerberus::BuildCommand.new('darcsapp')
|
253
|
-
build.run
|
254
|
-
assert_equal false, build.scm.has_changes?
|
255
|
-
assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup
|
256
|
-
assert 2, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
251
|
+
# build = Cerberus::BuildCommand.new('darcsapp')
|
252
|
+
# build.run
|
253
|
+
# assert_equal false, build.scm.has_changes?
|
254
|
+
# assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup
|
255
|
+
# assert 2, Dir[HOME + "/work/darcsapp/logs/*.log"].size
|
257
256
|
|
258
|
-
#Now we broke remote repository (imiitate that network unaccessage)
|
259
|
-
FileUtils.rm_rf DARCS_REPO
|
260
|
-
build = Cerberus::BuildCommand.new('darcsapp')
|
261
|
-
build.run
|
262
|
-
assert_equal false, build.scm.has_changes?
|
257
|
+
# #Now we broke remote repository (imiitate that network unaccessage)
|
258
|
+
# FileUtils.rm_rf DARCS_REPO
|
259
|
+
# build = Cerberus::BuildCommand.new('darcsapp')
|
260
|
+
# build.run
|
261
|
+
# assert_equal false, build.scm.has_changes?
|
263
262
|
end
|
264
263
|
|
265
264
|
def test_git
|
@@ -272,7 +271,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
272
271
|
mail = ActionMailer::Base.deliveries[0]
|
273
272
|
output = mail.body
|
274
273
|
|
275
|
-
#Check
|
274
|
+
#Check output that run needed tasks
|
276
275
|
assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output
|
277
276
|
assert output !~ /Task 'custom1' has been invoked/
|
278
277
|
assert_match /\[gitapp\] Cerberus set up for project/, mail.subject
|
@@ -290,14 +289,15 @@ class FunctionalTest < Test::Unit::TestCase
|
|
290
289
|
assert 1, Dir[HOME + "/work/gitapp/logs/*.log"].size
|
291
290
|
|
292
291
|
#now we add new broken test
|
293
|
-
|
292
|
+
rand_val = rand(10000)
|
293
|
+
test_case_name = "test/#{rand_val}_test.rb"
|
294
294
|
File.open(GIT_REPO + '/' + test_case_name, 'w') { |f|
|
295
|
-
f <<
|
296
|
-
class A#{
|
295
|
+
f << %Q( require 'test/unit'
|
296
|
+
class A#{rand_val}Test < Test::Unit::TestCase
|
297
297
|
def test_ok
|
298
298
|
assert false
|
299
299
|
end
|
300
|
-
end
|
300
|
+
end )
|
301
301
|
}
|
302
302
|
|
303
303
|
curr_dir = Dir.pwd
|
@@ -309,7 +309,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
309
309
|
build = Cerberus::BuildCommand.new('gitapp')
|
310
310
|
build.run
|
311
311
|
assert build.scm.has_changes?
|
312
|
-
assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup
|
312
|
+
assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup plus new alert email
|
313
313
|
assert 2, Dir[HOME + "/work/gitsapp/logs/*.log"].size
|
314
314
|
|
315
315
|
build = Cerberus::BuildCommand.new('gitapp')
|
@@ -318,7 +318,13 @@ class FunctionalTest < Test::Unit::TestCase
|
|
318
318
|
assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup
|
319
319
|
assert 2, Dir[HOME + "/work/gitapp/logs/*.log"].size
|
320
320
|
|
321
|
-
#
|
321
|
+
# test git branch features
|
322
|
+
add_application('gitapp2', GIT_URL, 'scm' => {'type' => 'git', 'branch' => 'cerberus'})
|
323
|
+
build = Cerberus::BuildCommand.new('gitapp2')
|
324
|
+
build.run
|
325
|
+
assert build.scm.has_changes?
|
326
|
+
|
327
|
+
#Now we broke remote repository (imitate that network unaccessable)
|
322
328
|
FileUtils.rm_rf GIT_REPO
|
323
329
|
build = Cerberus::BuildCommand.new('gitapp')
|
324
330
|
build.run
|
@@ -326,7 +332,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
326
332
|
end
|
327
333
|
|
328
334
|
def test_campfire_publisher
|
329
|
-
#there were
|
335
|
+
# there were not any messages causing login/password is incorrect. We just check that there was no any exceptions
|
330
336
|
add_application('campapp', SVN_URL, 'publisher' => {'active' => 'campfire', 'campfire' =>
|
331
337
|
{'url' => 'http://mail@gmail.com:somepwd@cerberustool.campfirenow.com/room/5166022'}
|
332
338
|
})
|
data/test/integration_test.rb
CHANGED
@@ -30,6 +30,11 @@ class IntegrationTest < Test::Unit::TestCase
|
|
30
30
|
assert_match /mamba/, output
|
31
31
|
end
|
32
32
|
|
33
|
+
def test_status_command
|
34
|
+
# FIXME: add real tests
|
35
|
+
assert true
|
36
|
+
end
|
37
|
+
|
33
38
|
def test_add_project_with_parameters
|
34
39
|
output = run_cerb(" add #{SVN_URL} APPLICATION_NAME=hello_world RECIPIENTS=aa@gmail.com BUILDER=maven2")
|
35
40
|
assert_match /has been added to Cerberus successfully/, output
|
@@ -113,4 +118,4 @@ class IntegrationTest < Test::Unit::TestCase
|
|
113
118
|
assert_equal some_number.to_s, IO.read(tmp_file).strip
|
114
119
|
File.rm_f tmp_file
|
115
120
|
end
|
116
|
-
end
|
121
|
+
end
|
data/test/maven2_builer_test.rb
CHANGED
@@ -20,7 +20,7 @@ class Maven2BuilderTest < Test::Unit::TestCase
|
|
20
20
|
IO.write(reports_dir + 'wicket.markup.html.form.persistence.CookieValuePersisterTest.txt', SUREFIRE2_OUTPUT)
|
21
21
|
|
22
22
|
builder.output = MVN_OUTPUT
|
23
|
-
builder.add_error_information
|
23
|
+
builder.send( 'add_error_information' )
|
24
24
|
assert builder.output.include?('at wicket.markup.html.basic.SimplePageTest.testRenderHomePage_3(SimplePageTest.java:285)')
|
25
25
|
assert builder.output.include?('This is for wicket.util.resource.ResourceTest :=')
|
26
26
|
end
|
@@ -79,4 +79,4 @@ junit.framework.AssertionFailedError
|
|
79
79
|
at wicket.WicketTestCase.executeTest(WicketTestCase.java:78)
|
80
80
|
at wicket.markup.html.basic.SimplePageTest.testRenderHomePage_3(SimplePageTest.java:285)
|
81
81
|
|
82
|
-
END
|
82
|
+
END
|
data/test/mock/manager.rb
CHANGED
@@ -15,7 +15,7 @@ class DummyStatus
|
|
15
15
|
|
16
16
|
def initialize(param)
|
17
17
|
@hash = param
|
18
|
-
@
|
18
|
+
@current_build_successful = @hash['state']
|
19
19
|
@previous_build_successful = @hash['previous_build'] || false
|
20
20
|
@previous_brokeness = @hash['previous_brokeness'] || ''
|
21
21
|
@current_brokeness = @hash['current_brokeness'] || ''
|
data/test/rspec_builder_test.rb
CHANGED
data/test/rss_publisher_test.rb
CHANGED
@@ -16,7 +16,7 @@ class RSSPublisherTest < Test::Unit::TestCase
|
|
16
16
|
xml = REXML::Document.new(IO.read(rss_file.path))
|
17
17
|
|
18
18
|
assert_equal '[RSS<App] Build still broken (#1235)', xml.elements["rss/channel/item/title/"].get_text.value
|
19
|
-
assert_match %r{<pre>last message\nthis is output\n--\nThis email generated by Cerberus tool ver\.
|
19
|
+
assert_match %r{<pre>last message\nthis is output\n--\nThis email generated by Cerberus tool ver\. \d.\d(.\d)?, http://cerberus.rubyforge.org/</pre>},
|
20
20
|
xml.elements["rss/channel/item/description/"].get_text.value
|
21
21
|
end
|
22
22
|
end
|
data/test/test_helper.rb
CHANGED
@@ -9,6 +9,9 @@ require 'mock/manager'
|
|
9
9
|
|
10
10
|
class Test::Unit::TestCase
|
11
11
|
TEMP_DIR = File.expand_path(File.dirname(__FILE__)) + '/__workdir'
|
12
|
+
HOME = TEMP_DIR + '/home'
|
13
|
+
ENV['CERBERUS_HOME'] = HOME
|
14
|
+
ENV['CERBERUS_ENV'] = 'TEST'
|
12
15
|
|
13
16
|
SVN_REPO = TEMP_DIR + '/svn_repo'
|
14
17
|
SVN_URL = 'file:///' + SVN_REPO.gsub(/\\/,'/').gsub(/^\//,'').gsub(' ', '%20')
|
@@ -19,16 +22,14 @@ class Test::Unit::TestCase
|
|
19
22
|
GIT_REPO = TEMP_DIR + '/git_repo'
|
20
23
|
GIT_URL = 'file:///' + GIT_REPO.gsub(/\\/,'/').gsub(/^\//,'').gsub(' ', '%20')
|
21
24
|
|
22
|
-
HOME = TEMP_DIR + '/home'
|
23
|
-
ENV['CERBERUS_HOME'] = HOME
|
24
|
-
ENV['CERBERUS_ENV'] = 'TEST'
|
25
|
-
|
26
25
|
def self.refresh_repos
|
26
|
+
# setup base subversion repos
|
27
27
|
FileUtils.rm_rf TEMP_DIR
|
28
28
|
FileUtils.mkpath SVN_REPO
|
29
29
|
`svnadmin create "#{SVN_REPO}"`
|
30
30
|
`svnadmin load "#{SVN_REPO}" < "#{File.dirname(__FILE__)}/data/subversion.dump"`
|
31
31
|
|
32
|
+
# setup base darcs repos
|
32
33
|
require 'rubygems'
|
33
34
|
require 'zip/zip'
|
34
35
|
FileUtils.mkpath DARCS_REPO
|
@@ -40,6 +41,7 @@ class Test::Unit::TestCase
|
|
40
41
|
}
|
41
42
|
}
|
42
43
|
|
44
|
+
# setup base git repos
|
43
45
|
FileUtils.mkpath GIT_REPO
|
44
46
|
Zip::ZipFile::open("#{File.dirname(__FILE__)}/data/git.zip") {|zf|
|
45
47
|
zf.each { |e|
|
@@ -8,7 +8,6 @@ require 'mock/twitter'
|
|
8
8
|
class TwitterPublisherTest < Test::Unit::TestCase
|
9
9
|
def test_publisher
|
10
10
|
options = Cerberus::Config.new(nil, :publisher => {:twitter => {:login => 'twittest', :password => 'twitpass'}}, :application_name => 'TestApp')
|
11
|
-
# options = Cerberus::Config.new(nil, :publisher => {:jabber => {:jid=>'from.cerberus@gmail.com', :recipients => ' jit1@google.com, another@google.com '}}, :application_name => 'MegaApp')
|
12
11
|
build = DummyManager.new('last message', 'this is output', 1232, 'anatol')
|
13
12
|
|
14
13
|
Cerberus::Publisher::Twitter.publish(build_status(false), build, options)
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cerberus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.5"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Craig P Jolicoeur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-22 00:00:00 -04:00
|
13
13
|
default_executable: cerberus
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -82,8 +82,8 @@ dependencies:
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 0.3.0
|
84
84
|
version:
|
85
|
-
description: Cerberus is a Continuous Integration software for Ruby projects. CI helps you keep your project in a good shape.
|
86
|
-
email:
|
85
|
+
description: Cerberus is a Continuous Integration software for Ruby projects. CI helps you keep your project in a good shape. Cerberus could be easily invoked from Cron (for Unix) or nnCron (for Windows) utilities.
|
86
|
+
email: cpjolicoeur@gmail.com
|
87
87
|
executables:
|
88
88
|
- cerberus
|
89
89
|
extensions: []
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- test/data
|
133
133
|
- test/data/darcs.zip
|
134
134
|
- test/data/git.zip
|
135
|
+
- test/data/git.zip.bak
|
135
136
|
- test/data/subversion.dump
|
136
137
|
- test/functional_test.rb
|
137
138
|
- test/integration_test.rb
|
@@ -150,9 +151,9 @@ files:
|
|
150
151
|
- test/rss_publisher_test.rb
|
151
152
|
- test/test_helper.rb
|
152
153
|
- test/twitter_publisher_test.rb
|
153
|
-
-
|
154
|
-
-
|
155
|
-
-
|
154
|
+
- License.txt
|
155
|
+
- Readme.txt
|
156
|
+
- Changelog.txt
|
156
157
|
- Rakefile
|
157
158
|
- doc/site
|
158
159
|
has_rdoc: false
|