Commit Graph

13750 Commits

Author SHA1 Message Date
Zachary Scott
2af458a10d
Merge pull request #42112 from roramirez/remove/alias-double-slash
Remove aliases with two letter:
2021-05-10 11:22:30 +09:00
Alex Ghiculescu
01d90fb372
Active Storage: encourage Rails.env in bucket names
https://github.com/rails/rails/issues/42186 outlined a problem I've seen in the wild before (with AS, but also with other gems like papertrail) where developers interact with production data locally and inadvertently destroy it.

A simple way to prevent this in the Active Storage case is to make the `bucket` name for services be based on `Rails.env`. This way, if you pull a production database copy and call `purge` on a blob for it, AS will try and destroy the file from the `your_own_bucket-development` bucket. But the file doesn't live there - it lives in the `your_own_bucket-production` bucket.

This is just a suggestion and people who know what they are doing can name their buckets whatever they want. But for first time Active Storage users I think this removes an unnecessarily sharp knife.
2021-05-09 20:37:51 -05:00
Rafael França
3cf6378a5b
Merge pull request #41584 from jonathanhefner/route-action-reuse-existing-namespace
Inject route with namespace into existing blocks
2021-05-06 13:44:34 -04:00
Jean Boussier
f77ec9aa67 Deduplicate the environment glob in engine paths
There is one duplicate per active engine, which
isn't that much, but the change is trivial and
that string is better frozen anyway.
2021-05-06 18:54:11 +02:00
Ashik Salman
71437f620f Updated #quote comments and removed if-else block. 2021-05-04 16:43:34 +05:30
John Bampton
6e85b6b86e Add spell checking with codespell as a GitHub Action
`codespell` works with a small custom dictionary and seems to find perhaps more spelling mistakes than `misspell` which really only fixes commonly misspelled English words.

Not all spell checkers can check all file types and most spell checkers can't find all the errors.

https://github.com/codespell-project/codespell
https://pypi.org/project/codespell/
2021-05-04 14:46:21 +10:00
Rodrigo Ramírez Norambuena
c33c985c5a Remove aliases with two letter:
There a issues is use more than one character to use as aliases
https://github.com/erikhuda/thor/blob/a5cbed8/lib/thor/base.rb#L307

So, for this change the convention is remove the two letters aliases
https://github.com/rails/rails/pull/38813
2021-05-03 23:44:04 -04:00
jean-francois labbe
4348c38b84 [ci skip] Fix broken links on RDOC_MAIN.rdoc 2021-04-30 09:22:28 +02:00
Ashik Salman
68a9d6367e Used double quotes in template file for consistency. 2021-04-30 02:58:51 +05:30
Eugene Kenny
7bd6a74e87
Merge pull request #41824 from jaredbeck/patch-7
Exit before assets:precompile task if yarn:install fails
2021-04-29 13:59:04 +01:00
Aditya Pandit
4539145ddc Fixed typo in new framework default template [ci skip] 2021-04-28 14:48:59 +05:30
Rafael Mendonça França
52db7f2ef3
Configure a default timeout for the smtp delivery method
The default is set to 5 and only applied for new applications or
applications that opt-in for this new default.

Closes #42089.

[André Luis Leal Cardoso Junior + Rafael Mendonça França]
2021-04-28 03:59:19 +00:00
Rafael Mendonça França
cbcface6c0
Document the defaults of cache_format_version
And add its new default to the new_framework_defaults_7_0 file.
2021-04-28 03:58:38 +00:00
Hartley McGuire
a3e5e8d909 use ruby 2.7's filter_map instead of select + map
Related: c3d7794, bbbc861
2021-04-26 17:55:33 -04:00
Jean Boussier
3b71f3eb68 Implement an optimized Cache::Entry coder
Active Support's cache have for long been limited because
of its format. It directly serialize its `Entry` object with
`Marshal`, so any internal change might break the format.

The current shortcommings are:

  - The minimum entry overhead is quite ridiculous:
    `Marshal.dump(ActiveSupport::Cache::Entry.new("")).bytesize # => 107`
  - Only the internal `value` is compressed, but unless it's a String, to do so
    it first need to be serialized. So we end up with `Marshal.dump(Zlib.deflate(Marshal.dump(value)))`
    which is wasteful.
