Skip to content
This repository
Browse code

script/server should init Rails by loading config.ru

Fixes "Rails 3.0 doesn't fucking work"
  • Loading branch information...
commit bdf8ee44c54dec181827c02c2b74ea329bdab931 1 parent f6f416c
Joshua Peek josh authored
20 railties/lib/rails/commands/server.rb
@@ -37,15 +37,6 @@ def opt_parser
37 37 Options.new
38 38 end
39 39
40   - def self.start(app)
41   - new(app).start
42   - end
43   -
44   - def initialize(app)
45   - super() # Call Rack::Server#initialize without passing any options to use.
46   - @app = app
47   - end
48   -
49 40 def start
50 41 puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
51 42 puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}"
@@ -69,20 +60,17 @@ def middleware
69 60 end
70 61
71 62 def log_path
72   - "#{File.expand_path(@app.root)}/log/#{options[:environment]}.log"
  63 + "log/#{options[:environment]}.log"
73 64 end
74 65
75 66 def default_options
76   - {
  67 + super.merge({
77 68 :Port => 3000,
78   - :Host => "0.0.0.0",
79 69 :environment => (ENV['RAILS_ENV'] || "development").dup,
80   - :rack_file => "#{@app.root}/config.ru",
81 70 :daemonize => false,
82 71 :debugger => false,
83   - :pid => "#{@app.root}/tmp/pids/server.pid",
84   - :AccessLog => []
85   - }
  72 + :pid => "tmp/pids/server.pid"
  73 + })
86 74 end
87 75 end
88 76 end
6 railties/lib/rails/generators/rails/app/templates/script/server.tt
... ... @@ -1,3 +1,5 @@
1   -require File.expand_path('../../config/application', __FILE__)
  1 +require File.expand_path('../../config/boot', __FILE__)
2 2 require 'rails/commands/server'
3   -Rails::Server.start(<%= app_const %>.instance)
  3 +
  4 +Dir.chdir(File.expand_path('../..', __FILE__))
  5 +Rails::Server.start

0 comments on commit bdf8ee4

Please sign in to comment.
Something went wrong with that request. Please try again.