vagrant-wordpress/cookbooks/mysql/libraries/database.rb

20 lines
342 B
Ruby
Raw Normal View History

2011-06-12 21:15:48 +00:00
begin
require 'mysql'
rescue LoadError
Chef::Log.info("Missing gem 'mysql'")
end
module Opscode
module Mysql
module Database
def db
@db ||= ::Mysql.new new_resource.host, new_resource.username, new_resource.password
end
def close
@db.close rescue nil
@db = nil
end
end
end
end