Sha256: bd56f67c9430cde817a851a144c279350e168048f85cf4be430f9b0e512e23ac
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
require 'drb' require 'rubygems' require 'needle' require_gem 'rscm' require 'damagecontrol/poller' require 'damagecontrol/standard_persister' # Wire up the whole DamageControl app with Needle's nice block based DI framework. # I wonder - is BDI (Block Dependency Injection) a new flavour of DI? REGISTRY = Needle::Registry.define do |b| b.persister do DamageControl::StandardPersister.new end b.poller do DamageControl::Poller.new do |project, changesets| b.persister.save_changesets(project, changesets) b.persister.save_diffs(project, changesets) b.persister.save_rss(project) changeset = changesets.latest project.build(changeset.identifier) do |build| env = { 'PKG_BUILD' => changeset.identifier.to_s, # Rake standard 'DAMAGECONTROL_BUILD_LABEL' => changeset.identifier.to_s # For others } build.execute(project.build_command, env) end end end b.drb_server do DamageControl::DrbServer.new('druby://localhost:9000') end end module DamageControl class App def run REGISTRY.poller.start REGISTRY.drb_server.start DRb.thread.join # Block forever end end # Drb top-level object that can be accessed by the web app. # The webapp should use this for any operations that are # lengthy. # class DrbServer def initialize(drb_url) @drb_url = drb_url end def start DRb.start_service(@drb_url, self) Log.info "DamageControl server running on #{@drb_url}" end def save_project(project) project.save end def delete_project(project) project.delete end def checkout_project(project) project.checkout end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
damagecontrol-0.5.0 | lib/damagecontrol/app.rb |