Rails's script/server
is just a few lines:
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/server'
I wonder where the server
file is? I tried a
find . -name 'server.*'
find . -name 'server'
but c开发者_如何学Pythonan't find it
You have to look for the files in your related gem repo. Your Ruby is located at
which ruby
Your Rails gem is
bundle show rails
You can go to the dir with
cd `bundle show rails`/lib/commands
Then, open server.rb
thanks. in the case of a Mac, I found that they are on
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/server.rb
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb
/Users/peter/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb
the following are there but doesn't have my Rails 2.3.5 version:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/server.rb
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb
Update: Now the question is: which of the above 3 is the one? How can you tell easily?
In linux they are more likely to be under
/usr/lib/ruby/gems/ruby_version/gems/rails_version/lib/commands
ruby_version and rails_version depends on which versions you are using. The directory structure will also depend on whether or not you are using rvm, but hopefully you can find your way once you get to the /usr/lib/ruby/
directory
精彩评论