aboutsummaryrefslogtreecommitdiffstats
path: root/railties/bin/rails
blob: 44842e2234d468d23d1eb60cc31a0afdc8ba3d9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 }

  require 'rails/version'
  if %w(--version -v).include? ARGV.first
    puts "Rails #{Rails::VERSION::STRING}"
    exit(0)
  end

  ARGV << "--help" if ARGV.empty?

  require 'rails/generators'
  require 'generators/rails/app/app_generator'

  Rails::Generators::AppGenerator.start
end