2021-04-25 08:27:58 +02:00
Ryuta Kamizono
bbbc861f71 Enable Performance/MapCompact cop
Follow up to #42053.
2021-04-23 16:33:02 +09:00
Matheus Richard
c3d7794f16 Replace map + compact with filter_map 2021-04-22 22:08:34 -03:00
Jean Boussier
487ff1330c
Merge pull request #42008 from iridakos/bugs/42007-runner-file-load
Expand path of user provided file in runner
2021-04-22 20:21:29 +02:00
Gannon McGibbon
cc557db0e2 Allow loading nested locales in engines 2021-04-21 17:45:09 -04:00
Jean Boussier
3fe0ab52df Ensure Rails.application.config_for always cast hashes to ActiveSupport::OrderedOptions.
Fix: #42037
2021-04-21 17:32:42 +02:00
Lazarus Lazaridis
896733c2e3 Add tests for rails runner
* Refs #42007
2021-04-18 13:58:02 +03:00
Lazarus Lazaridis
777e5ef3e2 Expand path of user provided file in runner
If user provides a file without absolute or relative path and
the file exists in any of the directories of the $LOAD_PATH
the `Kernel.load` method will load the latter one instead of the
intended one.

Expanding the path of the file forces Kernel to load the
correct file using its absolute path.

* Fixes #42007
2021-04-18 13:45:33 +03:00
Ricardo Díaz
cbec080dc4 Allow test parallelization with processes to fail fast
Running tests in parallel with processes wasn't failing fast when the
option was enabled. The problem was that even when the reporter raised
the `Interrupt` exception, the queue was not emptied, so workers keep
processing jobs as if nothing happened.

This patch basically intercepts the `Interrupt` exception that may
come from the reporter, and tells the server to clear the jobs queue,
so that it can continue the shutdown process as usual. The exception
must then continue its journey so that the backtrace is displayed.
2021-04-16 19:23:57 -05:00
John Bampton
7260f79d7a chore: fix grammar and spelling in Markdown and Ruby files 2021-04-15 19:32:27 +10:00
Rafael Mendonça França
94b954576a
Autocorrect Rubocop roles 2021-04-13 18:32:25 +00:00
Rafael França
3541f05103
Merge pull request #41923 from jbampton/fix-spelling
chore: fix spelling in railties/test/generators
2021-04-13 11:37:07 -04:00
Jared Beck
cb0f810cd0 Exit before assets:precompile task if yarn:install fails
This `raise` was recommended by @y-yagi in https://github.com/rails/rails/pull/36852
2021-04-13 10:34:47 -04:00
Jean Boussier
3457a4676d Allow to opt-in to the new TimeWithZone.name and fix XmlMini serialization 2021-04-12 22:03:31 +02:00
Rafael França
127dd06df6
Merge pull request #41935 from SkipKayhil/deprecate-rack-runtime
Remove Rack::Runtime and deprecate referencing it
2021-04-12 15:12:20 -04:00
Rafael Mendonça França
4354e3ae49
Don't define methods using the method modifier in the same line as the method
Our style guide use block method modifiers, not inline method modifiers.
2021-04-12 18:49:54 +00:00
Hartley McGuire
7bfcf4b313 Remove Rack::Runtime and deprecate referencing it
Previous discussion: #38412, #38325, 37423e4, 24f9c03

- Rack::Runtime is replaced by FakeRuntime, which is a dummy middleware
  that just passes requests on and cannot be used in middleware operations
- Using Rack::Runtime in middleware operations (relative inserts, moves,
  etc.) throws a deprecation warning and uses FakeRuntime instead
- if an application adds Rack::Runtime explicitly (use, unshift, etc.),
  then the deprecation warning does not happen and FakeRuntime is
  ignored
