From 53633887afb6fc52374beef403f733832f28b105 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Wed, 5 Aug 2009 11:00:34 -0400 Subject: [PATCH 1/8] update changelog and todo list --- Changelog.txt | 3 +-- Todo.txt | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 0b0876f..d453b77 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,8 +8,7 @@ New config options, Bazaar SCM support, removed GMailer bugfixes * removed GMailer library. Use default Mail publisher instead * added 'build_dir' option for setting custom build directory * added 'setup_script' option for a custom script to be run before build command -* Projects using the Git SCM were not getting the full diff output in their -Publishers +* Projects using the Git SCM were not getting the full diff output in their Publishers == Version 0.6 New Ruby builder, bugfixes, and refactoring diff --git a/Todo.txt b/Todo.txt index d819a65..40ec1a8 100644 --- a/Todo.txt +++ b/Todo.txt @@ -14,12 +14,16 @@ * update rake builder to only check exit status or aborted msg * Add smart algorithm for calculating of person's name who broke release * Add on_success on_failure and on_finish opions to builders +* update Rakefile +* move away from using meta_project gem to package and release source +* add "file" Builder to create raw txt file output ============= | WISH LIST | ============= +* Create "cerberus_web" to view Cerberus output from a website * Make possibility to run tests for all revisions (not only latest for that moment) * Send svn log not only for latest revision but from latest successfull. For that we need to store version of latest successful rev. * IRC: make message colorized. Make messages shorter to avoid irc flood (and ban to user) From c654aee0302e90cb0b75b299fcdb8eaefaaa1c98 Mon Sep 17 00:00:00 2001 From: Mike Gunderloy Date: Sat, 23 Jan 2010 07:44:46 -0600 Subject: [PATCH 2/8] Add options[:publisher, :extra_subject] Useful for adding extra information to the subject line of messages, for example to provide tags within Flowdock. --- Changelog.txt | 5 +++++ lib/cerberus/config.example.yml | 1 + lib/cerberus/constants.rb | 2 +- lib/cerberus/publisher/base.rb | 2 +- test/mail_publisher_test.rb | 5 +++-- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index d453b77..cb055a9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,10 @@ = Cerberus Changelog +== Version 0.7.1 +New configuration options for publisher + +* added "extra_subject" publisher option + == Version 0.7 New config options, Bazaar SCM support, removed GMailer bugfixes diff --git a/lib/cerberus/config.example.yml b/lib/cerberus/config.example.yml index 97c9dd0..e0fa813 100644 --- a/lib/cerberus/config.example.yml +++ b/lib/cerberus/config.example.yml @@ -23,6 +23,7 @@ publisher: # url: http://someemail:password@cerberustool.campfirenow.com/room/51660 # rss: # file: /usr/www/rss.xml +# extra_subject: "#deployment #tags" #builder: # rake: # task: migrate test diff --git a/lib/cerberus/constants.rb b/lib/cerberus/constants.rb index f42cc05..1591f41 100644 --- a/lib/cerberus/constants.rb +++ b/lib/cerberus/constants.rb @@ -4,5 +4,5 @@ module Cerberus LOCK_WAIT = 30 * 60 # 30 minutes - VERSION = '0.7' + VERSION = '0.7.1' end diff --git a/lib/cerberus/publisher/base.rb b/lib/cerberus/publisher/base.rb index f3ce0f9..54d08ab 100644 --- a/lib/cerberus/publisher/base.rb +++ b/lib/cerberus/publisher/base.rb @@ -32,7 +32,7 @@ def self.formatted_message(state, manager, options) raise "Unknown build state '#{state.current_state.to_s}'" end - subject = "[#{options[:application_name]}] #{subject}" + subject = "[#{options[:application_name]}]#{options[:publisher, :extra_subject]} #{subject}" generated_by = "--\nThis email generated by Cerberus tool ver. #{Cerberus::VERSION}, http://cerberus.rubyforge.org/" body = [ manager.scm.last_commit_message ] if options[:changeset_url] diff --git a/test/mail_publisher_test.rb b/test/mail_publisher_test.rb index 8ddb83d..0eda163 100644 --- a/test/mail_publisher_test.rb +++ b/test/mail_publisher_test.rb @@ -11,7 +11,8 @@ def setup def test_publisher options = Cerberus::Config.new(nil, :publisher => { - :mail => {:recipients => 'anatol.pomozov@hello.com', :sender => "cerberus@example.com", :delivery_method => 'test'}}, + :mail => {:recipients => 'anatol.pomozov@hello.com', :sender => "cerberus@example.com", :delivery_method => 'test'}, + :extra_subject => "[#deployment]"}, :application_name => 'MyApp') build = DummyManager.new('last message', 'this is output', 1232, 'anatol') @@ -21,6 +22,6 @@ def test_publisher assert_equal 1, mails.size mail = mails[0] assert_equal 'cerberus@example.com', mail.from_addrs[0].address - assert_equal '[MyApp] Cerberus set up for project (1232)', mail.subject + assert_equal '[MyApp][#deployment] Cerberus set up for project (1232)', mail.subject end end From b89c84da12fdc4beb12bea03f7128562bca3b944 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Wed, 10 Feb 2010 11:04:48 -0500 Subject: [PATCH 3/8] update link to github wiki --- Readme.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.markdown b/Readme.markdown index 6b3dff7..feb0a4f 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -126,7 +126,7 @@ is included in the License.txt file. [1]:http://www.martinfowler.com/articles/continuousIntegration.html -[2]:http://wiki.github.com/cpjolicoeur/cerberusci +[2]:http://wiki.github.com/cpjolicoeur/cerberus [3]:http://groups.google.com/group/cerberusci [4]:http://cpjolicoeur.lighthouseapp.com/projects/22299-cerberus [5]:http://rubyforge.org/frs/?group_id=1794 From 540211070b577a098330225d817d35f2d1794039 Mon Sep 17 00:00:00 2001 From: McClain Looney Date: Thu, 11 Feb 2010 01:55:25 +0800 Subject: [PATCH 4/8] mercurial support --- Rakefile | 2 + lib/cerberus/component_lazy_loader.rb | 5 +- lib/cerberus/scm/hg.rb | 87 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 lib/cerberus/scm/hg.rb diff --git a/Rakefile b/Rakefile index 2d36572..4c3190e 100644 --- a/Rakefile +++ b/Rakefile @@ -3,6 +3,7 @@ require 'rake' require 'rake/testtask' require 'rake/packagetask' require 'rake/gempackagetask' +require 'rake/clean' require './lib/cerberus/constants' @@ -25,6 +26,7 @@ Rake::TestTask.new(:test) do |t| t.verbose = true end +CLEAN.include %w(**/*~) desc "Clean all generated files" task :clean => :clobber_package do root = File.dirname(__FILE__) diff --git a/lib/cerberus/component_lazy_loader.rb b/lib/cerberus/component_lazy_loader.rb index 35d9f4b..ab339b3 100644 --- a/lib/cerberus/component_lazy_loader.rb +++ b/lib/cerberus/component_lazy_loader.rb @@ -6,7 +6,8 @@ module SCM :perforce => 'Perforce', :cvs => 'CVS', :bzr => 'Bazaar', - :git => 'Git' + :git => 'Git', + :hg => 'Mercurial' } def self.get(type) @@ -30,6 +31,8 @@ def self.guess_type(path) 'bzr' when test(?d, path+'/.git') 'git' + when test(?d, path+'/.hg') + 'hg' end else #guess SCM type by its url diff --git a/lib/cerberus/scm/hg.rb b/lib/cerberus/scm/hg.rb new file mode 100644 index 0000000..66556ba --- /dev/null +++ b/lib/cerberus/scm/hg.rb @@ -0,0 +1,87 @@ +require 'cerberus/utils' +require 'cerberus/scm/base' + +class Cerberus::SCM::Mercurial < Cerberus::SCM::Base + + def installed? + exec_successful? "#{@config[:bin_path]}hg --version" + end + + def update! + @new =false + if test( ?d, File.join( @path,'.hg' ) ) + r = get_localrev + get_updates + r_new = get_localrev + @has_changes = r_new !=r + else + FileUtils.rm_rf(@path) if test(?d, @path) + encoded_url = (@config[:scm, :url].include?(' ') ? "\"#{@config[:scm, :url]}\"" : @config[:scm, :url]) + @new = true + @has_changes = true + @status = execute("clone", "#{encoded_url} #{@path}", false) + if branch = @config[:scm, :branch] + execute('update', "-C #{branch}") + end + end + extract_commit_info if @has_changes + end + + def has_changes? + @has_changes + end + + + def new? + @new + end + + def current_revision + @revision + end + + def last_commit_message + @message + end + + def last_author + @author + end + + def output + @status + end + + private + def get_localrev + execute("id", '-i').strip + end + + def get_updates + execute("pull", '-u') + end + + def remote_head + branch = @config[:scm, :branch] || 'default' + end + + def execute(command, parameters = nil, with_path = true) + if with_path + cmd = "cd #{@config[:application_root]} && #{@config[:bin_path]}hg #{command} #{parameters}" + else + cmd = "#{@config[:bin_path]}hg #{command} #{parameters}" + end + `#{cmd}` + end + + def extract_commit_info( branch='default' ) + message = execute("log", "-b #{ branch } -r tip --template '{author}|{date|shortdate}|{node}|{desc}'").split("|") + m= { :author => message.shift, :date => message.shift, :revision => message.shift, :message => message.shift } + @message = m[:message] + @author = m[:author] + @date = m[:date] + @revision = m[:revision] + m + end + +end From aec195fb08a3a5bf6815545ded55722698aa504f Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Wed, 10 Feb 2010 15:07:58 -0500 Subject: [PATCH 5/8] add mercurial repository for tests --- test/data/mercurial.zip | Bin 0 -> 5165 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/data/mercurial.zip diff --git a/test/data/mercurial.zip b/test/data/mercurial.zip new file mode 100644 index 0000000000000000000000000000000000000000..b5ecc45825b86fd75122028b35b07d24f1b269c6 GIT binary patch literal 5165 zcmb7Idpwl+9-eW@q%q@`$Yos;DPyQM$}Y2UFq6oo>oUd|#)+A2m?Ww}MQc-w+)CL^ zQP^UsO<@u#w@T!6qYvqFPD!nM;k@r$%=^AGqjSdR#UFmp?|Giz_xJriFK>#Xk}3-P z+}=fY6#OFkrixNWMKU;aE+?E8VdK9Qi{dIrQ4Rvn2pWa*2G(h#Fu)gbofd2z!Nr&A z8_ni0K!7v|!26tXTq051^~3skn%QY-0bfuv1t#Ol)4Wa3+;#aiX9$IB4yWKYs@GV= zI(YW%TtIoN$U8AMiLys2rOZ86&^#J< zKWRFhcn~(<}K> z;I@=HTE@%UA7(T@d_G{(z^2D?FOnVg6Ju|xzrJhV_qVw*#YsCRS&MD{i z04AtlinqM=ZvZS)(iNH_G_wU^=6t{uD%F#;-phBZz)R2y@EJjC3%r!Q4D@n#8T>Gi z0J0CmNHze0D)(IIK?~_&LBT;oo*Om~;Wwvv^AwKjDq5)PqstZ4lg3F{cYXqT9jH|W z^X%7Se^~UyyR$po@kw|CKSYeC^b{HXC zTvU!CAhkOrRlYG+iGM%)U3cL;>xNRM&(PR=12-2!r$PUV!N!w|^%HX_)Dh>wrkOXY z+Z#JPwmP(q3&hwOo~yS9ggA)A2n|Jw(UBq)63&T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?mY)-mdXjx3Uo%7_uayz1bepI$9!N1dd(jf0e3hh?F zZvNVivR&==SmvsgYF7LAYV;j6d-BRLfXj7!N_C~M`(j)CDD{VUK0F)n2zA<)T4wSjG4{ESnc3w(xyyxM7%Ega| zKOCc7Cx5q2X)>cRs3X2%wMsW06k2~Ko3|Md872^lR#>Pgl!|-_QAJ^azYu(!r%2#W zNelGfikW?t@uq+nlI#pk^I8y$$^9Bg6ySD-;hT2~Egwyg#JyBoQ3R zPj)`ihVYvr=_?`miBmQPB~IB;cA#2l<}`tzRVD<;L6d1DQaA_=jd;c|=rCp3M2SRb zghg5^+X6iZ@)XH;o@``MV8oz6qO!eS=?u{j(kvPgwTZ%=g9#TrWpB%(9i&_ ziOK{#P&ja!uplBI5*h{I%Gt6Zzt#@G6ak&QnlR<>V4#vrAtVT93gP7y-UH;g#Y3>B zNF58HnnjZvgAz|}Xcqv1pi>fl9C%;~Nz6k|aUnHuihEO(fqMe}A7BycN1&#!3#Qk9 E0dhF Date: Wed, 10 Feb 2010 15:30:55 -0500 Subject: [PATCH 6/8] add basic mercurial tests --- test/data/mercurial.zip | Bin 5165 -> 4082 bytes test/functional_test.rb | 64 ++++++++++++++++++++++++++++++++++++++++ test/test_helper.rb | 13 ++++++++ 3 files changed, 77 insertions(+) diff --git a/test/data/mercurial.zip b/test/data/mercurial.zip index b5ecc45825b86fd75122028b35b07d24f1b269c6..ffc225563b816348b2a3595be99864d84b52a377 100644 GIT binary patch literal 4082 zcma)92{_d29v;mMnlp%MD3l@VDaMvW;l>d|IU+@t!OU=CCNm?7qMS&U?v=*U(RNT1 z>a?h1B$_N`y-nn%qLg$?D!U5z`_FRBLg)THzgeDVzV~~7?{DRSha*rh=&_``+VVaK zUJ$UQFykG&!U42Am+s2VLaqUPT@1D%DkYidiwJU@+p&~SD%Zr6DA zVzBPia`nTx_`p&7!G@W)DBn7+%MR=236Z-Y$~$(Dk2!&RgMgt0cZY`4=nMjb_!o82 zYi$m`-^cD+LNB{_+{n*7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%wMsW06k2~Ko3|Md872^lR#>Pgl!|-_QAJ^azYu(!r%2#W zNelGfikW?t@uq+nlI#pk^I8y$$^9Bg6ySD-;hT2~Egwyg#JyBoQ3R zPj)`ihVYvr=_?`miBmQPB~IB;cA#2l<}`tzRVD<;L6d1DQaA_=jd;c|=rCp3M2SRb zghg5^+X6iZ@)XH;o@``MV8oz6qO!eS=?u{j(kvPgwTZ%=g9#TrWpB%(9i&_ ziOK{#P&ja!uplBI5*h{I%Gt6Zzt#@G6ak&QnlR<>V4#vrAtVT93gP7y-UH;g#Y3>B zNF58HnnjZvgAz|}Xcqv1pi>fl9C%;~Nz6k|aUnHuihEO(fqMe}A7BycN1&#!3#Qk9 E0dhF {:type => 'hg'}) + + build = Cerberus::BuildCommand.new('hgapp') + build.run + assert build.scm.has_changes? + assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup + mail = ActionMailer::Base.deliveries[0] + output = mail.body + + #Check output that run needed tasks + assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output + assert output !~ /Task 'custom1' has been invoked/ + assert_match /\[hgapp\] Cerberus set up for project/, mail.subject + + status_file = HOME + '/work/hgapp/status.log' + assert File.exists?(status_file) + assert build_successful?(status_file) + assert 1, Dir[HOME + "/work/hgapp/logs/*.log"].size + + #There were no changes - no reaction should be + build = Cerberus::BuildCommand.new('hgapp') + build.run + assert_equal false, build.scm.has_changes? + assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup + assert 1, Dir[HOME + "/work/hgapp/logs/*.log"].size + + #now we add new broken test + rand_val = rand(10000) + test_case_name = "test/#{rand_val}_test.rb" + File.open(HG_REPO + '/' + test_case_name, 'w') { |f| + f << %Q( require 'test/unit' + class A#{rand_val}Test < Test::Unit::TestCase + def test_ok + assert false + end + end ) + } + + curr_dir = Dir.pwd + Dir.chdir HG_REPO + `hg add #{test_case_name}` + `hg commit -m 'somepatch'` + Dir.chdir curr_dir + + build = Cerberus::BuildCommand.new('hgapp') + build.run + assert build.scm.has_changes? + assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup plus new alert email + assert 2, Dir[HOME + "/work/hgapp/logs/*.log"].size + + build = Cerberus::BuildCommand.new('hgapp') + build.run + assert_equal false, build.scm.has_changes? + assert_equal 2, ActionMailer::Base.deliveries.size #first email that project was setup + assert 2, Dir[HOME + "/work/hgapp/logs/*.log"].size + + #Now we broke remote repository (imitate that network unaccessable) + FileUtils.rm_rf HG_REPO + build = Cerberus::BuildCommand.new('hgapp') + build.run + assert_equal false, build.scm.has_changes? + end def test_campfire_publisher # there were not any messages causing login/password is incorrect. We just check that there was no any exceptions diff --git a/test/test_helper.rb b/test/test_helper.rb index 830912d..4964555 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -21,6 +21,9 @@ class Test::Unit::TestCase GIT_REPO = TEMP_DIR + '/git_repo' GIT_URL = 'file:///' + GIT_REPO.gsub(/\\/,'/').gsub(/^\//,'').gsub(' ', '%20') + + HG_REPO = TEMP_DIR + '/hg_repo' + HG_URL = 'file:///' + HG_REPO.gsub(/\\/, '/').gsub(/^\//, '').gsub(' ', '%20') def self.refresh_repos # setup base subversion repos @@ -50,6 +53,16 @@ def self.refresh_repos zf.extract(e, fpath) } } + + # setup base hg repos + FileUtils.mkpath HG_REPO + Zip::ZipFile::open("#{File.dirname(__FILE__)}/data/mercurial.zip") { |zf| + zf.each { |e| + fpath = File.join(HG_REPO, e.name) + FileUtils.mkdir_p(File.dirname(fpath)) + zf.extract(e, fpath) + } + } end refresh_repos From 51a0d0f3f018f679c1f002bc442f77bc00494c2b Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Wed, 10 Feb 2010 15:36:39 -0500 Subject: [PATCH 7/8] update docs, credits, and changelog --- Changelog.txt | 1 + Copyright.txt | 3 ++- Readme.markdown | 1 + doc/site/src/credits.page | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index cb055a9..8efd764 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -4,6 +4,7 @@ New configuration options for publisher * added "extra_subject" publisher option +* added Mercurial SCM support == Version 0.7 New config options, Bazaar SCM support, removed GMailer bugfixes diff --git a/Copyright.txt b/Copyright.txt index 598b8fd..0a182fc 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -13,4 +13,5 @@ Niklas Koponen Mike Gunderloy Joe Van Dyk Andrew Timberlake -Paul Hinze \ No newline at end of file +Paul Hinze +McClain Looney \ No newline at end of file diff --git a/Readme.markdown b/Readme.markdown index feb0a4f..3fed946 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -87,6 +87,7 @@ Cerberus currently supports the following SCM tools: * Perforce * CVS * Bazaar + * Mercurial Cerberus currently supports the following notification systems: diff --git a/doc/site/src/credits.page b/doc/site/src/credits.page index 9f6c064..535732a 100644 --- a/doc/site/src/credits.page +++ b/doc/site/src/credits.page @@ -18,3 +18,4 @@ The following people made notable contributions to the Cerberus tool: * [Joe Van Dyk](http://fixieconsulting.com/) - Git SCM cleanup * [Andrew Timberlake](http://ramblingsonrails.com) - Custom build script support * [Paul Hinze](http://phinze.com/) - Bazaar SCM support +* [McClain Looney](http://github.com/mlooney) - Mercurial Support From 1a3490d514e7b5ea1aac616265751867868c264b Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Wed, 10 Feb 2010 15:39:46 -0500 Subject: [PATCH 8/8] add mercurial info to website --- doc/site/src/index.page | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/site/src/index.page b/doc/site/src/index.page index 90508d1..02eba82 100644 --- a/doc/site/src/index.page +++ b/doc/site/src/index.page @@ -7,7 +7,7 @@ sort_info: 1 Cerberus is a lightweight and easy-to-use Continuous Builder software for Ruby. It could be run periodically from a scheduler and check if application tests are broken. In case of failed tests Cerberus sends notification to developers. -Cerberus works perfectly both on Windows and \*nix platforms and supports popular version control systems like Subversion, Git, Darcs and Perforce. It also has many ways in publishing build results such as e-mail, jabber, [Twitter](http://twitter.com), [Campfire](http://www.campfirenow.com), IRC and RSS files. +Cerberus works perfectly both on Windows and \*nix platforms and supports popular version control systems like Subversion, Git, Mercurial, Bazaar, Darcs and Perforce. It also has many ways in publishing build results such as e-mail, jabber, [Twitter](http://twitter.com), [Campfire](http://www.campfirenow.com), IRC and RSS files. Cerberus requires: @@ -18,6 +18,7 @@ Optional requirements: * [rake](http://rubyforge.org/projects/rake) - 0.7 or higher * [subversion](http://subversion.tigris.org/) * [git](http://git.or.cz) +* [mercurial](http://mercurial.selenic.com/) * [bazaar](http://bazaar-vcs.org/) * [darcs](http://darcs.net/) client - 1.0.7 or higher * [bjam](http://www.boost.org/tools/build/v2/index.html)