Permalink
Browse files

attempt to fix #2500

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2669 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 11cb22f commit 9601f96a70445e45428bb14ca069ccbca7a9c113 @NZKoz NZKoz committed Oct 17, 2005
@@ -4,8 +4,6 @@ development:
<%= "socket: #{socket}" if socket %>
username: root
password:
- # With the MySQL adapter on localhost, it defaults to /tmp/mysql.sock
- # socket: /var/run/mysqld/mysqld.sock
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
@@ -3,15 +3,15 @@
class AppGenerator < Rails::Generator::Base
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
Config::CONFIG['ruby_install_name'])
-
+
default_options :gem => true, :shebang => DEFAULT_SHEBANG
mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
def initialize(runtime_args, runtime_options = {})
super
usage if args.empty?
@destination_root = args.shift
- @socket = `mysql_config --socket`.strip rescue nil
+ @socket = MYSQL_SOCKET_LOCATIONS.find {|f| File.exists?(f) }
@socket = '/path/to/your/mysql.sock' if @socket.blank?
end
@@ -128,4 +128,9 @@ def add_options!(opt)
vendor
vendor/plugins
)
+
+ MYSQL_SOCKET_LOCATIONS = [ "/tmp/mysql.sock", #default
+ "/var/run/mysqld/mysqld.sock", #debian
+ "/var/tmp/mysql.sock", # freebsd
+ "/var/lib/mysql/mysql.sock" ] #fedora
end

0 comments on commit 9601f96

Please sign in to comment.