diff options
author | Felipe Rodrigues <felipero@gmail.com> | 2010-04-12 23:38:43 -0300 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-12 19:56:38 -0700 |
commit | a64bfc3c8e2a62b39f3cf8497c2a5a82272bd27a (patch) | |
tree | ef99ef08d35b66530562d9b817890056e0cf8793 /railties/lib | |
parent | 3c456a869abeb0a639518180214db5ead428aedf (diff) | |
download | rails-a64bfc3c8e2a62b39f3cf8497c2a5a82272bd27a.tar.gz rails-a64bfc3c8e2a62b39f3cf8497c2a5a82272bd27a.tar.bz2 rails-a64bfc3c8e2a62b39f3cf8497c2a5a82272bd27a.zip |
moved rails binary to rails gem, so rubygems can find specific versions of rails [#4382 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/cli.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/lib/rails/cli.rb b/railties/lib/rails/cli.rb new file mode 100644 index 0000000000..173f122445 --- /dev/null +++ b/railties/lib/rails/cli.rb @@ -0,0 +1,30 @@ +require 'rbconfig' + +module Rails + module ScriptRailsLoader + RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"] + SCRIPT_RAILS = File.join('script', 'rails') + + def self.exec_script_rails! + cwd = Dir.pwd + exec RUBY, SCRIPT_RAILS, *ARGV if File.exists?(SCRIPT_RAILS) + Dir.chdir("..") do + # Recurse in a chdir block: if the search fails we want to be sure + # the application is generated in the original working directory. + exec_script_rails! unless cwd == Dir.pwd + end + rescue SystemCallError + # could not chdir, no problem just return + end + end +end + +Rails::ScriptRailsLoader.exec_script_rails! + +railties_path = File.expand_path('../../lib', __FILE__) +$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path) + +require 'rails/ruby_version_check' +Signal.trap("INT") { puts; exit } + +require 'rails/commands/application' |