diff options
-rw-r--r-- | railties/CHANGELOG | 3 | ||||
-rw-r--r-- | railties/configs/database.yml | 6 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/app_generator.rb | 7 |
3 files changed, 12 insertions, 4 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index e5f84eb85d..14ce0f1c58 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,8 @@ *SVN* +* The rails command tries to deduce your MySQL socket by running `mysql_config +--socket`. If it fails, default to /path/to/your/mysql.sock + * Made the rails command use the application name for database names in the tailored database.yml file. Example: "rails ~/projects/blog" will use "blog_development" instead of "rails_development". [Florian Weber] * Added Rails framework freezing tasks: freeze_gems (freeze to current gems), freeze_edge (freeze to Rails SVN trunk), unfreeze_rails (float with newest gems on system) diff --git a/railties/configs/database.yml b/railties/configs/database.yml index b72fd61bc7..ffa8d11b4b 100644 --- a/railties/configs/database.yml +++ b/railties/configs/database.yml @@ -1,7 +1,7 @@ development: adapter: mysql database: <%= app_name %>_development - host: localhost + socket: <%= socket %> username: root password: # With the MySQL adapter on localhost, it defaults to /tmp/mysql.sock @@ -13,13 +13,13 @@ development: test: adapter: mysql database: <%= app_name %>_test - host: localhost + socket: <%= socket %> username: root password: production: adapter: mysql database: <%= app_name %>_production - host: localhost + socket: <%= socket %> username: root password: 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 f21d2fb6d7..f15fd3754e 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -11,6 +11,8 @@ class AppGenerator < Rails::Generator::Base super usage if args.empty? @destination_root = args.shift + @socket = `mysql_config --socket`.strip + @socket = '/path/to/your/mysql.sock' if @socket.blank? end def manifest @@ -32,7 +34,10 @@ class AppGenerator < Rails::Generator::Base m.template "helpers/test_helper.rb", "test/test_helper.rb" # database.yml and .htaccess - m.template "configs/database.yml", "config/database.yml", :assigns => { :app_name => File.basename(File.expand_path(@destination_root)) } + m.template "configs/database.yml", "config/database.yml", :assigns => { + :app_name => File.basename(File.expand_path(@destination_root)), + :socket => @socket + } m.template "configs/routes.rb", "config/routes.rb" m.template "configs/apache.conf", "public/.htaccess" |