1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

13 commits

Author SHA1 Message Date
David Heinemeier Hansson
fb1ab3460a
Make Sprockets more optional, offer Propshaft as alternative (#43261)
* Make Sprockets more optional, offer Propshaft as alternative

* Whups, local reference

* No longer used

* Spacing

* Need explicit sprockets-rails inclusion now

* Manually require the sprockets railtie

* Don't need these changes right now

* Kick off another build

* Fix tests

* DRY up test

* Require railtie when using sprockets

* Introduce option to skip asset pipeline

* No longer relevant

* Always have to return

* Gone

* Add helper for skip_sprockets?

* Fix guard statement

* Use latest gems

* Include propshaft

* fix tests for #43261 (#43277)

* help fix tests for #43261

skip_sprockets? should not be called on options

:skip_sprockets is no longer a value in the option hash, so
skip_sprockets? should not be called on it

move --asset-pipeline to shared generator

skip_sprockets? is defined on app_base, and used in the plugin
generator to determine whether to add the engine's assets to the dummy
sprockets manifest, so I believe it makes sense to include in both
generators

Because of this change, I also changed the shared test back to testing
against non-sprockets

add skip_sprockets to Gemfile template vars

Mocking skip_sprockets? in app_base generator

fix more generator tests

* use skip_sprockets? everywhere

* Use latest propshaft

* Update `AssetUrlHelper` docs to list both asset pipeline gems (#43328)

* Update to latest Propshaft

* Bump Propshaft again

* Ask for latest

* Use latest propshaft

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
Co-authored-by: Richard Macklin <1863540+rmacklin@users.noreply.github.com>
2021-10-09 17:03:05 +02:00
David Heinemeier Hansson
82e4432058
Javascript generator option with choices (#43160)
* Switch to a single controller option for choosing JavaScript approach

* Remove remnants of webpacker specific work within Rails

* No longer used

* Missing space

* Raise if unknown option is passed

* Style

* Use latest versions

* Make channels setup generic to all node setups

* Make Action Text installer work with any node package manager

* Explaining variables are not useless

* Rubocop pleasing

* Don't rely on Rails.root

Tests don't like it!

* Rubocopping

* Assume importmap

* No longer relevant

* Another cop

* Style

* Correct installation notice

* Add dependencies for action cable when adding a channel

* Fix paths to be relative to generator

* Just go straight to yarn, forget about binstub

* Fix tests

* Fixup installer, only yarn once

* Test generically with run

* Style

* Fix reference and reversibility

* Style

* Fix test

* Test pinning dependencies

* Remove extra space

* Add more tests

* Use latest dependencies

* Relegated this to controllers

* Refactor ChannelGenerator + more tests

Use a uniform level of abstraction
2021-09-04 11:53:57 +02:00
David Heinemeier Hansson
af7428c4ac
Replace webpack with importmapped Hotwire as default js (#42999)
* Turbolinks is being replaced with Hotwire

* Make --webpack opt-in

* Don't use specific webpacker installers any more in preparation for next Webpacker

* Update railties/lib/rails/app_updater.rb

Co-authored-by: Alex Ghiculescu <alex@tanda.co>

* Trailing whitespace

* Convert to Turbo data attribute for tracking

* Default is no webpack, no hotwire

* Swap out turbolinks references for hotwire

* Drop explicit return

* Only generate package.json if using webpack

* Only create package.json in webpack mode

* Only create app/javascript in webpack mode

* Generate correct style/js links based on js mode

* Fix tests from changed output format

Not sure why these are showing up in this PR, though.

* Rubocopping

* Stick with webpack for the test app for now

* Adjust tests

* Replace minitest-reporters with minitest-ci (#43016)

minitest-reporters is used to create junit xml reports on CI.

But when it loads before rails minitest plugin makes
`Rails::TestUnitReporter` not being added as a reporter.

minitest-ci is now only loaded at ci and does not interferes with
rails minitest plugins. And keeps junit reports workings

* Too heavy handed to actually run bundle

Just like we don't auto-migrate

* Pin js frameworks in importmap

Instead of having importmap preconfigure it.

* Match updated app/javascript path

* No need for the explaining comment

* Fixes test cases for replace webpack with importmapped Hotwire as default js (#42999)

* Fix rubocop issues

* Fix more railities test cases

* Fix plugin generator railties shared test cases

* Fix Action Text install generator asset pipeline spec

* They're modules, not files

* Let dev use the latest release as well

So we don't have to replace unexisting dev releases with latest release

* Make Webpack responsible for generating all the JS files it needs

Webpacker 6 has already moved from app/javascript to app/packs.

* Don't add rails/ujs by default any longer

All the ajax/form functionality has been superseded by Turbo. The rest lives in a weird inbetween land we need to address through other means.

* Use new importmap location

* Switch to using turbo-rails and stimulus-rails directly

The hotwire-rails gem does not offer enough value for its indirection

* Use latest Webpacker

* Prevent version resolution requests from getting swallowed

* Use ESM syntax for imports

* Move management of yarn, package.json, etc to Webpacker 6

* Update for Webpacker 6

* Move bin/setup addition to Webpacker as well

* Remove dead tests

* Bump to Webpacker 6.0.0.rc.2

* No longer relevant given the new default is no webpacker

* Rely on Webpacker 6

* No longer relevant

* No longer relevant

* Make cable channel generator work for both webpacker and importmap setups

* Fix tests

* For tests testing importmap way

* Use Webpacker 6 dummy

* RuboCopping

* One more bump to fix webpack-dev-server

* Another bump. Hopefully the last one!

* Also enough to not want turbo tracking on

* Fix tests

* Latest

* Fix tests

* Fix more tests

* Fix tests

Co-authored-by: Alex Ghiculescu <alex@tanda.co>
Co-authored-by: André Luis Leal Cardoso Junior <andrehjr@gmail.com>
Co-authored-by: Abhay Nikam <nikam.abhay1@gmail.com>
Co-authored-by: Guillermo Iguaran <guilleiguaran@gmail.com>
2021-08-26 10:39:36 +02:00
David Heinemeier Hansson
21c9732fae
Remove spring as a default installation option (#42997)
* Remove spring as a default installation option

Faster computers have meant that most apps won't see a big benefit from Spring on small to moderate size apps. Thus the pain of dealing with the occasional spring issue is no longer warranted by default.

* Errant end

* No longer an option

* Additional spring removals

* Pointer to docs is enough
2021-08-12 12:31:18 +02:00
David Heinemeier Hansson
da22dcc0e9
Puma is the only option used for the web server (#42998)
Doesn't make sense to remove the configuration needed as an option any more.
2021-08-11 16:22:23 +02:00
Alex Ghiculescu
1d1c9f9fe7 Avoid footguns in rails app:update
While upgrading a Rails 6 app to Rails 6.1, I noticed that `rails app:update` asks you to review some file changes that you'd basically never want to accept. In this PR, I propose we make the update task do a bit less, by not offering to overwrite files where the developer has almost certainly changed them from the default. Specific changes:

Don't replace the following files, as they change very rarely at the framework level, so if the user has changes they almost certainly intend to keep them:
- [config/boot.rb](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config/boot.rb.tt)
- [config/environment.rb](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config/environment.rb.tt)
- [config/storage.yml](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config/storage.yml.tt)
- [config/spring.rb](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config/spring.rb.tt)
- [config/cable.yml](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config/cable.yml.tt)
- [config/puma.rb](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config/puma.rb.tt)
- [config.ru](https://github.com/rails/rails/commits/master/railties/lib/rails/generators/rails/app/templates/config.ru.tt)

Don't overwrite the config/locales directory. There's basically no chance you'll want to replace your current `config/locales/en.yml` with a [hello world](https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml).

Don't replace config/routes.rb. It's so unlikely that the user will want to replace their routes file with [an empty file](https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/routes.rb.tt).

With these changes, you will still be prompted to accept/decline changes to these files when doing an update:

- config/application.rb
- config/environments/{development|test|production}.rb
- All the default [initializers](https://github.com/rails/rails/tree/master/railties/lib/rails/generators/rails/app/templates/config/initializers) that you already have a copy of. I go back and forth on also opting some of these out, specifically `assets.rb`, `filter_parameter_logging.rb`, and `inflections.rb` which seem pretty likely to have been changed.
- All the default [binstubs](https://github.com/rails/rails/tree/master/railties/lib/rails/generators/rails/app/templates/bin) that you already have a copy of. I decided to still make the user review these, as bugs here are going to be annoying to debug, but it is good to use the latest versions if possible.
2021-02-09 12:20:56 -07:00
bogdanvlviv
2e37fb655d
Remove --skip-yarn in favor of --skip-javascript
Since #33079 Webpacker the default JavaScript compiler for Rails.
Webpacker uses `yarn` so seems like it doesn't make sense for Rails to keep
`--skip-yarn` option.
2018-10-22 16:54:10 +03:00
Tsukuru Tanimichi
7b0a316f2d Don't generate yarn's contents in app:update task if it's skipped 2018-05-16 20:24:57 +09:00
Tsukuru Tanimichi
8efa112ca6 Don't generate config/spring.rb in app:update task when spring isn't loaded 2018-05-13 21:51:10 +09:00
yuuji.yaginuma
9a1b99eb01 Skip bootsnap contents in app:update task if bootsnap is not used 2018-05-07 07:56:00 +09:00
bogdanvlviv
4a835aa323
Add --skip-active-storage and do so automatically when --skip-active-record is used
Closes #30102

Revert part 787fe90dc0

--skip-active-storage pass throughs `rails plugin new`

Add changelog entry about default initialization of Active Storage
2017-11-06 21:08:51 +00:00
Pat Allan
acea68de02 Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
yuuji.yaginuma
5803640261 Do not generate unused components contents in app:update task
Currently, `app:update` generates all contents regardless of the
component using in application.

For example, even if not using Action Cable, `app:update` will generate
a contents related to Action Cable. This is a little inconvenient.
This PR checks the existence of the component and does not generate
unnecessary contents.
Can not check all options in this way. However, it will be able to
prevent the generation of unnecessary files.
2017-07-16 08:38:47 +09:00