aboutsummaryrefslogtreecommitdiffstats
path: root/railties/bin/rails
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2010-02-02 15:50:56 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2010-02-02 15:50:56 -0800
commitd236827881d119fb9ad25c81ce8e7756f1966823 (patch)
treedffcd371f7060298ecbce80b95e0596a564c6404 /railties/bin/rails
parent144f41ed9bf9d32f902531da0d3cf2a12d3a6b2b (diff)
downloadrails-d236827881d119fb9ad25c81ce8e7756f1966823.tar.gz
rails-d236827881d119fb9ad25c81ce8e7756f1966823.tar.bz2
rails-d236827881d119fb9ad25c81ce8e7756f1966823.zip
Removed all the default commands in script/* and replaced them with script/rails and a rails command that'll act the same when run from within the app [DHH]
Diffstat (limited to 'railties/bin/rails')
-rwxr-xr-xrailties/bin/rails47
1 files changed, 25 insertions, 22 deletions
diff --git a/railties/bin/rails b/railties/bin/rails
index afcd9fd0be..44842e2234 100755
--- a/railties/bin/rails
+++ b/railties/bin/rails
@@ -1,27 +1,30 @@
-begin
- require 'rails/ruby_version_check'
-rescue LoadError
- # If people are not using gems, the load path must still
- # be correct.
- # TODO: Remove the begin / rescue block somehow
- $:.unshift File.expand_path('../../lib', __FILE__)
- $:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
- $:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
- require 'rails/ruby_version_check'
-end
+if File.exists?(Dir.getwd + '/script/rails')
+ exec(Dir.getwd + '/script/rails', *ARGV)
+else
+ begin
+ require 'rails/ruby_version_check'
+ rescue LoadError
+ # If people are not using gems, the load path must still
+ # be correct.
+ # TODO: Remove the begin / rescue block somehow
+ $:.unshift File.expand_path('../../lib', __FILE__)
+ $:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
+ $:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
+ require 'rails/ruby_version_check'
+ end
-Signal.trap("INT") { puts; exit }
+ Signal.trap("INT") { puts; exit }
-require 'rails/version'
-if %w(--version -v).include? ARGV.first
- puts "Rails #{Rails::VERSION::STRING}"
- exit(0)
-end
+ require 'rails/version'
+ if %w(--version -v).include? ARGV.first
+ puts "Rails #{Rails::VERSION::STRING}"
+ exit(0)
+ end
-ARGV << "--help" if ARGV.empty?
+ ARGV << "--help" if ARGV.empty?
+ require 'rails/generators'
+ require 'generators/rails/app/app_generator'
-require 'rails/generators'
-require 'generators/rails/app/app_generator'
-
-Rails::Generators::AppGenerator.start
+ Rails::Generators::AppGenerator.start
+end \ No newline at end of file