Commit Graph

5020 Commits

Author SHA1 Message Date
Rafael Mendonça França
15381dd3b1
Merge pull request #51894 from rails/rm-enable-yjit
Move plumbing to enable yjit to inside the framework
2024-05-23 15:19:39 -04:00
Rafael Mendonça França
30e6a197df
Move plumbing to enable yjit to inside the framework
There is no reason to expose all those details to users and this
has the benefit that now are can ensure that the YJIT is enabled
after all initialization is done.
2024-05-23 19:01:29 +00:00
Andrew Novoselac
df203b2e90
Create a devcontainer command
This command boots the application, and generates a Dev Container setup based on the current configuration of the application.
2024-05-23 18:50:51 +00:00
Andrew Novoselac
4d62ea3ed4
Update database.yml from DevcontainerGenerator
Postgresql's database.yml has devcontainer specific logic that should only appear when the app has a devcontainer. We need the DevcontainerGenerator to update database.yml, so when it is called by the devcontainer command the database.yml will have the right configuration.

This commit also fixes db:system:change to make sure it updates the database.yml with the correct devcontainer configuration.
2024-05-23 18:43:22 +00:00
Andrew Novoselac
1275e93594
Update application_system_test_case.rb from DevcontainerGenerator
Instead of relying on the template to be dev container aware and generate the correct configuration, let's just update the configuration in place when running the DevcontainerGenerator. This will allow the devcontainer command to update this file with the configuration needed for devcontainers without overwriting the entire file.
2024-05-23 18:43:21 +00:00
Andrew Novoselac
a61bfe49a5
Make devcontainer opt-in when creating a new application
For Rails 7.2 we will make devcontainer and opt-in feature for new applications. When creating a new app, you can generate a devcontainer by passing the --devcontainer flag.
2024-05-23 18:43:19 +00:00
Rafael Mendonça França
c906f75282
Merge pull request #51822 from excid3/plugin-github-actions
Add rubocop and GitHub Actions to plugin generator
2024-05-23 14:08:58 -04:00
Yasuo Honda
5c92d45e8a
Merge pull request #51838 from jeromedalbert/no-kamal-storage-volume-if-not-needed
Don’t configure Kamal storage volume if not needed
2024-05-21 08:46:26 +09:00
Yasuo Honda
ba6e556f39
Merge pull request #51837 from jeromedalbert/no-storage-if-not-needed-1
Don’t create storage folder if not needed
2024-05-21 08:45:57 +09:00
Jerome Dalbert
3156e50838
Don’t configure Kamal storage volume if not needed
Configuring a persistent storage volume in Kamal
is needed only for sqlite or Active Storage. If
using a different database or the
--skip-active-storage option, this configuration
can be skipped.
2024-05-19 18:30:36 -07:00
Chris Oliver
7594a73942
Add rubocop and GitHub Actions to plugin generator
When creating new Rails plugins, rubocop and GitHub Actions are now
included to make linting and testing easier.
2024-05-18 09:19:12 -05:00
Jerome Dalbert
918c71fa5a Don’t create storage/ directory if not needed
The storage/ directory is used for sqlite or
Active Storage. If using a different database
and the --skip-active-storage option, this
directory is not needed.
2024-05-17 10:52:15 -07:00
Hartley McGuire
6ec2384e07
Allow test command invocations to exit failure
Minitest will now exit 1 when a `-n` type test filter is used and no
test cases end up being run. However, these tests are not really
concerned with the exit code, just that `test:prepare` doesn't run.

This commit adds `allow_failure: true` to the test command invocations
so that we can continue to test whether `test:prepare` is run without
caring about the exit status of the test command.
2024-05-15 18:50:06 -04:00
Rafael Mendonça França
a82e432b83
Merge pull request #51763 from JoeDupuis/postgresql-adapter-decode-dates-config
Add `active_record.postgresql_adapter_decode_dates` config
2024-05-15 14:55:15 -04:00
Rafael Mendonça França
b56ee17db6
Merge pull request #51783 from JoeDupuis/fix-fail-fast-flake
Fix test runner --fail-fast test flake
2024-05-15 14:42:06 -04:00
Joé Dupuis
478874ae1b
Add active_record.postgresql_adapter_decode_dates
to toggle automatic decoding of dates column with the
PostgresqlAdapter.

PR #51483 is a breaking change and should have been gated behind a
config.
2024-05-15 18:38:08 +00:00
Carlos Antonio da Silva
72fccfb5d6 Fix console tests
We need to pass the verbose option in order to test the full expected
output. Not sure why these were green on the branch.

