sr (owner)

Revisions

  • 59386a sr Wed Jul 15 03:17:29 -0700 2009
  • 722e8f sr Wed Jul 15 03:13:56 -0700 2009
  • adb5b0 sr Wed Jul 15 03:12:42 -0700 2009
  • 552159 sr Wed Jul 15 03:10:38 -0700 2009
  • e58bf5 sr Wed Jul 15 03:09:00 -0700 2009
  • 3c61b0 sr Wed Jul 15 03:05:45 -0700 2009
gist: 147619 Download_button fork
public
Description:
Queued continuous integration server built on top of Bob & Bobette
Public Clone URL: git://gist.github.com/147619.git
Embed All Files: show embed
buildable.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require "dm-core"
require "beacon"
require "bob"
 
module Buildozor
  class Buildable
    include DataMapper::Resource, Bob::Buildable
 
    property :id, Serial
    property :scm, String
    property :uri, String
    property :branch, String
    property :commit, String
    property :command, String
 
    property :status, Boolean, :nullable => true
    property :output, String, :nullable => true
 
    property :started_at, DateTime, :nullable => true
    property :completed_at, DateTime, :nullable => true
 
    alias_method :build_script, :command
 
    def build
      super(commit)
    end
 
    def start_building(commit_id, commit_info)
      update(:started_at => Time.now)
 
      Beacon.fire(:start_building, self)
    end
 
    def finish_building(commit_id, status, output)
      update(:status => status, :output => output, :completed_at => Time.now)
 
      Beacon.fire(:finish_building, self)
    end
  end
end
builder.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require File.dirname(__FILE__) + "/buildable"
require "shout-bot"
 
DataMapper.setup(:default, "sqlite3:buildables.db")
 
# Not possible to use Bob::Engine::Threaded ATM because Bob keeps a single SCM
# working copy per repo URI while it should keep one per buildable IMO.
Bob.engine = Bob::Engine::Foreground
Bob.logger = Logger.new(STDOUT)
 
Beacon.watch(:start_building) { |buildable|
  ShoutBot.shout("irc://BUILDOZOR@irc.freenode.net/@buildozor") { |room|
    room.say "Started building #{buildable.commit} of #{buildable.uri}"
  }
}
 
Beacon.watch(:finish_building) { |buildable|
  ShoutBot.shout("irc://BUILDOZOR@irc.freenode.net/#buildozor") { |room|
    room.say "Built #{buildable.commit} #{buildable.status}"
  }
}
 
loop {
  buildable = Buildozor::Buildable.first(:started_at => nil)
  sleep 10 unless buildable
  buildable.build
}
recv.ru #
1
2
3
4
5
6
7
8
9
10
require "bobette"
require "bobette/github"
 
require File.dirname(__FILE__) + "/buildable"
 
DataMapper.setup(:default, "sqlite3:buildables.db")
DataMapper.auto_upgrade!
 
use Bobette::GitHub
run Bobette.new(proc { |payload| Buildozor::Buildable.first_or_create(payload) }