Sha256: 4e0f0709c635beac50b34ec43747a0ef406ad1037ab80e0319383ddfe4f4f8e4

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'yaml'

Capistrano::Configuration.instance(:must_exist).load do
  namespace :notify do
    begin
      require 'broach'
    rescue LoadError
      def notify(action)
        puts "[!] Please `gem install broach' to post deployment messages to Campfire."
      end
    else
      def notify(action)
        begin
          Broach.settings =  YAML.load_file(File.expand_path('~/.fingercap.yml'))['campfire']
        rescue Errno::ENOENT
          puts "[!] Fingercap can't find it's configuration file at ~/.fingercap.yml"
          puts File.read(File.expand_path('../../../../examples/fingercap.yml', __FILE__))
          exit -1
        end
        
        Broach.speak(Broach.session.room, "#{ENV['USER']} just #{action} #{application}: #{repository}")
      end
    end
    
    desc "Posts a `deployed' message to Campfire"
    task :deploy do
      notify "deployed"
    end
    
    desc "Posts a `deployed and migrated' message to Campfire"
    task :migrations do
      notify "deployed and migrated"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fingercap-0.3.1 lib/fingercap/recipes/notify.rb