Introduced by #51732.
2024-05-14 20:59:11 -03:00
Carlos Antonio da Silva
5e3611ea5a
Merge pull request #51732 from Shopify/fix-rails-console-prompt
Avoid setting fixed app name in console prompt
2024-05-14 18:56:21 -03:00
David Heinemeier Hansson
bee3fa41ca
Add Kamal by default to Rails 8 (#51798)
* Add Kamal by default
2024-05-13 17:32:42 -07:00
Rafael Mendonça França
a70d89c519
Merge pull request #51766 from Shopify/revert-actionable-errors-retry
Revert "Merge pull request #50941 from andrewn617/actionable-cli"
2024-05-13 18:28:42 +00:00
Rafael Mendonça França
cb1c789ca2
Merge pull request #51765 from Shopify/refactor-devcontainer-implementation
Clean up database generators implementation
2024-05-13 14:19:44 -04:00
Rafael Mendonça França
5c933a3d82
Merge pull request #51791 from duduribeiro/add-name-to-devcontainer-compose
Add name to DevContainer compose file
2024-05-13 14:10:47 -04:00
Andrew Novoselac
c1bc7ee82e Refactoring Database generators
Extract all the DB information (gems, dockerfile packages, devcontainer etc.) into an object. This let's us remove the growing number of case statements in this code.
2024-05-13 14:07:47 -04:00
Andrew Novoselac
5b91084f20 Remove support for oracle, sqlserver and JRuby specific database adapters from the new and db:system:change commands. The supported options are sqlite3, mysql, postgresql and trilogy. 2024-05-13 14:07:47 -04:00
Cadu Ribeiro
f63d344ce9 Add name to DevContainer compose file
Currently when you generate a project the compose.yaml generated
file does not include the top-level name property. Not having this
top-level name property makes all containers / volumes started by
devcontainer to be prepended with the folder name, which is
`devcontainer` in the case of the .devcontainer/compose.yml` file.

This is ok if you run only one project with devcontainer but starts
to get problem if you run multiple projects. If you have one project
that runs on postgresql 15 and a new one that runs on postgresql 16 it
will fail to boot the postgresql container because both devcontainers is
using the same volume: `devcontainer_postgres-data`.

This commit fixes this by setting the top-lavel name property with
the project name, which will make the containers and volumes to be
prepended with the project name and not with `devcontainer`.
2024-05-13 14:26:46 -03:00
Koichi ITO
6afc3682ae Suppress RuboCop output when there are no offenses in code generation
Follow up #51782.

> But it's overkill for the default case where people use the default style guide,
> and it introduces both delay and console output as a cost.

When there are no offenses with the coding style generated by code generation,
outputting RuboCop results to the console was redundant.
Since RuboCop has `--format=quiet` option that suppresses console output
when there are no offenses, this PR adds that option:
https://docs.rubocop.org/rubocop/1.63/formatters.html#quiet-formatter

While this PR doesn't resolve any added execution speed by RuboCop,
the frequency of using the generator is not high within the development flow.
Therefore, depending on the execution speed, it might be possible to uncomment #51782,
but this PR respects the defaults in #51782 and doesn't address that.
2024-05-13 19:47:12 +09:00
Gannon McGibbon
e97db3b395
Merge pull request #51614 from gmcgibbon/defer_route_drawing
Defer route drawing to the first request, or when url_helpers called
2024-05-12 10:17:57 -04:00
Joé Dupuis
a63baa5db1
Fix test runner --fail-fast test flake
Without the sleep, the test has high variability in the amount of test
ran before stopping. With the sleep, the test is pretty stable with
negligeable impact on run time.
2024-05-10 18:58:44 -07:00
Alex Ghiculescu
2194a738c7 Active Job: Correctly use the desired test adapter in tests 2024-05-09 17:35:50 +10:00
Gannon McGibbon
e54f869e43 Defer route drawing to the first request, or when url_helpers called.
Executes the first routes reload in middleware, or when the route set
url_helpers is called. Previously, this was executed unconditionally on
boot, which can slow down boot time unnecessarily for larger apps with
lots of routes.
2024-05-08 23:43:06 -04:00
Stan Lo
484c026f98
Continue including Rails::ConsoleMethods to IRB's internal
Due to some users/libs relying on Rails::ConsoleMethod to extend Rails
console, we need to keep including it to IRB's internal.

But to prevent also adding `app` and `helper` methods to the console,
which are already registered to IRB through its API, we need to remove
them from the Rails::ConsoleMethods. Additionally, we should raise
deprecation warning when users try to use Rails::ConsoleMethods in this
way.

This commit:
- Removes all methods from Rails::ConsoleMethods that are already
  registered to IRB. So it's now essentially empty.
- Raises a deprecation warning when modules are included to Rails::ConsoleMethods
  or methods are added to it.
- Adds a test to ensure that the deprecation warning is raised and the
  methods are available in the console.
2024-05-07 18:55:24 +01:00
Stan Lo
beba30ba4d
Avoid setting fixed app name in console prompt
Instead, the app's name should be set via a separate IRB config, which
will allow it to be changed at runtime.

Co-authored-by: Mike Dalessio <mike.dalessio@gmail.com>
2024-05-07 00:02:22 +01:00
Andrew Novoselac
6e0b867a81 Improve db_system_change_generator_test.rb 2024-05-06 18:00:01 -04:00
Andrew Novoselac
bd31917001 Devcontainer: Use SQLite3 feature.
This feature includes the dependencies needed for SQLite (previously we were getting these from lib-vips installation), and the SQLite3 client.
2024-05-06 17:51:04 -04:00
tompng
4b460411c7 Fix console_test to work with both IRB's RelineInputMethod and StdioInputMethod 2024-05-05 20:15:50 +09:00
Étienne Barrié
d379fae6d2 Add runtime options from Thor::Actions to app:update 2024-05-02 16:53:21 +02:00
Stan Lo
4c1f7d8328
Register Rails console commands/helpers with its latest extension APIs
This will greatly increase the visibility of Rails console commands and helpers,
and stop rely on IRB's internal components.

Extension API reference: https://github.com/ruby/irb/blob/master/EXTEND_IRB.md

And because we need to create new classes to use the new APIs, I also
moved all the IRB-specific code to a new file, `irb_console.rb`.

Use IRB.conf[:BACKTRACE_FILTER] for backtrace filtering in console

This change uses the new `IRB.conf[:BACKTRACE_FILTER]` to inject the backtrace
filtering logic into IRB. This avoids the need to patch IRB's internal
WorkSpace class.

Update changelog
2024-05-01 22:14:53 +00:00
Rafael Mendonça França
b35df004fd
Remove deprecated Rails::Generators::Testing::Behaviour 2024-05-01 20:19:21 +00:00
Rafael Mendonça França
e38dfb2149
Remove deprecated Rails.config.enable_dependency_loading 2024-05-01 18:46:07 +00:00
Rafael Mendonça França
0c76f17f2d
Remove deprecated Rails.application.secrets 2024-05-01 18:46:04 +00:00
Rafael Mendonça França
0a84b72a70
Remove deprecation on calling assert_equal with nil 2024-05-01 18:45:49 +00:00
Rafael Mendonça França
38bfbcfbea
Remove deprecated support for config.active_support.cache_format_version = 6.1 2024-05-01 18:44:49 +00:00
fatkodima
702638291c
Fix tests without assertions in the framework 2024-04-30 23:29:30 +00:00
Andrew Novoselac
9ac526a21a Unsilence BacktraceCleaner with BACKTRACE without removing silencers
rails/rails@957a3e5 allowed the BACKTRACE env to unsilence backtraces in normals runs not just tests. However, the implementation achieves this by removing the silences in an initializer. This means that the state of backtrace silencer becomes cached by spring and the developer needs to reset spring every time they want to silence or unsilence the backtrace. It also means custom silencers added in an initializer need to be added after the :configure_backtrace_cleaner initializer or else they won't be un-silenced properly.

Instead, let's teach Rails::BacktraceCleaner to unsilence the backtrace if the BACKTRACE variable is set. ActiveSupport::BacktraceCleaner#clean already allows this by passing nil as the second argument, which just filters but does not silence the backtrace. So, in Rails::BacktraceCleaner#clean we can call super with nil in the second argument if the BACKTRACE variable is present. That way we do not need to remove the silencers in an initializer, and we don't have to reset spring to silence the backtrace.
2024-04-26 11:45:59 -04:00
Ryuta Kamizono
107fd51a22
Merge pull request #51446 from koic/fix_error_when_rails_g_rubocop_with_pretend
Fix an error for `apply_rubocop_autocorrect_after_generate!` with `--pretend`
2024-04-24 15:28:41 +09:00
John Hawthorn
734719d8af
Merge pull request #51590 from jhawthorn/backtrace_cleaner_3_4
Fix ActionView backtrace filtering on Ruby 3.4+
2024-04-22 15:33:24 -07:00
Rafael Mendonça França
c05608b901
Merge pull request #50780 from zachasme/app-update-skip-sprockets
Preserve `--asset-pipeline propshaft` when running `app:update`
2024-04-22 18:42:10 -03:00
John Hawthorn
3cf6122ccc Fix ActionView backtrace filtering on Ruby 3.4+ 2024-04-22 14:07:57 -07:00
Rafael Mendonça França
270ed27cec
Merge pull request #51036 from zzak/railties/asto-integration
Add a basic railtie integration test for Active Storage
2024-04-18 18:11:44 -03:00
Rafael Mendonça França
35efaca34e
Merge pull request #51588 from duduribeiro/add-devcontainer-forward-ports
Change devcontainer.json to forward used ports for the project
2024-04-18 13:47:50 -03:00