aboutsummaryrefslogtreecommitdiffstats
path: root/railties/Rakefile
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-01 18:10:10 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-01 18:10:10 +0000
commit07989b64f47112d7e501e2114284dec322ac2c6c (patch)
treee419c95024b08be09b1ad5f15889d674710d88c4 /railties/Rakefile
parentcab24945634bc22b0c0c5d10b72c83eaa09f1e41 (diff)
downloadrails-07989b64f47112d7e501e2114284dec322ac2c6c.tar.gz
rails-07989b64f47112d7e501e2114284dec322ac2c6c.tar.bz2
rails-07989b64f47112d7e501e2114284dec322ac2c6c.zip
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
Diffstat (limited to 'railties/Rakefile')
-rw-r--r--railties/Rakefile29
1 files changed, 21 insertions, 8 deletions
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 ------------------------------------------------------------------