3 category: Ruby libraries
10 * [DAddYE/do](https://github.com/DAddYE/do)
14 server = DO::Server.new('srv1', 'srv1.domain.local', 'root', :key =>
22 server.run 'uname', '-a'
23 # root@srv1 ~ # uname -a
24 # Linux srv1.lipsiasoft.net 2.6.18-194.32.1.el5 x86_64 x86_64 x86_64 GNU/Linux
26 server.run 'mysqladmin -u root -p password "oldone"', 'newpassword'
27 # root@srv1 ~ # mysqladmin -u root -p password 'oldone'
28 # Enter password: oldone
29 # mysqladmin: connect to server at 'localhost' failed
30 # error: 'Access denied for user 'root'@'localhost' (using password: YES)'
34 server.exist?('~/.ssh')
35 # root@srv1 ~ # test -e ~/.ssh && echo True
38 server.read('/etc/redhat-release')
39 # root@srv1 ~ # cat /etc/redhat-release
40 # => "CentOS release 5.5 (Final)"
44 server.upload '/tmp/file', '/tmp/foo'
45 # root@srv1 ~ # upload from '/tmp/file' to '/tmp/foo'
47 server.download '/tmp/foo', '/tmp/file2'
48 # root@srv1 ~ # download from '/tmp/foo' to '/tmp/file2'
52 server.replace :all, 'new content', '/tmp/file'
53 # root@srv1 ~ # replace all in '/tmp/foo'
55 server.read('/tmp/foo')
56 # root@srv1 ~ # cat /tmp/foo
61 server.replace /content$/, 'changed content', '/tmp/foo'
62 # root@srv1 ~ # replace /content$/ in '/tmp/foo'
64 server.read('/tmp/foo')
65 # root@srv1 ~ # cat /tmp/foo
66 # => "new changed content"
70 server.append('appended', '/tmp/foo')
71 # root@srv1 ~ # append to 'bottom' in '/tmp/foo'
73 server.read('/tmp/foo')
74 # root@srv1 ~ # cat /tmp/foo
75 # => "new changed contentappended"
79 server.append('---', '/tmp/foo', :top)
80 # root@srv1 ~ # append to 'top' in '/tmp/foo'
82 server.read('/tmp/foo')
83 # root@srv1 ~ # cat /tmp/foo
84 # => "---new changed contentappended"
88 server.ask "Please choose"
89 # root@srv1 ~ # Please choose: foo
92 server.yes? "Do you want to proceed"
93 # root@srv1 ~ # Do you want to proceed? (y/n): y
97 # Press ENTER to continue...