Module: CIJoe::Campfire

Defined in:
lib/cijoe/campfire.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activate(project_path) ⇒ Object



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(project_path)
  @project_path = project_path
  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 "\ttoken = your_api_token"
    puts "\tsubdomain = whatever"
    puts "\troom = Awesomeness"
    puts "\tssl = false"
  end
end

.configObject



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

def self.config
  @config ||= {
    :subdomain => Config.campfire(@project_path).subdomain.to_s,
    :token     => Config.campfire(@project_path).token.to_s,
    :room      => Config.campfire(@project_path).room.to_s,
    :ssl       => Config.campfire(@project_path).ssl.to_s.strip == 'true'
  }
end

.valid_config?Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#notifyObject



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

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