Sha256: 40db1b462d08e23187c6700c7c74d395a784163271fc0f18aa313122a323364b

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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}: #{variables[:url] || variables[: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

2 entries across 2 versions & 1 rubygems

Version Path
fingercap-0.3.3 lib/fingercap/recipes/notify.rb
fingercap-0.3.2 lib/fingercap/recipes/notify.rb