diff options
-rw-r--r-- | railties/CHANGELOG | 10 | ||||
-rw-r--r-- | railties/Rakefile | 29 |
2 files changed, 27 insertions, 12 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index ada723b0fa..35477eed8f 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,20 +1,22 @@ *SVN* +* Added automated rewriting of the shebang lines on installs through the gem rails command #379 [Manfred Stienstra] + * Fixed that generated action_mailers doesnt need to require the action_mailer since thats already done in the environment #382 [Lucas Carlson] * Fixed dependency management to happen in a unified fashion for Active Record and Action Pack using the new Dependencies module. This means that the environment options needs to change from: Before in development.rb: - ActionController::Base.reload_dependencies = true - ActiveRecord::Base.reload_associations = true + ActionController::Base.reload_dependencies = true  + ActiveRecord::Base.reload_associations   = true Now in development.rb: Dependencies.mechanism = :load Before in production.rb and test.rb: - ActionController::Base.reload_dependencies = false - ActiveRecord::Base.reload_associations = false + ActionController::Base.reload_dependencies = false + ActiveRecord::Base.reload_associations   = false Now in production.rb and test.rb: Dependencies.mechanism = :require diff --git a/railties/Rakefile b/railties/Rakefile index 150bc6246e..21cc910b09 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -5,7 +5,7 @@ require 'rake/gempackagetask' require 'rake/contrib/rubyforgepublisher' require 'date' - +require 'rbconfig' PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' PKG_NAME = 'rails' @@ -100,17 +100,14 @@ task :copy_ties_content => [ :copy_app_doc_readme ] task :copy_dispatches do - cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb" + copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb") chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb" - cp "dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi" + copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi") chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi" - cp "dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi" + copy_with_rewritten_ruby_path("dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi") chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi" - - cp "bin/console", "#{PKG_DESTINATION}/script/console" - chmod 0755, "#{PKG_DESTINATION}/script/console" end task :copy_html_files do @@ -145,7 +142,7 @@ end task :copy_binfiles do BIN_FILES.each do |file| dest_file = File.join(PKG_DESTINATION, 'script', file) - cp File.join('bin', file), dest_file + copy_with_rewritten_ruby_path(File.join('bin', file), dest_file) chmod 0755, dest_file end end @@ -174,6 +171,22 @@ task :link_apache_config do } end +def copy_with_rewritten_ruby_path(src_file, dest_file) + ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + + File.open(dest_file, 'w') do |df| + File.open(src_file) do |sf| + line = sf.gets + if (line =~ /#!.+ruby\s*/) != nil + df.puts("#!#{ruby}") + else + df.puts(line) + end + df.write(sf.read) + end + end +end + # Generate documentation ------------------------------------------------------------------ |