Module: CIJoe::Talker

Defined in:
lib/cijoe/talker.rb

Defined Under Namespace

Classes: TalkerRoom

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activateObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cijoe/talker.rb', line 42

def self.activate
  if valid_config?

    CIJoe::Build.class_eval do
      include CIJoe::Talker
    end

    puts "Loaded Talker notifier"
  else
    puts "Can't load Talker notifier."
    puts "Please add the following to your project's .git/config:"
    puts "[talker]"
    puts "\ttoken = yourtalkertoken"
    puts "\tsubdomain = whatever"
    puts "\troom_id = nnn"
    puts "\tssl = false"
  end
end

.configObject



61
62
63
64
65
66
67
68
# File 'lib/cijoe/talker.rb', line 61

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

.valid_config?Boolean

Returns:

  • (Boolean)


70
71
72
73
74
# File 'lib/cijoe/talker.rb', line 70

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

Instance Method Details

#notifyObject



76
77
78
79
80
# File 'lib/cijoe/talker.rb', line 76

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