Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 9601f96a70445e45428bb14ca069ccbca7a9c113 1 parent 11cb22f
@NZKoz NZKoz authored
View
2  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'.
View
9 railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -3,7 +3,7 @@
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 @@ 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
Please sign in to comment.
Something went wrong with that request. Please try again.