Class: Dreamy::Command::Mysql
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #dbs ⇒ Object (also: #index)
- #hosts ⇒ Object
- #users ⇒ Object
Methods inherited from Base
#ask, #display, #extract_option, #home_directory, #initialize, #running_on_windows?, #shell
Constructor Details
This class inherits a constructor from Dreamy::Command::Base
Instance Method Details
#dbs ⇒ Object Also known as: index
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dreamy/commands/mysql.rb', line 4 def dbs dbs = @account.mysql_dbs if dbs.empty? display "No MySQL databases on this account" else db_table = table do |t| t.headings = 'Name', 'Home', 'Description', 'Disk used (MB)' dbs.each { |db| t << [db.name,db.home,db.description,db.disk_usage_mb] } end display db_table end end |
#hosts ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dreamy/commands/mysql.rb', line 18 def hosts hosts = @account.mysql_hosts if hosts.empty? display "No MySQL hosts on this account" else host_table = table do |t| t.headings = 'Domain Name','Home' hosts.each { |host| t << [host.domain,host.home] } end display host_table end end |
#users ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dreamy/commands/mysql.rb', line 31 def users users = @account.mysql_users if users.empty? display "No MySQL users on this account" else user_table = table do |t| t.headings = 'Username', 'Database', 'Sel', 'Ins', 'Upd', 'Del', 'Cre', 'Drop', 'Ind', 'Alt' users.each { |u| t << [u.username,u.db,u.select,u.insert,u.update,u.delete,u.create,u.drop,u.index,u.alter] } end display user_table end end |