| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- We need to pass the restart command to Puma so that it will use it
while restarting the server.
- Also made sure that all the options passed by user while starting
the server are used in the generated restart command so that they will
be used while restarting the server.
- Besides that we need to remove the server.pid file for the previous running
server because otherwise Rack complains about it's presence.
- We don't care if the server.pid file does not exist. We only want to delete
it if it exists.
- This also requires some changes on Puma side which are being tracked
here - https://github.com/puma/puma/pull/936.
- Fixes #23910.
|
|
|
|
|
|
|
| |
The default is that's false, caching even if you do not specify the caching option is determined not to use,
and `tmp/caching-dev.txt` will be deleted.
If it is this, regardless of whether or not there is `tmp/caching-dev.txt`, be sure to order would be necessary to specify the caching option,
I think that in than good to so as not to do anything by default.
|
|
|
|
|
| |
Lets have the server and the Rake task go through the same ropes, so we can
share all the file lookup, adding, and deleting code.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix bug (#22811) that occurs when rails server is started in daemon mode
and optional path to the `server.pid` file is omitted. Store default path
in a constant instead of evaluating it multiple time using `File.expand_path`.
The bug in detail: The server startup procedure crashes, since it tries to
open a file at `/tmp/pids/server.pid` instead of
`<path to project>/tmp/pids/server.pid`. This bug was introduced in 51211a94bd
when Rack was upgraded from version 1.x to 2.x. Since version 2.x,
Rack does not memoize the options hash [1], and as a consequence
`Rails::Server#default_options` will be evaluated multiple times.
The hash returned by `Rails::Server#default_options` holds the default path
to the `server.pid` file. The path is generated with the method
`File.expand_path`. However, the return value of this method depends on the
current working directory [2], which changes once `Process.daemon` is invoked
by `Rack::Server#daemonize_app` and the process is detached from the current
shell.
Close #22811
[1]https://git.io/vzen2
[2]http://ruby-doc.org/core-2.1.5/File.html#method-c-expand_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When `rails console` or `rails server` are used along with a logger set to output to `STDOUT` then the contents will show up twice. This happens because the logger is extended with `ActiveSupportLogger.broadcast` with a destination of STDOUT even if it is already outputting to `STDOUT`.
Previously PR #22592 attempted to fix this issue, but it ended up causing NoMethodErrors. A better approach than relying on adding a method and flow control is to inspect the log destination directly. For this `ActiveSupport::Logger.logger_outputs_to?` was introduced
```ruby
logger = Logger.new(STDOUT)
ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
# => true
```
To accomplish this we must look inside of an instance variable of standard lib's Logger `@logdev`. There is a related Ruby proposal to expose this method in a standard way: https://bugs.ruby-lang.org/issues/11955
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Taken from @Sonopa's commits on PR #19091.
Add support for dev caching via "rails s" flags.
Implement suggestions from @kaspth.
Remove temporary cache file if server does not have flags.
Break at 80 characters in railties/CHANGELOG.md
Remove ability to disable cache based on server options.
Add more comprehensive options: --dev-caching / --no-dev-caching
|
|
|
|
| |
constant loading should be thread safe now, so lets remove this
|
|
|
|
| |
Fixes #20345.
|
|
|
|
|
| |
ContentLength is not part of the rack SPEC since rack/rack@86ddc7a6ec68d7b6951c2dbd07947c4254e8bc0d
If you want it, just add it as a middleware in your config.
|
|
|
|
|
|
|
| |
Preserving RACK_ENV behavior.
This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing
changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
|
| |
|
|
|
|
|
|
|
| |
With refactors to Rails::Sever from v3 to v4, this method is no longer used and is untested.
Previous usage: https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/commands/server.rb#L79
Currently set from: https://github.com/rails/rails/blob/7b75551a1a4539876f878f37a2439cd02f89d961/railties/lib/rails/application/configuration.rb#L69
|
|
|
|
|
| |
bebugger doesn't work with Ruby 2.2 so we don't need to support it
anymore
|
|
|
|
|
|
|
|
|
|
| |
Commit 1aea470 introduced this directory but this was at a time when the
default way to store sessions was on the file system under the tmp
directory.
Let's remove references to it from the documentation as well.
[Robin Dupret & yui-knk]
|
|
|
|
| |
Fixes #16578
|
|
|
| |
Per feedback in https://github.com/rails/rails/commit/af63e4a2546629c3fb2d53cffb7d4ea0e8663f68#commitcomment-7477636
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change it will be possible to add additional options to the `option_parser` like this:
require 'rails/commands/server'
module Rails
class Server < ::Rack::Server
class Options
def option_parser_with_open(options)
parser = option_parser_without_open options
parser.on('-o', '--open', 'Open in default browser') { options[:open] = true }
parser
end
alias_method_chain :option_parser, :open
end
def start_with_open
start_without_open do
`open http://localhost:3000` if options[:open]
end
end
alias_method_chain :start, :open
end
end
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Right now when you start a server via `rails s`, the logger gets extended so that it logs to the file system and also to stdout. This extension behavior is not "intelligent" and if the default logger is already set to output to stdout, then the contents will be received twice.
To capture logs in accordance with http://www.12factor.net/logs some platforms require the logs to be sent to standard out. If a logger is set to stdout, and the server is started using `rails server` instead of another method (i.e. `thin start` etc.) then the app will produce double logs.
This PR fixes the issue by only extending the logger to standard out in the development environment. So that in production you don't get double logs like this:
```
ActionView::Template::Error (wrong number of arguments (5 for 4)):
1: <% lang_index = 0 %>
2: <div class="row">
3: <ul class="nav nav-tabs nav-stacked span2" data-tabs="tabs" id="repo-tabs">
4: <% repos.group_by(&:language).each do |lang, repos| %>
5: <% unless lang == nil %>
6: <li><a href="#<%= "#{lang.parameterize}#{lang.hash}" %>" data-toggle="tab"><%= lang %></a></li>
7: <% end -%>
app/views/shared/_repos.html.erb:4:in `_app_views_shared__repos_html_erb___1685450633638247395_70300668607000'
app/views/pages/index.html.erb:13:in `_app_views_pages_index_html_erb__2084723628308867770_70300687584880'
ActionView::Template::Error (wrong number of arguments (5 for 4)):
1: <% lang_index = 0 %>
2: <div class="row">
3: <ul class="nav nav-tabs nav-stacked span2" data-tabs="tabs" id="repo-tabs">
4: <% repos.group_by(&:language).each do |lang, repos| %>
5: <% unless lang == nil %>
6: <li><a href="#<%= "#{lang.parameterize}#{lang.hash}" %>" data-toggle="tab"><%= lang %></a></li>
7: <% end -%>
app/views/shared/_repos.html.erb:4:in `_app_views_shared__repos_html_erb___1685450633638247395_70300668607000'
app/views/pages/index.html.erb:13:in `_app_views_pages_index_html_erb__2084723628308867770_70300687584880'
```
ATP Railties. Opened against master in favor of #10999
|
| |
|
|
|
|
| |
v2 of pull request based on feedback from @rafaelfranca, @schneems, and @carlosantoniodasilva
|
|
|
|
|
|
|
|
|
|
| |
We used to pass the Rails::Application subclass to #run.
The Rails server then called #to_app to convert that class to the
actual Rack application.
if you surround `#run` with a call to `#map` the server no longer
convertes the class to the instance and we end up with unnecessary
delegation calls on every request.
|
|
|
|
| |
Cache the value of "super" in a variable and use it instead.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
When launching rails server from the command line with a rails environment specified such as `rails server RAILS_ENV=production` an error would occur since rails will try to use `RAILS_ENV=production` as it's server.
When launching rails with a specified server such as thin `rails server thin RAILS_ENV=production` no error will be thrown, but rails will not start up in the specified environment.
This fixes both of those cases
|
|
|
|
| |
production so that PID and timestamp are logged. fixes #5388
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
application's URL
|
| |
|