Commit Graph

58 Commits

Author SHA1 Message Date
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
Rafael Mendonça França
82ab903653
Fix bin/test
This was failing when other files also required `bundler/setup` because
bundler were being setup twice.
2020-10-30 21:33:19 +00:00
Josef Šimánek
a49dfe38ae
Introduce Rails::TestUnitReporter.app_root to inject app_root when needed. 2020-06-14 00:02:49 +02:00
Josef Šimánek
32aebc76cb
Use COMPONENT_ROOT as app_root when present in test unit reporting. 2020-06-13 20:30:25 +02:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
Ryuta Kamizono
9e6f9bc773 Fix rubocop offence for Style/FrozenStringLiteralComment
```
% be rubocop -a
Inspecting 2777 files
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Offenses:

tools/test_common.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
if ENV["BUILDKITE"]
^

2777 files inspected, 1 offense detected, 1 offense corrected
```
2019-04-05 00:31:41 +09:00
Fumiaki MATSUSHIMA
61c4be4777 Output junit format test report 2019-04-04 14:34:46 +09:00
Koichi ITO
7d85e0f95c Use frozen string literal in tools/ 2017-08-13 22:04:59 +09:00
Kasper Timm Hansen
0d72489b2a * Don't eagerly require Rails' minitest plugin.
By making the Rails minitest behave like a standard minitest plugin
we're much more likely to not break when people use other minitest
plugins. Like minitest-focus and pride.

To do this, we need to behave like minitest: require files up front
and then perform the plugin behavior via the at_exit hook.
This also saves us a fair bit of wrangling with test file loading.

Finally, since the environment and warnings options have to be applied
as early as possible, and since minitest loads plugins at_exit, they
have to be moved to the test command.

* Don't expect the root method.

It's likely this worked because we eagerly loaded the Rails minitest plugin
and that somehow defined a root method on `Rails`.

* Assign a backtrace to failed exceptions.

