aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorSenthil A <senthil196@gmail.com>2012-03-24 06:06:50 -0700
committerSenthil A <senthil196@gmail.com>2012-03-24 06:06:56 -0700
commit7feec40b89ada892ca6f107ada27ceedde505d83 (patch)
tree7d7f7bbe029b30d789ac7e552f7f6e3ff93bf1ad /guides
parent014498e1d74decd57d44d45c187fa4f4b968b811 (diff)
downloadrails-7feec40b89ada892ca6f107ada27ceedde505d83.tar.gz
rails-7feec40b89ada892ca6f107ada27ceedde505d83.tar.bz2
rails-7feec40b89ada892ca6f107ada27ceedde505d83.zip
[ci skip] updated bin/rails code in Rails Initialization Process guide
Diffstat (limited to 'guides')
-rw-r--r--guides/source/initialization.textile22
1 files changed, 16 insertions, 6 deletions
diff --git a/guides/source/initialization.textile b/guides/source/initialization.textile
index 69e5c1edcc..b5e427b35c 100644
--- a/guides/source/initialization.textile
+++ b/guides/source/initialization.textile
@@ -21,14 +21,24 @@ The actual +rails+ command is kept in _bin/rails_:
<ruby>
#!/usr/bin/env ruby
+#
+# This file was generated by RubyGems.
+#
+# The application 'railties' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
-begin
- require "rails/cli"
-rescue LoadError
- railties_path = File.expand_path('../../railties/lib', __FILE__)
- $:.unshift(railties_path)
- require "rails/cli"
+require 'rubygems'
+
+version = ">= 0"
+
+if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
+ version = $1
+ ARGV.shift
end
+
+gem 'railties', version
+load Gem.bin_path('railties', 'rails', version)
</ruby>
This file will attempt to load +rails/cli+. If it cannot find it then +railties/lib+ is added to the load path (+$:+) before retrying.