Skip to content

Instantly share code, notes, and snippets.

@joelmoss
Forked from mperham/gist:1831203
Created February 15, 2012 21:56

Revisions

  1. joelmoss revised this gist Feb 15, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -43,16 +43,16 @@ def text(msg)
    puts "Missing .campfire.yml or ../.campfire.yml or ~/.campfire.yml with your API token, can't announce deploys."
    end

    ROOM = Room.new(config) if config
    ROOM = Room.new(config) if respond_to?(:config)
    end

    task :pre_announce do
    deploy.campfire
    ROOM.text "is deploying '#{application}' to #{stage}" if ROOM
    ROOM.text "is deploying '#{application}' to #{stage}" if respond_to?(:ROOM)
    end

    task :post_announce do
    ROOM.text "finished deploying '#{application}' to #{stage}" if ROOM
    ROOM.text "finished deploying '#{application}' to #{stage}" if respond_to?(:ROOM)
    end
    end

  2. joelmoss revised this gist Feb 15, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ def text(msg)
    namespace :deploy do
    task :campfire do
    yml1, yml2, yml3 = ".campfire.yml", "../.campfire.yml", "~/.campfire.yml"
    yml1, yml2, yml3 = File.expand_path(yml1), File.expand_path(yml3), File.expand_path(yml3)
    yml1, yml2, yml3 = File.expand_path(yml1), File.expand_path(yml2), File.expand_path(yml3)
    if File.exist?(yml1)
    config = YAML.load_file(yml1)
    elsif File.exist?(yml2)
    @@ -48,11 +48,11 @@ def text(msg)

    task :pre_announce do
    deploy.campfire
    ROOM.text "is deploying #{application} to #{stage}" if ROOM
    ROOM.text "is deploying '#{application}' to #{stage}" if ROOM
    end

    task :post_announce do
    ROOM.text "finished deploying #{application} to #{stage}" if ROOM
    ROOM.text "finished deploying '#{application}' to #{stage}" if ROOM
    end
    end

  3. joelmoss revised this gist Feb 15, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ def text(msg)
    puts "Missing .campfire.yml or ../.campfire.yml or ~/.campfire.yml with your API token, can't announce deploys."
    end

    ROOM = Room.new(config) config
    ROOM = Room.new(config) if config
    end

    task :pre_announce do
  4. joelmoss revised this gist Feb 15, 2012. 2 changed files with 60 additions and 43 deletions.
    60 changes: 60 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    # Put this at the bottom of your config/deploy.rb
    # Requires config file at .campfire.yml or ~/.campfire.yml or ../.campfire.yml
    # with your API token from your Campfire "My Info" page:
    #
    # token: lkjsadfsaduoi1u31oui3eh1kj2h
    # roomid: 123456
    # subdomain: acmeco

    class Room
    attr_accessor :config

    def initialize(cfg)
    @config = cfg
    end

    def say(msg, type=:Paste)
    url = "https://#{config['subdomain']}.campfirenow.com/room/#{config['roomid']}"
    message = "<message><type>#{type}Message</type><body>#{msg}</body></message>"
    `curl -i -u #{config['token']}:X -H 'Content-Type: application/xml' -d '#{message}' #{url}/speak.xml`
    end

    def paste(msg)
    say msg
    end

    def text(msg)
    say msg, :Text
    end

    end

    namespace :deploy do
    task :campfire do
    yml1, yml2, yml3 = ".campfire.yml", "../.campfire.yml", "~/.campfire.yml"
    yml1, yml2, yml3 = File.expand_path(yml1), File.expand_path(yml3), File.expand_path(yml3)
    if File.exist?(yml1)
    config = YAML.load_file(yml1)
    elsif File.exist?(yml2)
    config = YAML.load_file(yml2)
    elsif File.exist?(yml3)
    config = YAML.load_file(yml3)
    else
    puts "Missing .campfire.yml or ../.campfire.yml or ~/.campfire.yml with your API token, can't announce deploys."
    end

    ROOM = Room.new(config) config
    end

    task :pre_announce do
    deploy.campfire
    ROOM.text "is deploying #{application} to #{stage}" if ROOM
    end

    task :post_announce do
    ROOM.text "finished deploying #{application} to #{stage}" if ROOM
    end
    end

    before "deploy", "deploy:pre_announce"
    after "deploy", "deploy:post_announce"
    43 changes: 0 additions & 43 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,43 +0,0 @@
    # Put this at the bottom of your config/deploy.rb
    # Requires config file ~/.campfire.yml with your API token from
    # your Campfire "My Info" page:
    #
    # token: lkjsadfsaduoi1u31oui3eh1kj2h
    # roomid: 123456
    # subdomain: acmeco

    class Room
    attr_accessor :config
    def initialize(cfg)
    @config = cfg
    end
    def say(msg, type=:Paste)
    `curl -i -u #{config['token']}:X -H 'Content-Type: application/xml' -d '<message><type>#{type}Message</type><body>#{msg}</body></message>' https://#{config['subdomain']}.campfirenow.com/room/#{config['roomid']}/speak.xml`
    end
    def paste(msg); say(msg); end
    def text(msg); say(msg, :Text); end
    end

    namespace :deploy do
    task :campfire do
    yml = File.expand_path("~/.campfire.yml")
    if File.exist?(yml)
    config = YAML.load_file(yml)
    ROOM = Room.new(config)
    else
    puts "Missing ~/.campfire.yml with your API token, can't announce deploys."
    end
    end

    task :pre_announce do
    deploy.campfire
    ROOM.text "is deploying #{application} to #{stage}" if ROOM
    end

    task :post_announce do
    ROOM.text "finished deploying #{application} to #{stage}" if ROOM
    end
    end

    before "deploy", "deploy:pre_announce"
    after "deploy", "deploy:post_announce"
  5. @mperham mperham revised this gist Feb 14, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    # your Campfire "My Info" page:
    #
    # token: lkjsadfsaduoi1u31oui3eh1kj2h
    # roomid: 123456
    # subdomain: acmeco

    class Room
    attr_accessor :config
  6. @mperham mperham revised this gist Feb 14, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ class Room
    @config = cfg
    end
    def say(msg, type=:Paste)
    `curl -i -u #{config['token']}:X -H 'Content-Type: application/xml' -d '<message><type>#{type}Message</type><body>#{msg}</body></message>' https://theclymb1.campfirenow.com/room/440273/speak.xml`
    `curl -i -u #{config['token']}:X -H 'Content-Type: application/xml' -d '<message><type>#{type}Message</type><body>#{msg}</body></message>' https://#{config['subdomain']}.campfirenow.com/room/#{config['roomid']}/speak.xml`
    end
    def paste(msg); say(msg); end
    def text(msg); say(msg, :Text); end
  7. @mperham mperham created this gist Feb 14, 2012.
    41 changes: 41 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    # Put this at the bottom of your config/deploy.rb
    # Requires config file ~/.campfire.yml with your API token from
    # your Campfire "My Info" page:
    #
    # token: lkjsadfsaduoi1u31oui3eh1kj2h

    class Room
    attr_accessor :config
    def initialize(cfg)
    @config = cfg
    end
    def say(msg, type=:Paste)
    `curl -i -u #{config['token']}:X -H 'Content-Type: application/xml' -d '<message><type>#{type}Message</type><body>#{msg}</body></message>' https://theclymb1.campfirenow.com/room/440273/speak.xml`
    end
    def paste(msg); say(msg); end
    def text(msg); say(msg, :Text); end
    end

    namespace :deploy do
    task :campfire do
    yml = File.expand_path("~/.campfire.yml")
    if File.exist?(yml)
    config = YAML.load_file(yml)
    ROOM = Room.new(config)
    else
    puts "Missing ~/.campfire.yml with your API token, can't announce deploys."
    end
    end

    task :pre_announce do
    deploy.campfire
    ROOM.text "is deploying #{application} to #{stage}" if ROOM
    end

    task :post_announce do
    ROOM.text "finished deploying #{application} to #{stage}" if ROOM
    end
    end

    before "deploy", "deploy:pre_announce"
    after "deploy", "deploy:post_announce"