Module: CIJoe::Campfire
- Defined in:
- lib/cijoe/campfire.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.activate ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cijoe/campfire.rb', line 3 def self.activate if valid_config? require 'broach' CIJoe::Build.class_eval do include CIJoe::Campfire end puts "Loaded Campfire notifier" else puts "Can't load Campfire notifier." puts "Please add the following to your project's .git/config:" puts "[campfire]" puts "\ttoken = 12345abcd" puts "\tsubdomain = whatever" puts "\troom = Awesomeness" puts "\tssl = false" end end |
.config ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/cijoe/campfire.rb', line 23 def self.config @config ||= { :subdomain => Config.campfire.subdomain.to_s, :token => Config.campfire.token.to_s, :room => Config.campfire.room.to_s, :ssl => Config.campfire.ssl.to_s.strip == 'true' } end |
.valid_config? ⇒ Boolean
32 33 34 35 36 |
# File 'lib/cijoe/campfire.rb', line 32 def self.valid_config? %w( subdomain token room ).all? do |key| !config[key.intern].empty? end end |
Instance Method Details
#notify ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cijoe/campfire.rb', line 38 def notify config = Campfire.config Broach.settings = { 'account' => config[:subdomain], 'token' => config[:token], 'use_ssl' => config[:ssl] ? true : false } # Only complain if failed # XXX: yes this is lame, but we should we really only announce a # successful build if the repo changed. # Broach.speak(config[:room], "#{}. #{commit.url}") if failed? #room.speak "#{short_message}. #{commit.url}" #room.paste full_message if failed? #room.leave end |