backup 3.0.12 → 3.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Backup 3
2
2
  ========
3
3
 
4
- 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.
4
+ 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.
5
5
 
6
6
  Author
7
7
  ------
@@ -98,6 +98,7 @@ Notifiers
98
98
 
99
99
  - Mail
100
100
  - Twitter
101
+ - Campfire
101
102
 
102
103
  [Notifiers Wiki Page](https://github.com/meskyanichi/backup/wiki/Notifiers)
103
104
 
@@ -255,6 +256,14 @@ Contributors
255
256
  <td><a href="https://github.com/phlipper" target="_blank">Phil Cohen ( phlipper )</a></td>
256
257
  <td>Exclude Option for Archives</td>
257
258
  </tr>
259
+ <tr>
260
+ <td><a href="https://github.com/arunagw" target="_blank">Arun Agrawal ( arunagw )</a></td>
261
+ <td>Campfire notifier</td>
262
+ </tr>
263
+ <tr>
264
+ <td><a href="https://github.com/szimmermann" target="_blank">Stefan Zimmermann ( szimmermann )</a></td>
265
+ <td>Enabling package/archive (tar utility) support for more Linux distro's (FreeBSD, etc)</td>
266
+ </tr>
258
267
  </table>
259
268
 
260
269
  Want to contribute?
@@ -7,8 +7,16 @@ module Backup
7
7
  class << self
8
8
 
9
9
  ##
10
- # Campfire credentials
11
- attr_accessor :token, :subdomain, :room_id
10
+ # Campfire api authentication token
11
+ attr_accessor :api_token
12
+
13
+ ##
14
+ # Campfire account's subdomain
15
+ attr_accessor :subdomain
16
+
17
+ ##
18
+ # Campfire account's room id
19
+ attr_accessor :room_id
12
20
 
13
21
  end
14
22
  end
@@ -19,8 +19,16 @@ module Backup
19
19
  class Campfire < Base
20
20
 
21
21
  ##
22
- # Campfire credentials
23
- attr_accessor :token, :subdomain, :room_id
22
+ # Campfire api authentication token
23
+ attr_accessor :api_token
24
+
25
+ ##
26
+ # Campfire account's subdomain
27
+ attr_accessor :subdomain
28
+
29
+ ##
30
+ # Campfire account's room id
31
+ attr_accessor :room_id
24
32
 
25
33
  ##
26
34
  # Container for the Model object
@@ -75,7 +83,7 @@ module Backup
75
83
  # Setting up credentials
76
84
  def set_defaults!
77
85
  @campfire_client = {
78
- :token => @token,
86
+ :api_token => @api_token,
79
87
  :subdomain => @subdomain,
80
88
  :room_id => @room_id
81
89
  }
@@ -83,13 +91,13 @@ module Backup
83
91
 
84
92
  ##
85
93
  # Creates a new Campfire::Interface object and passes in the
86
- # campfire clients "room_id", "subdomain" and "token". Using this object
94
+ # campfire clients "room_id", "subdomain" and "api_token". Using this object
87
95
  # the provided "message" will be sent to the desired Campfire chat room
88
96
  def send_message(message)
89
97
  room = Interface.room(
90
98
  @campfire_client[:room_id],
91
99
  @campfire_client[:subdomain],
92
- @campfire_client[:token]
100
+ @campfire_client[:api_token]
93
101
  )
94
102
  room.message(message)
95
103
  end
@@ -112,29 +120,36 @@ module Backup
112
120
  ##
113
121
  # Instantiates a new Campfire::Room object with
114
122
  # the provided arguments and returns this object
115
- def self.room(room_id, subdomain, token)
116
- Room.new(room_id, subdomain, token)
123
+ def self.room(room_id, subdomain, api_token)
124
+ Room.new(room_id, subdomain, api_token)
117
125
  end
118
126
  end
119
127
 
120
128
  ##
121
129
  # The Campfire::Room acts as a model for an actual room on the Campfire service.
122
130
  # And it uses the Campfire::Interface's (HTTParty) class methods to communicate based
123
- # on the provided parameters (room_id, subdomain and token)
131
+ # on the provided parameters (room_id, subdomain and api_token)
124
132
  class Room
125
133
 
126
134
  ##
127
- # These are the necessary attributes that Campfire requires
128
- # in order to communicate with the correct chat rooms
129
- attr_reader :room_id, :subdomain, :token
135
+ # Campfire api authentication api_token
136
+ attr_accessor :api_token
137
+
138
+ ##
139
+ # Campfire account's subdomain
140
+ attr_accessor :subdomain
141
+
142
+ ##
143
+ # Campfire account's room id
144
+ attr_accessor :room_id
130
145
 
131
146
  ##
132
147
  # Instantiates a new Campfire::Room object and sets all the
133
- # necessary arguments (@room_id, @subdomain, @token)
134
- def initialize(room_id, subdomain, token)
148
+ # necessary arguments (@room_id, @subdomain, @api_token)
149
+ def initialize(room_id, subdomain, api_token)
135
150
  @room_id = room_id
136
151
  @subdomain = subdomain
137
- @token = token
152
+ @api_token = api_token
138
153
  end
139
154
 
140
155
  ##
@@ -163,7 +178,7 @@ module Backup
163
178
  # the POST request that was built in the #send_message (private) method
164
179
  def post(action, options = {})
165
180
  Interface.base_uri("https://#{subdomain}.campfirenow.com")
166
- Interface.basic_auth(token, 'x')
181
+ Interface.basic_auth(api_token, 'x')
167
182
  Interface.post(room_url_for(action), options)
168
183
  end
169
184
 
@@ -13,7 +13,7 @@ module Backup
13
13
  # Defines the minor version
14
14
  # PATCH:
15
15
  # Defines the patch version
16
- MAJOR, MINOR, PATCH = 3, 0, 12
16
+ MAJOR, MINOR, PATCH = 3, 0, 13
17
17
 
18
18
  ##
19
19
  # Returns the major version ( big release based off of multiple minor releases )
@@ -0,0 +1,8 @@
1
+ notify_by Campfire do |campfire|
2
+ campfire.on_success = true
3
+ campfire.on_failure = true
4
+
5
+ campfire.api_token = 'my_api_authentication_token'
6
+ campfire.subdomain = 'my_subdomain'
7
+ campfire.room_id = 'my_room_id'
8
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Notifier::Campfire do
6
+ before do
7
+ Backup::Configuration::Notifier::Campfire.defaults do |campfire|
8
+ campfire.api_token = 'my_api_authentication_token'
9
+ campfire.subdomain = 'my_subdomain'
10
+ campfire.room_id = 'my_room_id'
11
+ end
12
+ end
13
+
14
+ it 'should set the default campfire configuration' do
15
+ campfire = Backup::Configuration::Notifier::Campfire
16
+ campfire.api_token.should == 'my_api_authentication_token'
17
+ campfire.subdomain.should == 'my_subdomain'
18
+ campfire.room_id.should == 'my_room_id'
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Notifier::Twitter do
6
+ before do
7
+ Backup::Configuration::Notifier::Twitter.defaults do |tweet|
8
+ tweet.consumer_key = 'my_consumer_key'
9
+ tweet.consumer_secret = 'my_consumer_secret'
10
+ tweet.oauth_token = 'my_oauth_token'
11
+ tweet.oauth_token_secret = 'my_oauth_token_secret'
12
+ end
13
+ end
14
+
15
+ it 'should set the default tweet configuration' do
16
+ tweet = Backup::Configuration::Notifier::Twitter
17
+ tweet.consumer_key.should == 'my_consumer_key'
18
+ tweet.consumer_secret.should == 'my_consumer_secret'
19
+ tweet.oauth_token.should == 'my_oauth_token'
20
+ tweet.oauth_token_secret.should == 'my_oauth_token_secret'
21
+ end
22
+ end
@@ -5,14 +5,14 @@ require File.dirname(__FILE__) + '/../spec_helper'
5
5
  describe Backup::Notifier::Campfire do
6
6
  let(:notifier) do
7
7
  Backup::Notifier::Campfire.new do |campfire|
8
- campfire.token = 'token'
8
+ campfire.api_token = 'token'
9
9
  campfire.subdomain = 'subdomain'
10
10
  campfire.room_id = 'room_id'
11
11
  end
12
12
  end
13
13
 
14
14
  it do
15
- notifier.token.should == 'token'
15
+ notifier.api_token.should == 'token'
16
16
  notifier.subdomain.should == 'subdomain'
17
17
  notifier.room_id.should == 'room_id'
18
18
 
@@ -22,16 +22,16 @@ describe Backup::Notifier::Campfire do
22
22
 
23
23
  describe 'defaults' do
24
24
  it do
25
- Backup::Configuration::Notifier::Campfire.defaults do |twitter|
26
- twitter.token = 'old_token'
27
- twitter.on_success = false
28
- twitter.on_failure = true
25
+ Backup::Configuration::Notifier::Campfire.defaults do |campfire|
26
+ campfire.api_token = 'old_token'
27
+ campfire.on_success = false
28
+ campfire.on_failure = true
29
29
  end
30
- notifier = Backup::Notifier::Campfire.new do |twitter|
31
- twitter.token = 'new_token'
30
+ notifier = Backup::Notifier::Campfire.new do |campfire|
31
+ campfire.api_token = 'new_token'
32
32
  end
33
33
 
34
- notifier.token.should == 'new_token'
34
+ notifier.api_token.should == 'new_token'
35
35
  notifier.on_success.should == false
36
36
  notifier.on_failure.should == true
37
37
  end
@@ -88,7 +88,7 @@ describe Backup::Notifier::Campfire do
88
88
  end
89
89
 
90
90
  it do
91
- room.token.should == 'token'
91
+ room.api_token.should == 'token'
92
92
  room.subdomain.should == 'subdomain'
93
93
  room.room_id.should == 'room_id'
94
94
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 12
10
- version: 3.0.12
9
+ - 13
10
+ version: 3.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael van Rooijen
@@ -123,6 +123,7 @@ files:
123
123
  - lib/templates/database/redis
124
124
  - lib/templates/encryptor/gpg
125
125
  - lib/templates/encryptor/openssl
126
+ - lib/templates/notifier/campfire
126
127
  - lib/templates/notifier/mail
127
128
  - lib/templates/notifier/twitter
128
129
  - lib/templates/readme
@@ -147,7 +148,9 @@ files:
147
148
  - spec/configuration/database/redis_spec.rb
148
149
  - spec/configuration/encryptor/gpg_spec.rb
149
150
  - spec/configuration/encryptor/open_ssl_spec.rb
151
+ - spec/configuration/notifier/campfire_spec.rb
150
152
  - spec/configuration/notifier/mail_spec.rb
153
+ - spec/configuration/notifier/twitter_spec.rb
151
154
  - spec/configuration/storage/cloudfiles_spec.rb
152
155
  - spec/configuration/storage/dropbox_spec.rb
153
156
  - spec/configuration/storage/ftp_spec.rb