Created
December 24, 2010 03:44
-
-
Save jtadeulopes/753877 to your computer and use it in GitHub Desktop.
dls for backup!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Backup of mysql, files, whatever... | |
# | |
# example 1 | |
backup.start do | |
new :mysql => {:host => '0.0.0.0', :user => 'root', :password => 'mypass'} | |
new :mysql => {:host => '0.0.0.0', :user => 'root', :password => 'mypass'} | |
new :archive => {:host => '0.0.0.0', :user => 'root', :password => 'mypass', :remote_file => ''} | |
end | |
# example 2 | |
backup do | |
mysql do | |
server "my server name" do | |
user "user_server" | |
password "password" | |
tables [:table01, :table02, :table03] | |
end | |
end | |
files do | |
server "my server name" do | |
host "0.0.0.0" | |
user "user_server" | |
password "password" | |
remote_path "/remote/path/file/to/backup" | |
local_path "/local/path" | |
end | |
end | |
end | |
# example 3 | |
backup :of => :mysql do | |
server :linode, | |
:host => '0.0.0.0', | |
:user => 'root', | |
:password => 'my_pass' | |
server :locaweb, | |
:host => '0.0.0.0', | |
:user => 'root', | |
:password => 'my_pass' | |
# | |
# Updated, based on comments | |
# | |
backup do | |
to do | |
remote_path '/path/to/remote/save/backup' | |
host '0.0.0.0' | |
user 'user_server' | |
password 'password' | |
end | |
mysql do | |
server 'blabla' do | |
host '0.0.0.0' | |
user 'root' | |
password 'my_root_password' | |
database 'server_database' | |
end | |
server 'bleble' do | |
host '0.0.0.0' | |
user 'root' | |
password 'my_root_password' | |
database 'server_database' | |
end | |
end | |
archive do | |
to do | |
local_path '/path/to/local/save/backup' | |
end | |
remote 'blublue' do | |
host '0.0.0.0' | |
user 'root' | |
password 'root_password' | |
files '/path/to/files' | |
end | |
local 'misc' do | |
files '/home/jtadeulopes/www/*.rb' | |
end | |
end | |
end |
Thanks Lucas!
Cássio,
I agree with you, the example 1 is a pretty ugly :( The idea of using methods makes the code more beautiful!
Hey, congrats for the idea! :]
I personally think that example 3 is the easiest read, and seems the least verbose.
Oh, and example 2 is really RSpec-like! Which is a good thing considering how many people are used to it's sintax.
Great work! I'm looking forward into watching your repo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks great, congrats Jésus!