Sha256: 7832c3ee61a2ee84bdd1579501995d99108462a03e8902b22bf113e26e97a268

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

#
# Cookbook Name:: mysql
# Recipe:: default
#

require_recipe 'homebrew'

homebrew 'mysql'

execute "initialize MySQL database" do
  command <<-EOS
    unset TMPDIR
    mysql_install_db --user=#{ENV['USER']} --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  EOS
  not_if "test -d /usr/local/var/mysql/mysql"
end

gem_package "mysql" do
  action :install
end

Chef::Log.info("Configuring mysql to automatically start on login")

destination_plist = "#{ENV['HOME']}/Library/LaunchAgents/com.mysql.mysqld.plist"
plist_path = "$(brew --prefix mysql)/com.mysql.mysqld.plist"

execute "unloading existing plist" do
  command "launchctl unload -w -F #{destination_plist}"
  only_if "test -f #{destination_plist}"
end

execute "adding plist to login" do
  command <<-EOS
    mkdir -p #{ENV['HOME']}/Library/LaunchAgents
    cp -f #{plist_path} #{destination_plist}
    launchctl load -w -F #{destination_plist}
  EOS
end

execute "sleeping to wait for mysql to come online" do
  command "sleep 5"
  not_if "mysqladmin -uroot status"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flombe-0.1.0.6 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.5 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.4 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.3 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.2 cookbooks/mysql/recipes/default.rb