Module: CIJoe::Campfire

Defined in:
lib/cijoe/campfire.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cijoe/campfire.rb', line 3

def self.activate
  if valid_config?
    require 'tinder'

    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 "\tuser = [email protected]"
    puts "\tpass = passw0rd"
    puts "\tsubdomain = whatever"
    puts "\troom = Awesomeness"
    puts "\tssl = false"
  end
end

.configObject



24
25
26
27
28
29
30
31
32
# File 'lib/cijoe/campfire.rb', line 24

def self.config
  @config ||= {
    :subdomain => Config.campfire.subdomain.to_s,
    :user      => Config.campfire.user.to_s,
    :pass      => Config.campfire.pass.to_s,
    :room      => Config.campfire.room.to_s,
    :ssl       => Config.campfire.ssl.to_s.strip == 'true'
  }
end

.valid_config?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/cijoe/campfire.rb', line 34

def self.valid_config?
  %w( subdomain user pass room ).all? do |key|
    !config[key.intern].empty?
  end
end

Instance Method Details

#notifyObject



40
41
42
43
44
# File 'lib/cijoe/campfire.rb', line 40

def notify
  room.speak "#{short_message}. #{commit.url}"
  room.paste full_message if failed?
  room.leave
end