mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
attempt to fix #2500
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2669 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
11cb22f0e6
commit
9601f96a70
2 changed files with 7 additions and 4 deletions
|
@ -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,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
|
||||
|
|
Loading…
Reference in a new issue