class ActiveScripts::Packages::Mysql
Private Instance Methods
install()
click to toggle source
INFO: ActiveScripts::Packages::Mysql
contains code that
execute the MySQL package.
# File lib/active_scripts/packages/mysql.rb, line 10 def install if package_installed?(includes: "mysql") || package_installed?(command: "which mysql", includes: "mysql") notify_package_exists! else case $operating_system when :macosx execute_command!("brew install mysql") say_ok(" Installation complete!") when :linux if agree(" [?] Dedicated MySQL? ", true) if agree(" [?] MySQL client only? ", true) execute_command!("sudo apt-get -y install mysql-client") else execute_command!("sudo mysql_secure_installation") end else execute_command!("sudo apt-get -y install mysql-server mysql-client libmysqlclient-dev") end say_ok(" Installation complete!") else notify_package_unavailable! end end end
uninstall()
click to toggle source
# File lib/active_scripts/packages/mysql.rb, line 53 def uninstall if package_installed?(includes: "mysql") || package_installed?(command: "which mysql", includes: "mysql") case $operating_system when :macosx execute_command!("brew remove mysql") say_ok(" Uninstallation complete!") when :linux execute_command!("sudo apt-get -y --purge remove mysql-server mysql-client libmysqlclient-dev") execute_command!("sudo apt-get -y autoremove") say_ok(" Uninstallation complete!") else notify_package_unavailable! end else notify_package_missing! end end
upgrade()
click to toggle source
# File lib/active_scripts/packages/mysql.rb, line 35 def upgrade if package_installed?(includes: "mysql") || package_installed?(command: "which mysql", includes: "mysql") case $operating_system when :macosx output = execute_command!("brew upgrade mysql") say_warning(" [!] #{output.squish}") unless option_dry_run? || package_output?(output, includes: "Error:") say_ok(" Upgrade complete!") when :linux execute_command!("sudo apt-get -y upgrade mysql-server mysql-client libmysqlclient-dev") say_ok(" Upgrade complete!") else notify_package_unavailable! end else notify_package_missing! end end