Class: BuildMaster::CI::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/buildmaster/ci/server.rb

Overview

A CI (Continuous Integration) server that does the following loop

  • check for modifications

  • if modification set found,

** update ** make ** publish (update site, email notification)

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



14
15
16
17
# File 'lib/buildmaster/ci/server.rb', line 14

def initialize
  @modification_checker = Array.new
  @updator = Array.new
end

Instance Method Details

#serveObject



19
20
21
22
23
24
25
26
# File 'lib/buildmaster/ci/server.rb', line 19

def serve
  pid = fork {start}
  if (pid)
    ['INT', 'TERM'].each { |signal|
         trap(signal){Process.kill('break', pid)} 
    }
  end
end

#startObject



28
29
30
31
32
33
34
35
36
# File 'lib/buildmaster/ci/server.rb', line 28

def start
  puts "server started"
  until @stopped
    if check_modifications
      build_loop
    end
    sleep 30
  end
end

#stopObject



38
39
40
41
# File 'lib/buildmaster/ci/server.rb', line 38

def stop
  @stopped = true
  Thread.current.raise 'shutting down'
end