mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added automated rewriting of the shebang lines on installs through the gem rails command #379 [Manfred Stienstra]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@300 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
cab2494563
commit
07989b64f4
2 changed files with 27 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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 ------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue