| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We originally did the whole `load_database_yaml` thing because this test
wasn't cooperating and we needed to finish the namespaced rake tasks for
multiple databases.
However, it turns out that YAML can't eval ERB if you don't tell it it's
ERB so you get Pysch parse errors if you're using multi-line ERB or
ERB with conditionals. It's a hot mess.
After trying a few things and thinking it over we decided that it wasn't
worth bandaiding over, the test needed to be improved. The test was
added in #31135 to test that the env is loaded in these tasks. But it
was blowing up because we were trying to read a database name out of the
configuration - however that's not the purpose of this change. We want
to read environment files in the rake tasks, but not in the config
file.
In this PR we changed the test to test what the PR was actually fixing.
We've also deleted the `load_database_yaml` because it caused more
problems than it was worth. This should fix the issues described in
https://github.com/rails/rails/pull/32274#issuecomment-384161057. We
also had these problems at GitHub.
Co-authored-by: alimi <aibrahim2k2@gmail.com>
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In the system test template, enter a value based on label.
However, since `label` method does not use `titleize` by default.
If generate a value including underscore, cannot find a label and the test
will fail.
```
$ ./bin/rails g scaffold user name:string phone_number:string
$ ./bin/rails t test/system/users_test.rb
E
Error:
UsersTest#test_creating_a_User:
Capybara::ElementNotFound: Unable to find field "Phone Number"
test/system/users_test.rb:18:in `block in <class:UsersTest>'
```
This removes unnecessary `titleize` so that the generated file will pass
even if the attribute contains an underscore.
|
|\ \ \
| | | |
| | | | |
Follow up #33659
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | | |
Use `say`/`error` instead of `puts`/`$stderr.puts`
|
| | | |
| | | |
| | | |
| | | | |
Follow up 44007c07098a3c633180881cae9285da4622e63f
|
|\ \ \ \
| | | | |
| | | | | |
Fix `rails initializers --help` and `rails dev:cache --help`
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
- `rails initializers --help` should show description set by `desc`
See railties/lib/rails/command/base.rb:27
- Fix `rails dev:cache --help`
```
Traceback (most recent call last):
10: from bin/rails:4:in `<main>'
9: from bin/rails:4:in `require'
8: from /work/rails/railties/lib/rails/commands.rb:18:in `<top (required)>'
7: from /work/rails/railties/lib/rails/command.rb:46:in `invoke'
6: from /work/rails/railties/lib/rails/command/base.rb:65:in `perform'
5: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
4: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
3: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
2: from /work/rails/railties/lib/rails/command/base.rb:150:in `help'
1: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:170:in `command_help'
/home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/base.rb:497:in `handle_no_command_error': Could not find command "dev". (Thor::UndefinedCommandError)
```
Context https://github.com/rails/rails/pull/33694#issuecomment-415127304
Would be great to set a description to other commands.
|
|/ / /
| | |
| | |
| | | |
Context https://github.com/rails/rails/pull/33631#discussion_r210732565
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`rake routes` was a public task. Therefore, I think that we should deprecate
it before deleting it.
Related to #32121.
|
| | |
| | |
| | |
| | | |
Commands generally prefer say to puts.
|
|\ \ \
| | | |
| | | | |
Move the initializers rake task to Rails::Command
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* Invoke Rails::Command within the rake task
* Adds test for calling initializers with 'bin/rake'
* Adds deprecation warning to the rake task
|
| | | | |
|
|/ / /
| | |
| | |
| | | |
To prevent style check in review like https://github.com/rails/rails/pull/33608#discussion_r211087605.
|
| | | |
|
|\ \ \
| | | |
| | | | |
use BacktraceCleaner for ActiveRecord verbose logging
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Move `dev:cache` rake task to use Rails::Command
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* Call the Rails::Command::DevCommand in the rake task for dev:cache
* Add deprecation for using `bin/rake` in favor of `bin/rails`
|
| |/ / / |
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Purpose metadata prevents cookie values from being
copy-pasted and ensures that the cookie is used only
for its originally intended purpose.
The Purpose and Expiry metadata are embedded inside signed/encrypted
cookies and will not be readable on previous versions of Rails.
We can switch off purpose and expiry metadata embedded in
signed and encrypted cookies using
config.action_dispatch.use_cookies_with_metadata = false
if you want your cookies to be readable on older versions of Rails.
|
|\ \ \
| | | |
| | | | |
`bundle binstubs bundler` should be executed after `bundle install`
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes:
`bundle binstubs bundler` doesn't generate `bin/bundle` for newly
generated Rails app.
```
...
(snip)
run bundle binstubs bundler
The git source https://github.com/rails/web-console.git is not yet checked out.
Please run `bundle install` before trying to start your application
run bundle install
Fetching https://github.com/rails/web-console.git
(snip)
...
```
Related to #33202
|
|/ / / |
|
|\ \ \
| | | |
| | | | |
Bundler binstubs
|
| | | | |
|
| | | | |
|
| |/ /
|/| |
| | |
| | | |
ActionView::Template method names
|
| |/
|/|
| |
| | |
[Atul Bhosale, Victor Nawothnig]
|
| |
| |
| |
| |
| | |
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
|
|\ \
| | |
| | | |
Turn on performance based cops
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Use attr_reader/attr_writer instead of methods
method is 12% slower
Use flat_map over map.flatten(1)
flatten is 66% slower
Use hash[]= instead of hash.merge! with single arguments
merge! is 166% slower
See https://github.com/rails/rails/pull/32337 for more conversation
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
|
| | | |
| | | |
| | | |
| | | |
| | | | |
With this commit, rails commands usage instructions display now +rails+
instead of +bin/rails+ within their recommendations.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.
We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
|
| |/ /
|/| |
| | |
| | |
| | | |
http links will be redirected to the https version, but still better to
just directly link to the https version.
|
|\ \ \
| | | |
| | | | |
Separate min and max threads count environment variable for puma configuration
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Same environment variable RAILS_MAX_THREADS was being used
for setting the minimum and maximum thread count for puma.
This change makes it obvious and easy to decide which
environment variable to change for setting the min or max.
Don't feel like this is a breaking change as the same
default is maintained.
|
| | | |
| | | |
| | | |
| | | | |
Also, added a test that a deprecated message will be output.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We sometimes ask "✂️ extra blank lines" to a contributor in reviews like
https://github.com/rails/rails/pull/33337#discussion_r201509738.
It is preferable to deal automatically without depending on manpower.
|
|\ \ \ \
| | | | |
| | | | | |
rails server: Allow to explicitly specify whether to output Rails's log to stdout
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Before Rails' logger output is mirrored to std out if:
* environment is development and
* the process is not daemonized
It was not possible to change that behaviour, e.g. to disable log output
in that case or enable it in other cases.
Now you can explicitly disable or enable output with the new command
line switch `--log-to-stdout`, regardless of any other circumstances.
```
// enable output in production
rails server -e production --log-to-stdout
// disable output in development
rails server -e development --no-log-to-stdout
```
Enabling output when daemonized still makes no sense (since tty is
detached), but this is ignored for now.
If the command line flag is not specified, old behaviour still
applies, so this change is completely backward compatible.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We prefer double quotes over single quotes.
Fixes:
```
railties/lib/rails/commands/server/server_command.rb:279:39:
C: Style/StringLiterals: Prefer double-quoted strings unless you need
single quotes to avoi d extra backslashes for escaping.
original_options.concat [ '-u', using ]
```
Related to 161ed37d7120e1f391eed19e49a3390e53e4fe91
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Our restart_command would pass in `--restart` which means
that if the @original_options already contains --restart
it would keep getting another --restart appended.
Nothing here that would break the bank, but just a nicety.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
If booting a server via `rails s -u puma`, we'd convert the
option to a `using` positional.
When using `rails restart` our `restart_command` would the
option converted to the using positional and put that in
the restart command.
Thus we'd show users deprecation warnings for our own code.
Fix that by converting a passed positional to an option instead.
Also: fix initialize method signature. The local_options are an
array, not a hash. But don't even bother assigning defaults as
Thor passes them in.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Ref:
https://github.com/rails/rails/commit/654704247eba742e139cfaa8d1385f13605d9e12
Before the commit we had a restart_command in Rails::Server. But after
there's another one in Rails::ServerCommand. The command version of the
method is the right one as it's used in server_options.
Give the leftover method the boot.
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Mixing strings and symbols seems aesthetically less than ideal.
We can also use underscores just fine. Thor converts them to dashes
for the CLI and it makes access in Ruby code nicer.
Here's the `server --help` output after this change:
```
Usage:
rails server [thin/puma/webrick] [options]
Options:
-p, [--port=port] # Runs Rails on the specified port - defaults to 3000.
-b, [--binding=IP] # Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'.
-c, [--config=file] # Uses a custom rackup configuration.
# Default: config.ru
-d, [--daemon], [--no-daemon] # Runs server as a Daemon.
-e, [--environment=name] # Specifies the environment to run this server under (development/test/production).
-u, [--using=name] # Specifies the Rack server used to run the application (thin/puma/webrick).
-P, [--pid=PID] # Specifies the PID file.
# Default: tmp/pids/server.pid
-C, [--dev-caching], [--no-dev-caching] # Specifies whether to perform caching in development.
[--early-hints], [--no-early-hints] # Enables HTTP/2 early hints.
```
See? Quite dashing ✨
|