meskyanichi/backup — pull request #191 by cbou (2011-10-09 13:04:00+00:00)
Title: make model extendable

Hi,

I tried to write a way to have extendable model. I wanted to do such a config possible:

```ruby
Backup::Model.new(:db_backup, 'My Backup', '') do

database MySQL do |db|
db.name = "firstdb"
db.username = "firstdb"
db.password = "firstdb"
db.host = "localhost"
db.port = 3306
db.socket = "/var/run/mysqld/mysqld.sock"
end

database MySQL do |db|
db.name = "seconddb"
db.username = "seconddb"
db.password = "seconddb"
db.host = "localhost"
db.port = 3306
db.socket = "/var/run/mysqld/mysqld.sock"
end

compress_with Gzip do |compression|
compression.best = true
compression.fast = false
end

end

Backup::Model.new(:daily, 'My Backup', :db_backup) do

store_with S3 do |s3|
s3.access_key_id = 'my_access_key_id'
s3.secret_access_key = 'my_secret_access_key'
s3.region = 'us-east-1'
s3.bucket = 'bucket-name'
s3.path = '/path/to/my/daily-backups'
s3.keep = 10
end

end

Backup::Model.new(:weekly, 'My Backup', :db_backup) do

store_with S3 do |s3|
s3.access_key_id = 'my_access_key_id'
s3.secret_access_key = 'my_secret_access_key'
s3.region = 'us-east-1'
s3.bucket = 'bucket-name'
s3.path = '/path/to/my/weekly-backups'
s3.keep = 10
end

end

Backup::Model.new(:monthly, 'My Backup', :db_backup) do

store_with S3 do |s3|
s3.access_key_id = 'my_access_key_id'
s3.secret_access_key = 'my_secret_access_key'
s3.region = 'us-east-1'
s3.bucket = 'bucket-name'
s3.path = '/path/to/my/monthly-backups'
s3.keep = 10
end

end

```

I'm very new in ruby, so feel free to make a better implementation if you want to keep this feature.