ruby-next-core 0.5.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9779cf5c0dea7fff2e3185f6409a7ea21287d4d4b38466e7393c2cebb97d128a
4
- data.tar.gz: b1ef29ce986cbaa595e3a5e257674869d3e7d5842185385728d5f70eb81996fc
3
+ metadata.gz: 79dd9f615898df70de6648be3805f3c0da92c80e22cd8e2cffc109958ec0811b
4
+ data.tar.gz: 7ed7e923ca5f2b3f6eaf27135a722f2a23e868fe65bce32f6700e74867e6d62c
5
5
  SHA512:
6
- metadata.gz: 26de1a278bceaa3423b21e4f7b1c6c791e9fe3e42d319864fd0041d29f86b5946095ea42e03811169aa41be1220e4726ec57a24f19f939ec8fb197662505f2f1
7
- data.tar.gz: 9ef7af94930ac374f7732e1ff71b57b4ee135be8609e0343314117f362af994c177dfa2541cfcc0802029320341e3c509b11ef8a2fdf0ab0e5d80451e902d803
6
+ metadata.gz: e16c8585ed3e8b5b23ccc5a7b79b80d6da6e96f539c008bc9e781e523c8451fec954b6f0e0948056de9feb231b30dd62989c26aea77890afc2037d91c0a4028a
7
+ data.tar.gz: b2d0d3891032b51a22ffccc600410d250da89d34332cc4797fc4e216f13ab82024520c262e43788660e041937c081a254ae7597e93e686fc23fcbd2d9df37e0c
@@ -2,6 +2,70 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.9.0 (2020-06-04)
6
+
7
+ - Add Ruby 2.3 support. ([@palkan][])
8
+
9
+ - Remove stale transpiled files when running `ruby-next nextify`. ([@palkan][])
10
+
11
+ - Add Ruby 2.4 support. ([@palkan][])
12
+
13
+ APIs for <2.5 must be backported via [backports][] gem. Refinements are not supported.
14
+
15
+ ## 0.8.0 (2020-05-01) 🚩
16
+
17
+ - Add right-hand assignment support. ([@palkan][])
18
+
19
+ It is real: `13.divmod(5) => a, b`.
20
+
21
+ - Add endless methods support. ([@palkan][])
22
+
23
+ Now you can write `def foo() = :bar`.
24
+
25
+ ## 0.7.0 (2020-04-29)
26
+
27
+ - Try to auto-transpile the source code on load in `.setup_gem_load_path` if transpiled files are missing. ([@palkan][])
28
+
29
+ This would make it possible to install gems from source if transpiled files do not exist in the repository.
30
+
31
+ - Use`./.rbnextrc` to define CLI args. ([@palkan][])
32
+
33
+ You can define CLI options in the configuration file to re-use them between environments or
34
+ simply avoid typing every time:
35
+
36
+ ```yml
37
+ # .rbnextrc
38
+ nextify: |
39
+ --transpiler-mode=rewrite
40
+ --edge
41
+ ```
42
+
43
+ - Add `--dry-run` option to CLI. ([@palkan][])
44
+
45
+ - Raise `SyntaxError` when parsing fails. ([@palkan][])
46
+
47
+ Previously, we let Parser to raise its `Parser::SyntaxError` but some exceptions
48
+ are not reported by Parser and should be handled by transpiler (and we raised `SyntaxError` in that case, as MRI does).
49
+
50
+ This change unifies the exceptions raised during transpiling.
51
+
52
+ ## 0.6.0 (2020-04-23)
53
+
54
+ - Changed the way edge/proposed features are activated. ([@palkan][])
55
+
56
+ Use `--edge` or `--proposed` flags for `ruby-next nextify` or
57
+ `require "ruby-next/language/{edge,proposed}"` in your code.
58
+
59
+ See more in the [Readme](./README.md#proposed-and-edge-features).
60
+
61
+ - Updated RuboCop integration. ([@palkan][])
62
+
63
+ Make sure you use `TargetRubyVersion: next` in your RuboCop configuration.
64
+
65
+ - Upgraded to `ruby-next-parser` for edge features. ([@palkan][])
66
+
67
+ It's no longer needed to use Parser gem from Ruby Next package registry.
68
+
5
69
  ## 0.5.3 (2020-03-25)
6
70
 
7
71
  - Enhance logging. ([@palkan][])
@@ -124,3 +188,4 @@ p a #=> 1
124
188
  - Add `Kernel#then`. ([@palkan][])
125
189
 
126
190
  [@palkan]: https://github.com/palkan
191
+ [backports]: https://github.com/marcandre/backports
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/ruby-next.svg)](https://rubygems.org/gems/ruby-next) [![Build](https://github.com/ruby-next/ruby-next/workflows/Build/badge.svg)](https://github.com/ruby-next/ruby-next/actions)
2
- [![JRuby Build](https://github.com/ruby-next/ruby-next/workflows/JRuby%20Build/badge.svg)](https://github.com/ruby-next/ruby-next/actions)
2
+ [![JRuby Build](https://github.com/ruby-next/ruby-next/workflows/JRuby%20Build/badge.svg)](https://github.com/ruby-next/ruby-next/actions?query=workflow%3A%22TruffleRuby+Build%22)
3
+ [![TruffleRuby Build](https://github.com/ruby-next/ruby-next/workflows/TruffleRuby%20Build/badge.svg)](https://github.com/ruby-next/ruby-next/actions?query=workflow%3A%22TruffleRuby+Build%22)
3
4
 
4
5
  # Ruby Next
5
6
 
@@ -17,16 +18,33 @@ Who might be interested in Ruby Next?
17
18
  Ruby Next also aims to help the community to assess new, _experimental_, MRI features by making it easier to play with them.
18
19
  That's why Ruby Next implements the `master` features as fast as possible.
19
20
 
21
+ Read more about the motivation behind the Ruby Next in this post: [Ruby Next: Make all Rubies quack alike](https://evilmartians.com/chronicles/ruby-next-make-all-rubies-quack-alike).
22
+
20
23
  <a href="https://evilmartians.com/?utm_source=ruby-next">
21
24
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
22
25
 
23
- ## Links
26
+ ## Posts
27
+
28
+ - [Ruby Next: Make all Rubies quack alike](https://evilmartians.com/chronicles/ruby-next-make-all-rubies-quack-alike)
29
+
30
+ ## Talks
24
31
 
25
32
  - [Ruby Next: Make old Rubies quack like a new one](https://noti.st/palkan/j3i2Dr/ruby-next-make-old-rubies-quack-like-a-new-one) (RubyConf 2019)
26
33
 
34
+ ## Examples
35
+
36
+ - Ruby gems
37
+ - [anyway_config](https://github.com/palkan/anyway_config)
38
+ - [graphql-fragment_cache](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache)
39
+ - mruby
40
+ - [ACLI](https://github.com/palkan/acli)
41
+
42
+ _Please, submit a PR to add your project to the list!_
43
+
27
44
  ## Table of contents
28
45
 
29
46
  - [Overview](#overview)
47
+ - [Quick Start](#quick-start)
30
48
  - [Polyfills](#using-only-polyfills)
31
49
  - [Transpiling](#transpiling)
32
50
  - [Modes](#transpiler-modes)
@@ -37,6 +55,7 @@ That's why Ruby Next implements the `master` features as fast as possible.
37
55
  - [`ruby -ruby-next`](#uby-next)
38
56
  - [Logging & Debugging](#logging-and-debugging)
39
57
  - [RuboCop](#rubocop)
58
+ - [Using with EOL Rubies](#using-with-eol-rubies)
40
59
  - [Proposed & edge features](#proposed-and-edge-features)
41
60
 
42
61
  ## Overview
@@ -48,8 +67,34 @@ Core provides **polyfills** for Ruby core classes APIs via Refinements (default
48
67
  Language is responsible for **transpiling** edge Ruby syntax into older versions. It could be done
49
68
  programmatically or via CLI. It also could be done in runtime.
50
69
 
51
- Currently, Ruby Next supports Ruby versions 2.5+ (including JRuby 9.2.8+).
52
- Please, [open an issue](https://github.com/ruby-next/ruby-next/issues/new/choose) if you would like us to support older Ruby versions.
70
+ Currently, Ruby Next supports Ruby versions 2.3+, including JRuby 9.2.8+ and TruffleRuby 20.1+ (with some limitations). Support for EOL versions (<2.5) slightly differs though ([see below](#using-with-eol-rubies)).
71
+
72
+ Please, [open an issue](https://github.com/ruby-next/ruby-next/issues/new/choose) or join the discussion in the existing ones if you would like us to support older Ruby versions.
73
+
74
+ ## Quick start
75
+
76
+ The quickest way to start experimenting with Ruby Next is to install the gem and run a sample script. For example:
77
+
78
+ ```sh
79
+ # Install Ruby Next globally
80
+ $ gem install ruby-next
81
+
82
+ # Call ruby with -ruby-next flag
83
+ $ ruby -ruby-next -e "
84
+ def greet(val) =
85
+ case val
86
+ in hello: hello if hello =~ /human/i
87
+ '🙂'
88
+ in hello: 'martian'
89
+ '👽'
90
+ end
91
+
92
+ greet(hello: 'martian') => greeting
93
+ puts greeting
94
+ "
95
+
96
+ => 👽
97
+ ```
53
98
 
54
99
  ## Using only polyfills
55
100
 
@@ -79,7 +124,7 @@ using RubyNext
79
124
 
80
125
  Ruby Next only refines core classes if necessary; thus, this line wouldn't have any effect in the edge Ruby.
81
126
 
82
- **NOTE:** Even if the runtime already contains a monkey-patch with the backported functionality, we consider the method as _dirty_ and activate the refinement for it. Thus, you always have a predictable behaviour. That's why we recommend using refinements for gems development.
127
+ **NOTE:** Even if the runtime already contains a monkey-patch with the backported functionality, we consider the method as _dirty_ and activate the refinement for it. Thus, you always have predictable behaviour. That's why we recommend using refinements for gems development.
83
128
 
84
129
  Alternatively, you can go with monkey-patches. Just add this line:
85
130
 
@@ -93,6 +138,8 @@ The following _rule of thumb_ is recommended when choosing between refinements a
93
138
  - Using core extensions could be considered for application development (no need to think about `using RubyNext`); this approach could potentially lead to conflicts with dependencies (if these dependencies are not using refinements 🙂)
94
139
  - Use core extensions if refinements are not supported by your platform
95
140
 
141
+ **NOTE:** TruffleRuby doesn't fully support refinements (refining modules is not supported as of v20.1.0).
142
+
96
143
  [**The list of supported APIs.**][features_core]
97
144
 
98
145
  ## Transpiling
@@ -124,7 +171,7 @@ gem install ruby-next
124
171
 
125
172
  Ruby Next currently provides two different modes of generating transpiled code: _AST_ and _rewrite_.
126
173
 
127
- In the AST mode, we parse the source code into AST, modifies this AST and **generate a new code from AST** (using [unparser][unparser]). Thus, the transpiled code being identical in terms of functionality has a different formatting.
174
+ In the AST mode, we parse the source code into AST, modifies this AST and **generate a new code from AST** (using [unparser][unparser]). Thus, the transpiled code being identical in terms of functionality has different formatting.
128
175
 
129
176
  In the rewrite mode, we apply changes to the source code itself, thus, keeping the original formatting of the unaffected code (in a similar way to RuboCop's autocorrect feature).
130
177
 
@@ -138,6 +185,8 @@ You can change the transpiler mode:
138
185
  - Via environmental variable `RUBY_NEXT_TRANSPILE_MODE=rewrite`.
139
186
  - Via CLI option ([see below](#cli)).
140
187
 
188
+ **NOTE:** For the time being, Unparser [doesn't support](https://github.com/mbj/unparser/pull/142) new Ruby 2.7 AST nodes, so we always use rewrite mode in Ruby 2.7+.
189
+
141
190
  ## CLI
142
191
 
143
192
  Ruby Next ships with the command-line interface (`ruby-next`) which provides the following functionality:
@@ -159,6 +208,7 @@ Usage: ruby-next nextify DIRECTORY_OR_FILE [options]
159
208
  --[no-]refine Do not inject `using RubyNext`
160
209
  -h, --help Print help
161
210
  -V Turn on verbose mode
211
+ --dry-run Print verbose output without generating files
162
212
  ```
163
213
 
164
214
  The behaviour depends on whether you transpile a single file or a directory:
@@ -190,6 +240,7 @@ Usage: ruby-next core_ext [options]
190
240
  -n, --name=NAME Filter extensions by name
191
241
  -h, --help Print help
192
242
  -V Turn on verbose mode
243
+ --dry-run Print verbose output without generating files
193
244
  ```
194
245
 
195
246
  The most common use-case is to backport the APIs required by pattern matching. You can do this, for example,
@@ -216,7 +267,21 @@ $ ruby-next core_ext -l --name=filter --name=deconstruct
216
267
  - StructDeconstruct
217
268
  ```
218
269
 
219
- ### Integrating into a gem development
270
+ ### CLI configuration file
271
+
272
+ You can define CLI options in the `.rbnextrc` file located in the root of your project to avoid adding them every time you run `ruby-next`.
273
+
274
+ Configuration file is a YAML with commands as keys and options as multiline strings:
275
+
276
+ ```yml
277
+ # ./.rbnextrc
278
+
279
+ nextify: |
280
+ --transpiler-mode=rewrite
281
+ --edge
282
+ ```
283
+
284
+ ## Integrating into a gem development
220
285
 
221
286
  We recommend _pre-transpiling_ source code to work with older versions before releasing it.
222
287
 
@@ -253,6 +318,24 @@ If you're using [runtime mode](#runtime-usage) a long with `setup_gem_load_path`
253
318
 
254
319
  \* Ruby Next avoids storing duplicates; instead, only the code for the earlier version is created and is assumed to be used with other versions. For example, if the transpiled code is the same for Ruby 2.5 and Ruby 2.6, only the `.rbnext/2.7/path/to/file.rb` is kept. That's why multiple entries are added to the `$LOAD_PATH` (`.rbnext/2.6` and `.rbnext/2.7` in the specified order for Ruby 2.5 and only `.rbnext/2.7` for Ruby 2.6).
255
320
 
321
+ ### Transpiled files vs. VCS vs. installing from source
322
+
323
+ It's a best practice to not keep generated files in repositories. In case of Ruby Next, it's a `lib/.rbnext` folder.
324
+
325
+ We recommend adding this folder only to the gem package (i.e., it should be added to your `spec.files`) and ignore it in your VCS (e.g., `echo ".rbnext/" >> .gitignore`). That would make transpiled files available in releases without polluting your repository.
326
+
327
+ What if someone decides to install your gem from the VCS source? They would likely face some syntax errors due to the missing transpiled files.
328
+
329
+ To solve this problem, Ruby Next _tries_ to transpile the source code when you call `#setup_gem_load_path`. It does this by calling `bundle exec ruby-next nextify <lib_dir> -o <next_dir>`. We make the following assumptions:
330
+
331
+ - We are in the Bundler context (since that's the most common way of installing gems from source).
332
+ - Our Gemfile contains `ruby-next` gem.
333
+ - We use [`.rbnextrc`](#CLI-configuration-file) for transpiling options.
334
+
335
+ If the command fails we warn the end user.
336
+
337
+ This feature, _auto-transpiling_, is **disabled** by default (will likely be enabled in future versions). You can enable it by calling `RubyNext::Language.setup_gem_load_path(transpile: true)`.
338
+
256
339
  ## Runtime usage
257
340
 
258
341
  It is also possible to transpile Ruby source code in run-time via Ruby Next.
@@ -292,10 +375,12 @@ To enable this integration, add the following line after the `require "bootsnap/
292
375
  require "ruby-next/language/bootsnap"
293
376
  ```
294
377
 
295
- **NOTE:** there is no way to invalidate the cache when you upgrade Ruby Next (e.g., due to the bug fixes), so you should do this manually.
378
+ **NOTE:** There is no way to invalidate the cache when you upgrade Ruby Next (e.g., due to the bug fixes), so you should do this manually.
296
379
 
297
380
  ## `uby-next`
298
381
 
382
+ _This is [not a typo](https://github.com/ruby-next/ruby-next/pull/8), that’s the way `ruby -ruby-next` works: it’s equal to `ruby -r uby-next`, and [`uby-next.rb`](https://github.com/ruby-next/ruby-next/blob/master/lib/uby-next.rb) is a special file that activates the runtime mode._
383
+
299
384
  You can also enable runtime mode by requiring `uby-next` while running a Ruby executable:
300
385
 
301
386
  ```sh
@@ -308,6 +393,12 @@ RUBYOPT="-ruby-next" ruby my_ruby_script.rb
308
393
  ruby -ruby-next -e "puts [2, 4, 5].tally"
309
394
  ```
310
395
 
396
+ **NOTE:** running Ruby scripts directly or executing code via `-e` option is not supported in TruffleRuby. You can still use `-ruby-next` to transpile required files, e.g.:
397
+
398
+ ```sh
399
+ ruby -ruby-next -r my_ruby_script.rb -e "puts my_method"
400
+ ```
401
+
311
402
  ## Logging and debugging
312
403
 
313
404
  Ruby Next prints some debugging information when fails to load a file in the runtime mode (and fallbacks to the built-in loading mechanism).
@@ -328,7 +419,7 @@ require:
328
419
  - ruby-next/rubocop
329
420
  ```
330
421
 
331
- **NOTE:** You should use `TargetRubyVersion: 2.7`.
422
+ You must set `TargetRubyVersion: next` to make RuboCop use a Ruby Next parser.
332
423
 
333
424
  Alternatively, you can load the patch from the command line by running: `rubocop -r ruby-next/rubocop ...`.
334
425
 
@@ -340,57 +431,78 @@ AllCops:
340
431
  - 'lib/.rbnext/**/*'
341
432
  ```
342
433
 
343
- ## Proposed and edge features
434
+ **NOTE:** you need `ruby-next` gem available in the environment where you run RuboCop (having `ruby-next-core` is not enough).
344
435
 
345
- Ruby Next aims to bring edge and proposed features to Ruby community before they (hopefully) reach an official Ruby release.
346
- This includes:
436
+ ## Using with EOL Rubies
347
437
 
348
- - Features already merged to [master](https://github.com/ruby/ruby) (_edge_)
349
- - Features proposed in [Ruby bug tracker](https://bugs.ruby-lang.org/) (_proposed_)
350
- - Features once merged to master but got reverted.
438
+ We currently provide support for Ruby 2.3 and 2.4. Work on 2.2 is in progress.
351
439
 
352
- These features require a [custom parser](#using-ruby-next-parser).
440
+ Ruby Next itself relies on 2.5 features and contains polyfills only for version 2.5+ (and that won't change).
441
+ Thus, to make it work with <2.5 we need to backport some APIs ourselves.
353
442
 
354
- Currently, the only such feature is the [_method reference_ operator](https://bugs.ruby-lang.org/issues/13581):
443
+ The recommended way of doing this is to use [backports][] gem. You need to load backports **before Ruby Next**.
355
444
 
356
- - Add `--enable-method-reference` option to `nextify` command when using CLI.
357
- - OR add it programmatically when using a runtime mode (see [example](https://github.com/ruby-next/ruby-next/blob/master/default.mspec)).
358
- - OR set `RUBY_NEXT_ENABLE_METHOD_REFERENCE=1` environment variable (works with CLI as well).
445
+ When using runtime features, you should do the following:
359
446
 
360
- ### Prerequisites
447
+ ```ruby
448
+ # first, require backports upto 2.5
449
+ require "backports/2.5"
450
+ # then, load Ruby Next
451
+ require "ruby-next"
452
+ # if you need 2.6+ APIs, add Ruby Next core_ext
453
+ require "ruby-next/core_ext"
454
+ # then, load runtime transpiling
455
+ require "ruby-next/language/runtime"
456
+ # or
457
+ require "ruby-next/language/bootsnap"
458
+ ```
361
459
 
362
- Our own version of [parser][next_parser] gem is hosted on Github Package Registry. That makes the installation process a bit more complicated than usual.
460
+ To load backports while using `ruby-next nextify` command, you must configure the environment variable:
363
461
 
364
- You must obtain an access token to use it. See the [GPR docs](https://help.github.com/en/github/managing-packages-with-github-package-registry/configuring-rubygems-for-use-with-github-package-registry#authenticating-to-github-package-registry).
462
+ ```sh
463
+ RUBY_NEXT_CORE_STRATEGY=backports ruby-next nextify lib/
464
+ ```
365
465
 
366
- ### Installing with Bundler
466
+ **NOTE:** Make sure you have `backports` gem installed globally or added to your bundle (if you're using `bundle exec ruby-next ...`).
367
467
 
368
- First, configure your bundler to access GPR:
468
+ ## Proposed and edge features
369
469
 
370
- ```sh
371
- bundle config --local https://rubygems.pkg.github.com/ruby-next USERNAME:ACCESS_TOKEN
372
- ```
470
+ Ruby Next aims to bring edge and proposed features to Ruby community before they (hopefully) reach an official Ruby release.
471
+ This includes:
472
+
473
+ - Features already merged to [master](https://github.com/ruby/ruby) (_edge_)
474
+ - Features proposed in [Ruby bug tracker](https://bugs.ruby-lang.org/) (_proposed_)
475
+ - Features once merged to master but got reverted.
476
+
477
+ These features are disabled by default, you must opt-in in one of the following ways:
373
478
 
374
- Then, add to your Gemfile:
479
+ - Add `--edge` or `--proposed` option to `nextify` command when using CLI.
480
+ - Enable programmatically when using a runtime mode:
375
481
 
376
482
  ```ruby
377
- source "https://rubygems.pkg.github.com/ruby-next" do
378
- gem "parser", "~> 2.7.0.100", "< 2.7.1"
379
- end
483
+ # It's important to load language module first
484
+ require "ruby-next/language"
380
485
 
381
- gem "ruby-next"
486
+ require "ruby-next/language/edge"
487
+ # or
488
+ require "ruby-next/language/proposed"
489
+
490
+ # and then activate the runtime mode
491
+ require "ruby-next/language/runtime"
492
+ # or require "ruby-next/language/bootsnap"
382
493
  ```
383
494
 
384
- **NOTE:** we don't add `parser` and `unparser` to the gem's runtime deps, 'cause they're not necessary if you only need polyfills.
495
+ - Set `RUBY_NEXT_EDGE=1` or `RUBY_NEXT_PROPOSED=1` environment variable.
385
496
 
386
- ### Installing globally via `gem`
497
+ ### Supported edge features
387
498
 
388
- You can install `ruby-next` globally by running the following commands:
499
+ - "Endless" method definition (`def foo() = 42`) ([#16746](https://bugs.ruby-lang.org/issues/16746)).
389
500
 
390
- ```sh
391
- gem install parser -v "~> 2.7.0.100" -v "< 2.7.1" --source "https://USERNAME:ACCESS_TOKEN@rubygems.pkg.github.com/ruby-next"
392
- gem install ruby-next
393
- ```
501
+ - Right-hand assignment (`13.divmod(5) => a,b`) ([#15921](https://bugs.ruby-lang.org/issues/15921))
502
+
503
+ ### Supported proposed features
504
+
505
+ - _Method reference_ operator (`.:`) ([#13581](https://bugs.ruby-lang.org/issues/13581)).
394
506
 
395
507
  ## Contributing
396
508
 
@@ -417,3 +529,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
417
529
  [next_parser]: https://github.com/ruby-next/parser
418
530
  [Bootsnap]: https://github.com/Shopify/bootsnap
419
531
  [rubocop]: https://github.com/rubocop-hq/rubocop
532
+ [backports]: https://github.com/marcandre/backports
@@ -5,11 +5,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  require "bundler/setup"
7
7
 
8
- require "ruby-next/language"
8
+ ENV["RUBY_NEXT_EDGE"] = "1"
9
+ ENV["RUBY_NEXT_PROPOSED"] = "1"
9
10
 
10
- # optional parsers
11
- require "ruby-next/language/rewriters/method_reference"
12
- RubyNext::Language.rewriters << RubyNext::Language::Rewriters::MethodReference
11
+ require "ruby-next/language"
12
+ require "ruby-next/language/rewriters/runtime"
13
13
 
14
14
  contents =
15
15
  if File.exist?(ARGV[0])
@@ -18,4 +18,11 @@ contents =
18
18
  ARGV[0]
19
19
  end
20
20
 
21
- puts RubyNext::Language.transform(contents)
21
+ opts =
22
+ if ARGV[1] && ARGV[1] == "--current"
23
+ {rewriters: RubyNext::Language.current_rewriters}
24
+ else
25
+ {}
26
+ end
27
+
28
+ puts RubyNext::Language.transform(contents, **opts)
@@ -11,10 +11,10 @@ module RubyNext
11
11
 
12
12
  # Defines last minor version for every major version
13
13
  LAST_MINOR_VERSIONS = {
14
- 2 => 7
14
+ 2 => 8
15
15
  }.freeze
16
16
 
17
- LATEST_VERSION = [2, 7].freeze
17
+ LATEST_VERSION = [2, 8].freeze
18
18
 
19
19
  class << self
20
20
  def next_version(version = RUBY_VERSION)
@@ -34,5 +34,6 @@ module RubyNext
34
34
  end
35
35
 
36
36
  require_relative "ruby-next/core"
37
+ require_relative "ruby-next/core_ext" if RubyNext::Core.core_ext?
37
38
  require_relative "ruby-next/logging"
38
39
  end