Skip to content
This repository
Browse code

attempt to fix #2500

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

0 notes on commit 9601f96

Please sign in to comment.
Something went wrong with that request. Please try again.