- docs are updated to no longer reference Rack::Runtime
2021-04-12 14:31:12 -04:00
John Bampton
8d383382b9 chore: fix spelling in railties/test/generators 2021-04-12 09:24:57 +10:00
John Bampton
13b1d9dc35 chore: fix grammar and spelling 2021-04-12 05:30:44 +10:00
Jean Boussier
3f59640016 Stop checking if ruby2_keywords is defined 2021-04-11 13:42:02 +02:00
Jacob Herrington
568dba64ba
Fix grammar mistakes [ci skip] 2021-04-10 22:15:52 -05:00
Rafael França
c0a5e8db5e
Merge pull request #41314 from etiennebarrie/fix-rake-test-db
Fix rake test:db loading in development
2021-04-06 13:50:05 -04:00
Jonathan Hefner
ddcfde2226 Populate ARGV with Rails::Command.invoke args
Follow-up to #38495.

Similar to #40994, but for all Rails commands.  Programmatic and CLI
invocations of Rails commands will still behave identically, and `ARGV`
will still be isolated between invocations.

Reverts #40994.
2021-04-03 10:12:52 -05:00
Ricardo Díaz
1d50a37a6f Don't override ActiveSupport::TestCase.test_order
Seemingly some test suites depend on this

Updated tests to verify the change to the parallelization flag instead
2021-03-31 15:21:54 -04:00
Lee Quarella
65f350166a Remove overwriting test_order
Reverts a change from
2327ebfdc6
which can overwrite `test_order` that may have been manually set in
config. This can cause a situation where the user is depending on a
particular `test_order` but is unknowingly forced into another.
2021-03-31 11:50:08 -04:00
Rafael França
6675f6b785
Merge pull request #41255 from euxx/fix-create-migration-generator-with-pretend-option
Fix create migration generator with `--pretend` option
2021-03-29 22:27:34 -04:00
Rafael França
7702ce8243
Merge pull request #40789 from csutter/deprecate-remote-ip-single-value
Deprecate assigning single `trusted_proxies` value
2021-03-24 02:27:57 -04:00
Eileen M. Uchitelle
ad9e52066c
Merge pull request #41684 from ricardotk002/disable-parallel-testing
Disable parallel testing when running individual files
2021-03-23 09:06:57 -04:00
Rafael França
3262492bed
Merge pull request #41733 from henrik/consistent-quotes
More consistent quotes in template files
2021-03-22 18:22:21 -04:00
Henrik Nyh
c13fee85ba More consistent quotes in template files 2021-03-22 22:07:27 +00:00
Rafael França
84c9941642
Merge pull request #41080 from ankurp/standardrb-fixes
Update template files to follow the standard gem code formatter recommendations
2021-03-22 18:01:35 -04:00
Jean Boussier
8a3fcad2d2 Use ... argument forwarding instead of ruby2_keywords when possible 2021-03-19 16:53:06 +01:00
Ricardo Díaz
2327ebfdc6 Disable parallel testing when running individual files
Setting up the parallel workers could be an overhead when running
individual files.

This patch disables that process in case the number of files to run
is less than one.

Results running a sample file:

Before:

```
actionpack $ bin/test test/controller/parameters/accessors_test.rb
Run options: --seed 48261

........................................................................

Finished in 0.211923s, 339.7460 runs/s, 552.0873 assertions/s.
72 runs, 117 assertions, 0 failures, 0 errors, 0 skips
```

After

```
actionpack $ bin/test test/controller/parameters/accessors_test.rb

Run options: --seed 5461

........................................................................

Finished in 0.008411s, 8560.2189 runs/s, 13910.3557 assertions/s.
72 runs, 117 assertions, 0 failures, 0 errors, 0 skips
```
2021-03-18 02:06:42 -05:00
Ankur Patel
3cc4207aa8
Update template files to follow the standard gem code formatter recommendations 2021-03-16 09:37:42 -04:00
Rafael Mendonça França
d5ee11933f
Make sure the version of rake used in Rails apps work
Since 68a3f679d93a22160cca9a8bd9a869b8c766f860, we are requiring rake
0.13, so we need to specify that is the version we want.
2021-03-15 20:48:38 +00:00
Debbie Milburn
03aa08526a
Merge branch 'main' into add-rails-development-hosts-env-variable 2021-03-09 11:59:11 -05:00