Skip to content
This repository was archived by the owner on Sep 25, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem 'nokogiri'
gem 'sqlite3-ruby'
gem 'resque'
gem 'grit'
gem 'RedCloth', '4.2.3'
gem 'RedCloth', '4.2.5'
gem 'aasm'
gem 'broach'
gem 'mongrel', '1.2.0.pre2'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.3)
RedCloth (4.2.5)
aasm (2.2.0)
abstract (1.0.0)
actionmailer (3.0.1)
Expand Down Expand Up @@ -159,7 +159,7 @@ PLATFORMS
ruby

DEPENDENCIES
RedCloth (= 4.2.3)
RedCloth (= 4.2.5)
aasm
annotate-models
broach
Expand Down
25 changes: 23 additions & 2 deletions app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<%= f.label :script, "Script" %>
<%= f.text_area :script %>
</p>
<p>
<hr>
</p>
<p>
<%= f.check_box :campfire, :class => 'checkbox' %>
<%= f.label :campfire, "Campfire Notifications", :class => 'checkbox' %>
Expand All @@ -40,6 +43,24 @@
</p>
<p>
<%= f.check_box :ssl, :class => 'checkbox' %>
<%= f.label :ssl, "SSL?", :class => 'checkbox' %>
<%= f.label :ssl, "Campfire requires SSL?", :class => 'checkbox' %>
</p>
<p>
<hr>
</p>
<p>
<%= f.check_box :irc, :class => 'checkbox' %>
<%= f.label :irc, "IRC Notifications", :class => 'checkbox' %>
</p>

<p>
<%= f.label :channel, "Channel (example, #projectname)" %>
<%= f.text_field :channel %>
</p>
<p>
<%= f.label :ircserver, "IRC Server" %>
<%= f.text_field :ircserver %>
</p>
<p>
<%= f.label :ircnick, "IRC Nick (example, magnum_ci)" %>
<%= f.text_field :ircnick %>
</p>
15 changes: 15 additions & 0 deletions db/migrate/20120501155429_add_irc_to_projects.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class AddIrcToProjects < ActiveRecord::Migration
def self.up
add_column :projects, :irc, :boolean
add_column :projects, :channel, :string
add_column :projects, :ircserver, :string
add_column :projects, :ircnick, :string
end

def self.down
remove_column :projects, :irc
remove_column :projects, :channel
remove_column :projects, :server
remove_column :projects, :ircnick
end
end
38 changes: 36 additions & 2 deletions lib/run_build.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
require "socket"

# The irc class, which talks to the server and holds the main event loop
class IRC
def initialize(server, port, nick, channel)
@server = server
@port = port
@nick = nick
@channel = channel
@irc = ::TCPSocket.open(@server, @port)
send "USER blah blah blah :blah blah"
send "NICK #{@nick}"
send "JOIN #{@channel}"
puts "(Tried to) Connected to IRC server"
end
def send(s)
# Send a message to the irc server and print it to the screen
puts "--> #{s}"
@irc.send "#{s}\n", 0
end
def destroy
send "server disconnect"
@irc.close
puts "Disconnected from IRC server"
end
end

class RunBuild
@queue = :build
class << self
Expand All @@ -24,8 +51,15 @@ def build
def notify
if @build.project.campfire
Broach.settings = @build.project.campfire_settings
Broach.speak(@build.project.room, "#{@build.project.name.titleize} commit #{@build.name} pushed by #{@build.committer} #{@build.pass_fail} [ #{APP_CONFIG[:site][:address]}/#{@build.project.name}/builds/#{@build.id} ]")
Broach.speak(@build.project.room, "#{@build.project.name.titleize} commit #{@build.name} pushed by #{@build.committer} #{@build.pass_fail} [ #{APP_CONFIG[:site][:address]}/#{@build.project.name}/builds/#{@build.id} ]")
end

if @build.project.irc
@irc = IRC.new(@build.project.ircserver, '6667', @build.project.ircnick, @build.project.channel)
sleep 4
@irc.send("privmsg #{@build.project.channel} :#{@build.project.name.titleize} commit #{@build.name} pushed by #{@build.committer} #{@build.pass_fail} \[ #{APP_CONFIG[:site][:address]}/#{@build.project.name}/builds/#{@build.id} \]\n")
@irc.destroy
end
end
end
end
end
6 changes: 3 additions & 3 deletions lib/tasks/workers.rake
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ namespace :workers do

desc "Start all Magnum CI queues"
task :magnum_ci do
`nohup rake workers:start COUNT=1 QUEUE=build > log/workers.log 2>&1 &`
`nohup rake workers:start COUNT=2 QUEUE=clone > log/workers.log 2>&1 &`
`nohup rake workers:start COUNT=2 QUEUE=delete > log/workers.log 2>&1 &`
`nohup rake workers:start COUNT=1 VVERBOSE=1 QUEUE=build --trace > log/workers.log 2>&1 &`
`nohup rake workers:start COUNT=2 VVERBOSE=1 QUEUE=clone --trace > log/workers.log 2>&1 &`
`nohup rake workers:start COUNT=2 VVERBOSE=1 QUEUE=delete --trace > log/workers.log 2>&1 &`
end

desc "Run and manage group of Resque workers with some default options"
Expand Down