Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: f05e81af49
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (35 sloc) 1.316 kB
dep 'mysql.gem' do
requires 'mysql.managed'
installs 'mysql'
provides []
end
dep 'mysql access' do
requires 'existing mysql db'
define_var :db_user, :default => :username
define_var :db_host, :default => 'localhost'
met? { mysql "use #{var(:db_name)}", var(:db_user) }
meet { mysql %Q{GRANT ALL PRIVILEGES ON #{var :db_name}.* TO '#{var :db_user}'@'#{var :db_host}' IDENTIFIED BY '#{var :db_password}'} }
end
dep 'existing mysql db' do
requires 'mysql configured'
met? { mysql("SHOW DATABASES").split("\n")[1..-1].any? {|l| /\b#{var :db_name}\b/ =~ l } }
meet { mysql "CREATE DATABASE #{var :db_name}" }
end
dep 'mysql configured' do
requires 'mysql root password'
end
dep 'mysql root password' do
requires 'mysql.managed'
met? { failable_shell("echo '\q' | mysql -u root").stderr["Access denied for user 'root'@'localhost' (using password: NO)"] }
meet { mysql(%Q{GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '#{var :db_admin_password}'}, 'root', false) }
end
dep 'mysql.managed' do
installs {
via :apt, %w[mysql-server libmysqlclient16-dev]
via :macports, 'mysql5-server'
}
provides 'mysql'
after :on => :osx do
sudo "ln -s #{Babushka::MacportsHelper.prefix / 'lib/mysql5/bin/mysql*'} #{Babushka::MacportsHelper.prefix / 'bin/'}"
end
end
Jump to Line
Something went wrong with that request. Please try again.