aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator/generators/applications/app/app_generator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails_generator/generators/applications/app/app_generator.rb')
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb7
1 files changed, 6 insertions, 1 deletions
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"