Skip to content

Instantly share code, notes, and snippets.

@matthewtodd
Created June 24, 2009 07:21

Revisions

  1. matthewtodd revised this gist Jun 24, 2009. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@ class DeployNotifier
    include Appscript

    def initialize(*names)
    @application = app('iChat')
    @accounts = names.map { |name| bonjour_account(name) }
    @ichat = app('iChat')
    @accounts = names.map { |name| bonjour_account(name) }
    end

    def spam(message)
    @@ -15,11 +15,11 @@ def spam(message)
    private

    def bonjour_account(name)
    @application.services['Bonjour'].accounts[name]
    @ichat.services['Bonjour'].accounts[name]
    end

    def send_spam(message, account)
    @application.send_(message, :to => @account)
    @ichat.send_(message, :to => @account)
    rescue
    $stderr.puts "Error spamming #{account}."
    end
  2. matthewtodd renamed this gist Jun 24, 2009. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. matthewtodd created this gist Jun 24, 2009.
    26 changes: 26 additions & 0 deletions gistfile1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    require 'appscript'

    class DeployNotifier
    include Appscript

    def initialize(*names)
    @application = app('iChat')
    @accounts = names.map { |name| bonjour_account(name) }
    end

    def spam(message)
    @accounts.each { |account| send_spam(message, account) }
    end

    private

    def bonjour_account(name)
    @application.services['Bonjour'].accounts[name]
    end

    def send_spam(message, account)
    @application.send_(message, :to => @account)
    rescue
    $stderr.puts "Error spamming #{account}."
    end
    end