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 23 |
# 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" elsif ENV['RACK_ENV'] != 'test' 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 |
.config ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/cijoe/campfire.rb', line 25 def self.config campfire_config = Config.new('campfire', @project_path) @config ||= { :subdomain => campfire_config.subdomain.to_s, :token => campfire_config.token.to_s, :room => campfire_config.room.to_s, :ssl => campfire_config.ssl.to_s.strip == 'true' } end |
.valid_config? ⇒ Boolean
35 36 37 38 39 |
# File 'lib/cijoe/campfire.rb', line 35 def self.valid_config? %w( subdomain token room ).all? do |key| !config[key.intern].empty? end end |
Instance Method Details
#notify ⇒ Object
41 42 43 44 45 46 |
# File 'lib/cijoe/campfire.rb', line 41 def notify room.speak "#{}. #{commit.url}" room.play "#{play_sound}" room.paste if failed? room.leave end |