Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 411efab + 9c6739c commit 28221b3a6dd0417b0fab957ddc18d6da6b77d644 Michael van Rooijen committed Mar 29, 2011
View
@@ -1,7 +1,7 @@
Backup 3
========
-Backup is a RubyGem (for UNIX-like operating systems: Linux, Mac OSX) that allows you to configure and perform backups in a simple manner using an elegant Ruby DSL. It supports various databases (MySQL, PostgreSQL, MongoDB and Redis), it supports various storage locations (Amazon S3, Rackspace Cloud Files, Dropbox, any remote server through FTP, SFTP, SCP and RSync), it provide Syncers (RSync, S3) for efficient backups, it can archive files and directories, it can cycle backups, it can do incremental backups, it can compress backups, it can encrypt backups (OpenSSL or GPG), it can notify you about successful and/or failed backups (Email or Twitter). It is very extensible and easy to add new functionality to. It's easy to use.
+Backup is a RubyGem (for UNIX-like operating systems: Linux, Mac OSX) that allows you to configure and perform backups in a simple manner using an elegant Ruby DSL. It supports various databases (MySQL, PostgreSQL, MongoDB and Redis), it supports various storage locations (Amazon S3, Rackspace Cloud Files, Dropbox, any remote server through FTP, SFTP, SCP and RSync), it provide Syncers (RSync, S3) for efficient backups, it can archive files and directories, it can cycle backups, it can do incremental backups, it can compress backups, it can encrypt backups (OpenSSL or GPG), it can notify you about successful and/or failed backups (Email, Twitter or Campfire). It is very extensible and easy to add new functionality to. It's easy to use.
Author
------
@@ -98,6 +98,7 @@ Notifiers
- Mail
- Twitter
+- Campfire
[Notifiers Wiki Page](https://github.com/meskyanichi/backup/wiki/Notifiers)
@@ -255,6 +256,14 @@ Contributors
<td><a href="https://github.com/phlipper" target="_blank">Phil Cohen ( phlipper )</a></td>
<td>Exclude Option for Archives</td>
</tr>
+ <tr>
+ <td><a href="https://github.com/arunagw" target="_blank">Arun Agrawal ( arunagw )</a></td>
+ <td>Campfire notifier</td>
+ </tr>
+ <tr>
+ <td><a href="https://github.com/szimmermann" target="_blank">Stefan Zimmermann ( szimmermann )</a></td>
+ <td>Enabling package/archive (tar utility) support for more Linux distro's (FreeBSD, etc)</td>
+ </tr>
</table>
Want to contribute?
@@ -7,8 +7,16 @@ class Campfire < Base
class << self
##
- # Campfire credentials
- attr_accessor :token, :subdomain, :room_id
+ # Campfire api authentication token
+ attr_accessor :api_token
+
+ ##
+ # Campfire account's subdomain
+ attr_accessor :subdomain
+
+ ##
+ # Campfire account's room id
+ attr_accessor :room_id
end
end
@@ -19,8 +19,16 @@ module Notifier
class Campfire < Base
##
- # Campfire credentials
- attr_accessor :token, :subdomain, :room_id
+ # Campfire api authentication token
+ attr_accessor :api_token
+
+ ##
+ # Campfire account's subdomain
+ attr_accessor :subdomain
+
+ ##
+ # Campfire account's room id
+ attr_accessor :room_id
##
# Container for the Model object
@@ -75,21 +83,21 @@ def notify_failure!(exception)
# Setting up credentials
def set_defaults!
@campfire_client = {
- :token => @token,
+ :api_token => @api_token,
:subdomain => @subdomain,
:room_id => @room_id
}
end
##
# Creates a new Campfire::Interface object and passes in the
- # campfire clients "room_id", "subdomain" and "token". Using this object
+ # campfire clients "room_id", "subdomain" and "api_token". Using this object
# the provided "message" will be sent to the desired Campfire chat room
def send_message(message)
room = Interface.room(
@campfire_client[:room_id],
@campfire_client[:subdomain],
- @campfire_client[:token]
+ @campfire_client[:api_token]
)
room.message(message)
end
@@ -112,29 +120,36 @@ class Interface
##
# Instantiates a new Campfire::Room object with
# the provided arguments and returns this object
- def self.room(room_id, subdomain, token)
- Room.new(room_id, subdomain, token)
+ def self.room(room_id, subdomain, api_token)
+ Room.new(room_id, subdomain, api_token)
end
end
##
# The Campfire::Room acts as a model for an actual room on the Campfire service.
# And it uses the Campfire::Interface's (HTTParty) class methods to communicate based
- # on the provided parameters (room_id, subdomain and token)
+ # on the provided parameters (room_id, subdomain and api_token)
class Room
##
- # These are the necessary attributes that Campfire requires
- # in order to communicate with the correct chat rooms
- attr_reader :room_id, :subdomain, :token
+ # Campfire api authentication api_token
+ attr_accessor :api_token
+
+ ##
+ # Campfire account's subdomain
+ attr_accessor :subdomain
+
+ ##
+ # Campfire account's room id
+ attr_accessor :room_id
##
# Instantiates a new Campfire::Room object and sets all the
- # necessary arguments (@room_id, @subdomain, @token)
- def initialize(room_id, subdomain, token)
+ # necessary arguments (@room_id, @subdomain, @api_token)
+ def initialize(room_id, subdomain, api_token)
@room_id = room_id
@subdomain = subdomain
- @token = token
+ @api_token = api_token
end
##
@@ -163,7 +178,7 @@ def send_message(message, type = 'Textmessage')
# the POST request that was built in the #send_message (private) method
def post(action, options = {})
Interface.base_uri("https://#{subdomain}.campfirenow.com")
- Interface.basic_auth(token, 'x')
+ Interface.basic_auth(api_token, 'x')
Interface.post(room_url_for(action), options)
end
@@ -13,7 +13,7 @@ class Version
# Defines the minor version
# PATCH:
# Defines the patch version
- MAJOR, MINOR, PATCH = 3, 0, 12
+ MAJOR, MINOR, PATCH = 3, 0, 13
##
# Returns the major version ( big release based off of multiple minor releases )
@@ -0,0 +1,8 @@
+ notify_by Campfire do |campfire|
+ campfire.on_success = true
+ campfire.on_failure = true
+
+ campfire.api_token = 'my_api_authentication_token'
+ campfire.subdomain = 'my_subdomain'
+ campfire.room_id = 'my_room_id'
+ end
@@ -0,0 +1,20 @@
+# encoding: utf-8
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Backup::Configuration::Notifier::Campfire do
+ before do
+ Backup::Configuration::Notifier::Campfire.defaults do |campfire|
+ campfire.api_token = 'my_api_authentication_token'
+ campfire.subdomain = 'my_subdomain'
+ campfire.room_id = 'my_room_id'
+ end
+ end
+
+ it 'should set the default campfire configuration' do
+ campfire = Backup::Configuration::Notifier::Campfire
+ campfire.api_token.should == 'my_api_authentication_token'
+ campfire.subdomain.should == 'my_subdomain'
+ campfire.room_id.should == 'my_room_id'
+ end
+end
@@ -0,0 +1,22 @@
+# encoding: utf-8
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Backup::Configuration::Notifier::Twitter do
+ before do
+ Backup::Configuration::Notifier::Twitter.defaults do |tweet|
+ tweet.consumer_key = 'my_consumer_key'
+ tweet.consumer_secret = 'my_consumer_secret'
+ tweet.oauth_token = 'my_oauth_token'
+ tweet.oauth_token_secret = 'my_oauth_token_secret'
+ end
+ end
+
+ it 'should set the default tweet configuration' do
+ tweet = Backup::Configuration::Notifier::Twitter
+ tweet.consumer_key.should == 'my_consumer_key'
+ tweet.consumer_secret.should == 'my_consumer_secret'
+ tweet.oauth_token.should == 'my_oauth_token'
+ tweet.oauth_token_secret.should == 'my_oauth_token_secret'
+ end
+end
@@ -5,14 +5,14 @@
describe Backup::Notifier::Campfire do
let(:notifier) do
Backup::Notifier::Campfire.new do |campfire|
- campfire.token = 'token'
+ campfire.api_token = 'token'
campfire.subdomain = 'subdomain'
campfire.room_id = 'room_id'
end
end
it do
- notifier.token.should == 'token'
+ notifier.api_token.should == 'token'
notifier.subdomain.should == 'subdomain'
notifier.room_id.should == 'room_id'
@@ -22,16 +22,16 @@
describe 'defaults' do
it do
- Backup::Configuration::Notifier::Campfire.defaults do |twitter|
- twitter.token = 'old_token'
- twitter.on_success = false
- twitter.on_failure = true
+ Backup::Configuration::Notifier::Campfire.defaults do |campfire|
+ campfire.api_token = 'old_token'
+ campfire.on_success = false
+ campfire.on_failure = true
end
- notifier = Backup::Notifier::Campfire.new do |twitter|
- twitter.token = 'new_token'
+ notifier = Backup::Notifier::Campfire.new do |campfire|
+ campfire.api_token = 'new_token'
end
- notifier.token.should == 'new_token'
+ notifier.api_token.should == 'new_token'
notifier.on_success.should == false
notifier.on_failure.should == true
end
@@ -88,7 +88,7 @@
end
it do
- room.token.should == 'token'
+ room.api_token.should == 'token'
room.subdomain.should == 'subdomain'
room.room_id.should == 'room_id'
end

0 comments on commit 28221b3

Please sign in to comment.