Otherwise Minitest pukes when attempting to filter the backtrace (which
Rails' backtrace cleaner then removes).

Means the exception message test has to be revised too.

This is likely caused by the rails minitest plugin now being loaded for
these tests and assigning a default backtrace cleaner.
2017-07-10 20:40:16 +02:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Marc Ignacio
54045ccd51 Adds missing minor doc about tools/test.rb [ci skip]
... and minor typo fix
2017-06-21 04:03:26 +08:00
Matthew Draper
85efa3a2cf Prevent a redefinition warning when the real Rails.root appears 2017-05-26 15:22:57 +09:30
yuuji.yaginuma
f38a660a60 Prevent multiple values being set to run_via
When executing the test via rake, since `rake` is set for `run_via`, `ruby` should not be set.
Related 2cb6c27310452da11b93d729c3b760ce988106e1
2017-02-18 09:49:57 +09:00
yuuji.yaginuma
2047877f4e make work bin/test scripts with line filter
`Rails::LineFiltering` is not automatically loaded, need to load it explicitly.
Ref: 797f1dd, b6f935b
2016-12-17 18:08:57 +09:00
Yves Senn
2b4a9735d8 update bin/test scripts to prevent double runs.
The test runner was updated to make use of autorun. This caused the
`bin/test` scripts to run Minitest twice.
2016-11-21 17:25:12 +01:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
a9dc45459a code gardening: removes redundant selfs
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.

Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
2016-08-08 01:12:38 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
92e2d16a3c applies new string literal convention in tools
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:22:51 +02:00
Prathamesh Sonpatki
ea491653cc Remove requiring load_paths from tools/test.rb
- Instead require and setup Bundler
- `tools/test.rb` is used internally from all `bin/test` scripts inside
   component gems.
- Followup of 2abcdfd978.
2016-03-02 10:28:34 +05:30
Arthur Neves
2abcdfd978 Remove load_paths file 2016-02-27 13:03:57 -05:00
Aaron Ang
5bd179787f Fix title of README according to Markdown conventions
The first heading in some README's are indicated using a second level
heading (`##`), which in my opinion is of incorrect structure.
Therefore, in this patch I changed the first heading to a first level
heading (`#`) in README's where this incorrect structure occurs.

[ci skip]
2016-02-25 03:39:02 +01:00
Sourav Moitra
2f638b227f [ci skip] line_statistics added to README 2016-02-14 21:40:13 +05:30
Yves Senn
2e59604909 make it possible to customize the executable inside rereun snippets.
In the Rails repository we use a `bin/test` executable to run our tests.
However the rerun snippets still included `bin/rails test`:

BEFORE:
```
Failed tests:

bin/rails test test/cases/adapters/postgresql/schema_test.rb:91
```

AFTER:
```
Failed tests:

bin/test test/cases/adapters/postgresql/schema_test.rb:91
```
2015-06-13 11:58:43 +02:00
Yves Senn
9946788775 select the AR adapter through bin/test. 2015-06-11 14:24:56 +02:00
Yves Senn
54d84cbb77 use our runner (bin/test) for framework components.
This adds a script `bin/test` to most Rails framework components. The
script uses the rails minitest plugin to augment the runner.
See https://github.com/rails/rails/pull/19571 for details about the
plugin.

I did not yet add `bin/test` for activerecord, activejob and railties.
These components rely on specific setup performed in the rake-tasks.
2015-06-11 14:12:15 +02:00
schneems
e1a7260640 Use block variable instead of global
```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  x.report("$&") {
    "foo".sub(/f/) { $&.upcase }
  }
  x.report("block var") {
    "foo".sub(/f/) {|match| match.upcase }
  }
end

```

```
Calculating -------------------------------------
                  $&    48.658k i/100ms
           block var    49.666k i/100ms
-------------------------------------------------
                  $&    873.156k (± 9.3%) i/s -      4.331M
           block var    969.744k (± 9.2%) i/s -      4.818M
```

It's faster, and gets rid of a few "magic" global variables
2015-06-01 19:44:40 -05:00
Sushruth Sivaramakrishnan
6a835e26d3 Doc fix [ci skip] 2015-03-06 23:37:54 +05:30
Rishi Jain
93258c528c minor docs change [ci skip] 2014-11-03 12:37:39 +05:30
Rafael Mendonça França
d02adfaa4d line_statistics is not an executable
Also add documentation on it
2014-10-13 11:07:13 -03:00
Jeremy Kemper
911e7094bd Make a note about the internal tools/ dir and what each utility does 2014-10-13 07:04:26 -07:00
Rafael Mendonça França
4c614651b5 Do not use deprecated exists? method 2014-10-13 10:59:43 -03:00
Rafael Mendonça França
46f80b5094 Document the propose of tools/profile 2014-10-13 10:59:12 -03:00
Rafael Mendonça França
33361a50eb Revert "Merge pull request #17247 from igas/fix-deprecations"
This reverts commit 997f1575f78bf6a2d12b8665a55807d51fe964df, reversing
changes made to f919d5f5ea75f0e56a57643e5a0472367a98625f.

See https://github.com/rails/rails/pull/17247#issuecomment-58895078
2014-10-13 10:55:55 -03:00
Igor Kapkov
9114d65800 remove unused tools/profile 2014-10-13 21:43:20 +08:00
Benjamin Fleischer
91d199259b Encapsulate rake lines from ActiveRecord/ActionPack as CodeTools::LineStatistics
[ci skip]
2014-07-25 13:41:18 -05:00
Benjamin Fleischer
3cbeb8d8ea Fail profiler fast when input is not a ruby file
[ci skip]
2014-07-25 13:41:18 -05:00
Benjamin Fleischer
54a4065074 Optionally add String extensions for ruby-prof printer option
[ci skip]
2014-07-25 13:41:18 -05:00
Benjamin Fleischer
f36c46754f Encapsulate tools/profile functionality in CodeTools::Profiler
Fix bug in path expansion of input filepath

[ci skip]
2014-07-25 13:41:18 -05:00
Benjamin Fleischer
65a227beda Correct tools/profile usage example
[ci skip]
2014-07-25 13:25:42 -05:00
Arun Agrawal
0d062f02e9 Removing Gem.source_index [ci skip] 2013-07-13 12:05:52 +02:00
Jeremy Kemper
00791bfb64 Remove REE GC stats since master is 1.9.3 2012-10-26 08:24:27 -07:00
rochefort
a43213c534 fix Example: Rename tools/profile_requires -> tools/profile 2012-10-06 01:32:02 +09:00
Kornelius Kalnbach
d8c1949684 require "rubygems" is obsolete in Ruby 1.9.3 2012-05-13 14:47:25 +02:00
Prem Sichanugrist
f1637bf2bb Remove Active Resource source files from the repository
Dear Active Resource,

It's not that I hate you or anything, but you didn't get much attention lately. There're so many alternatives out there, and I think people have made their choice to use them than you. I think it's time for you to have a big rest, peacefully in this Git repository.

I will miss you,

@sikachu.
2012-03-13 14:55:44 -04:00
Jeremy Kemper
4883082ff1 Support an extra profile printer arg 2010-06-24 01:08:12 -07:00
Jeremy Kemper
7b730a2f1b Show GC time and # of runs too 2010-06-23 16:11:13 -07:00