aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/configs/database.yml2
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb9
2 files changed, 7 insertions, 4 deletions
diff --git a/railties/configs/database.yml b/railties/configs/database.yml
index 9e4a08ddf7..b27ef1327b 100644
--- a/railties/configs/database.yml
+++ b/railties/configs/database.yml
@@ -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'.
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index dbb76c3e85..57979804fd 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -3,7 +3,7 @@ require 'rbconfig'
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__)}/../../../../.."
@@ -11,7 +11,7 @@ class AppGenerator < Rails::Generator::Base
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 @@ class AppGenerator < Rails::Generator::Base
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