prefer do-end for multiline block

This commit is contained in:
Gosha Arinich 2013-01-06 01:57:03 +03:00
parent 2516a1d5c8
commit 732d3507da
3 changed files with 6 additions and 6 deletions

@ -232,13 +232,13 @@ when 'server'
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru")) Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
require 'rails/commands/server' require 'rails/commands/server'
Rails::Server.new.tap { |server| Rails::Server.new.tap do |server|
# We need to require application after the server sets environment, # We need to require application after the server sets environment,
# otherwise the --environment option given to the server won't propagate. # otherwise the --environment option given to the server won't propagate.
require APP_PATH require APP_PATH
Dir.chdir(Rails.application.root) Dir.chdir(Rails.application.root)
server.start server.start
} end
``` ```
This file will change into the root of the directory (a path two directories back from `APP_PATH` which points at `config/application.rb`), but only if the `config.ru` file isn't found. This then requires `rails/commands/server` which sets up the `Rails::Server` class. This file will change into the root of the directory (a path two directories back from `APP_PATH` which points at `config/application.rb`), but only if the `config.ru` file isn't found. This then requires `rails/commands/server` which sets up the `Rails::Server` class.

@ -37,11 +37,11 @@ Rails on Rack
Here's how `rails server` creates an instance of `Rack::Server` Here's how `rails server` creates an instance of `Rack::Server`
```ruby ```ruby
Rails::Server.new.tap { |server| Rails::Server.new.tap do |server|
require APP_PATH require APP_PATH
Dir.chdir(Rails.application.root) Dir.chdir(Rails.application.root)
server.start server.start
} end
``` ```
The `Rails::Server` inherits from `Rack::Server` and calls the `Rack::Server#start` method this way: The `Rails::Server` inherits from `Rack::Server` and calls the `Rack::Server#start` method this way:

@ -77,13 +77,13 @@
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru")) Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
require 'rails/commands/server' require 'rails/commands/server'
Rails::Server.new.tap { |server| Rails::Server.new.tap do |server|
# We need to require application after the server sets environment, # We need to require application after the server sets environment,
# otherwise the --environment option given to the server won't propagate. # otherwise the --environment option given to the server won't propagate.
require APP_PATH require APP_PATH
Dir.chdir(Rails.application.root) Dir.chdir(Rails.application.root)
server.start server.start
} end
when 'dbconsole' when 'dbconsole'
require 'rails/commands/dbconsole' require 'rails/commands/dbconsole'