Sha256: 34e65033c1e99ac44a4c26b92749dce4fbf14467d7e93a1348fb26e761776b51

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

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

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}
    chmod 0644 #{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.12 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.11 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.10 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.9 cookbooks/mysql/recipes/default.rb
flombe-0.1.0.8 cookbooks/mysql/recipes/default.rb