Class: MySQL

Inherits:
SphinxModule show all
Defined in:
lib/modules/mysql.rb

Instance Method Summary collapse

Methods inherited from SphinxModule

#initialize, #load_configuration, #save_configuration, #setup, #uninstall, #update

Constructor Details

This class inherits a constructor from SphinxModule

Instance Method Details

#check(quiet = false) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/modules/mysql.rb', line 2

def check(quiet = false)
  result = true
  unless mysql_installed?
    result = false
    puts "The MySQL server doesn't appear to be installed.'".red unless quiet
  end
  unless File.exists? "/etc/paths.d/mysql"
    result = false
    puts "MySQL paths.d file is not configured.".red unless quiet
  end
  unless File.exists? "/usr/lib/libmysqlclient.18.dylib"
    result = false
    puts "MySQL does not have a symbolic link set up for the libmysqlclient dynlib.".red unless quiet
  end
  unless File.exists? "/var/mysql/mysql.sock"
    result = false
    puts "MySQL socket does not exist.".red unless quiet
  end

  puts "MySQL is OK.".green if result
  result
end

#configureObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/modules/mysql.rb', line 25

def configure
  unless mysql_installed?
    puts "\nOnce you have MySQL installed, you may return to this menu to setup root access\n"
  end
  exit = false
  until exit do
    choose do |menu|
      menu.header = "\nMySQL Configuration".cyan
      menu.prompt = "Select an option: "
      if mysql_installed?
        menu.choice("Setup root access") { set_mysql_root_access }
      end
      menu.choice("Done") {
        exit = true
      }
    end
  end
end

#downloadObject



44
45
46
47
48
49
# File 'lib/modules/mysql.rb', line 44

def download
  url = "http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.29-osx10.6-x86_64.dmg"
  puts "Downloading MySQL".cyan
  puts url
  result = Download.url(url, SphinxTv::download_path("mysql.dmg"))
end

#installObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/modules/mysql.rb', line 51

def install
  puts "Installing MySQL".cyan
  unless check(true)
    download
    Download.mount(SphinxTv::download_path("mysql.dmg"), "mysql*") do |volume|
      self.install_mysql_server volume
      self.install_mysql_prefpane volume
      self.install_mysql_startup volume
    end
  else
    puts "MySQL is installed.".green
  end
end