ruby-next 0.10.3 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +14 -14
  4. metadata +14 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13bd3de07b288ceab89e02d629db39c0946fb93be30c84806d945f923b549ab2
4
- data.tar.gz: 331bfca63292c880faadfe2d74ced0132320a55053305898e0a01025fb412f5c
3
+ metadata.gz: 2080439e0c5896a9024364465b3787c36c3a846196b274a7e72643c595523701
4
+ data.tar.gz: d74697e6e53f87343d38e7551568f62bfa1308f3ff756e090c295d14096511b5
5
5
  SHA512:
6
- metadata.gz: 1abb1c61664fa3c52a7af52618de02dd47b99c644fa305a085b6c1302d7329ce7c9f7d43470679d9e644baf1e8e3062f871769e2e68e6fa22b6d396e40270411
7
- data.tar.gz: 576682f808e5ab8eebc0ff1314b5a49dca222bdbe59190c9dcdac9883ad368a1cf16334d621986439954a37fc31dabac29737e03156bf65d9ace3973a2179ab1
6
+ metadata.gz: ef32fbe5c565e046a8913b6c71bab3021296c1002b5a314167392cd09b8d7d58085e71461b16e5cb3ef1935f6c9af926cc982793cce15ec2a2ca8dd3821f4fe4
7
+ data.tar.gz: 4004bcbd3f131ef74b28697b1c32dc253608a4c1b821568c0584acf51115cd2626ec3f97cfcb1269e7ead9093cee5fb600bd96f9d67112cf23757321801678ff
@@ -2,6 +2,50 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.12.0 (2021-01-12)
6
+
7
+ - Added required keyword arguments rewriter. ([@palkan][])
8
+
9
+ Required kwargs were introduced in 2.1. Now we make them possible in 2.0.
10
+
11
+ - Added numeric literals rewriter. ([@palkan][])
12
+
13
+ Now it's possible to generate Ruby 2.0 compatible code from `2i + 1/3r`.
14
+
15
+ - Fixed several safe navigation (`&.`) bugs. ([@palkan][])
16
+
17
+ See [#68](https://github.com/ruby-next/ruby-next/issues/68) and [#69](https://github.com/ruby-next/ruby-next/issues/69).
18
+
19
+ ## 0.11.1 (2020-12-28)
20
+
21
+ - Use separate _namespace_ for proposed features to avoid conflicts with new Ruby version. ([@palkan][])
22
+
23
+ Previously, we used the upcoming Ruby version number for proposed features (e.g., `3.0.0`), which broke
24
+ the load path setup, since transpiled files were not loaded anymore.
25
+ Now that's fixed by using a _virtual_ version number for proposals (`1995.next.0`).
26
+
27
+ ## 0.11.0 (2020-12-24) 🎄
28
+
29
+ - Extended proposed shorthand Hash syntax to support kwargs as well. ([@palkan][])
30
+
31
+ You can try it: `x = 1; y = 2; foo(x:, y:) # => foo(x: x, y: y)`.
32
+
33
+ - **Rewrite mode is used by default in transpiler**. ([@palkan][])
34
+
35
+ - Move 3.0 features to stable features. ([@palkan][])
36
+
37
+ - Refactor `a => x` and `a in x` to comply with Ruby 3.0. ([@palkan][])
38
+
39
+ ## 0.10.5 (2020-10-13)
40
+
41
+ - Fix Unparser 0.5.0 compatibility. ([@palkan][])
42
+
43
+ ## 0.10.4 (2020-10-09)
44
+
45
+ - Restrict Unparser dependency. ([@palkan][])
46
+
47
+ Unparser 0.5.0 is currently not supported.
48
+
5
49
  ## 0.10.3 (2020-09-28)
6
50
 
7
51
  - Update RuboCop integration to handle the latest Parser changes. ([@palkan][])
data/README.md CHANGED
@@ -35,6 +35,7 @@ Read more about the motivation behind the Ruby Next in this post: [Ruby Next: Ma
35
35
  ## Examples
36
36
 
37
37
  - Ruby gems
38
+ - [action_policy](https://github.com/palkan/action_policy)
38
39
  - [anyway_config](https://github.com/palkan/anyway_config)
39
40
  - [graphql-fragment_cache](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache)
40
41
  - Rails applications
@@ -92,8 +93,7 @@ def greet(val) =
92
93
  '👽'
93
94
  end
94
95
 
95
- greet(hello: 'martian') => greeting
96
- puts greeting
96
+ puts greet(hello: 'martian')
97
97
  "
98
98
 
99
99
  => 👽
@@ -178,17 +178,17 @@ In the AST mode, we parse the source code into AST, modifies this AST and **gene
178
178
 
179
179
  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).
180
180
 
181
- By default, we use the AST mode. That could likely change in the future when we collect enough feedback on the rewrite mode and fix potential bugs.
182
-
183
181
  The main benefit of the rewrite mode is that it preserves the original code line numbers and layout, which is especially useful in debugging.
184
182
 
183
+ By default, we use the rewrite mode. If you found a bug with rewrite mode which is not reproducible in the AST mode, please, let us know.
184
+
185
185
  You can change the transpiler mode:
186
186
 
187
187
  - From code by setting `RubyNext::Language.mode = :ast` or `RubyNext::Language.mode = :rewrite`.
188
- - Via environmental variable `RUBY_NEXT_TRANSPILE_MODE=rewrite`.
188
+ - Via environmental variable `RUBY_NEXT_TRANSPILE_MODE=ast`.
189
189
  - Via CLI option ([see below](#cli)).
190
190
 
191
- **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+.
191
+ **NOTE:** For the time being, Unparser doesn't support Ruby 3.0 AST nodes, so we always use rewrite mode in Ruby 3.0+.
192
192
 
193
193
  ## CLI
194
194
 
@@ -219,7 +219,7 @@ Usage: ruby-next nextify DIRECTORY_OR_FILE [options]
219
219
 
220
220
  The behaviour depends on whether you transpile a single file or a directory:
221
221
 
222
- - When transpiling a directory, the `.rbnext` subfolder is created within the target folder with subfolders for each supported Ruby versions (e.g., `.rbnext/2.6`, `.rbnext/2.7`). If you want to create only a single version (the smallest), you can also pass `--single-version` flag. In that case, no version directory is created (i.e., transpiled files go into `.rbnext`).
222
+ - When transpiling a directory, the `.rbnext` subfolder is created within the target folder with subfolders for each supported Ruby versions (e.g., `.rbnext/2.6`, `.rbnext/2.7`, `.rbnext/3.0`). If you want to create only a single version (the smallest), you can also pass `--single-version` flag. In that case, no version directory is created (i.e., transpiled files go into `.rbnext`).
223
223
 
224
224
  - When transpiling a file and providing the output path as a _file_ path, only a single version is created. For example:
225
225
 
@@ -322,7 +322,7 @@ due to the way feature resolving works in Ruby (scanning the `$LOAD_PATH` and ha
322
322
 
323
323
  If you're using [runtime mode](#runtime-usage) a long with `setup_gem_load_path` (e.g., in tests), the transpiled files are ignored (i.e., we do not modify `$LOAD_PATH`).
324
324
 
325
- \* 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).
325
+ \* 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`, `.rbnext/2.7`, and `.rbnext/3.0` in the specified order for Ruby 2.5, and `.rbnext/2.7` and `.rbnext/3.0` for Ruby 2.6).
326
326
 
327
327
  ### Transpiled files vs. VCS vs. installing from source
328
328
 
@@ -445,6 +445,8 @@ AllCops:
445
445
 
446
446
  We currently provide support for Ruby 2.2, 2.3 and 2.4.
447
447
 
448
+ **NOTE:** By "support" here we mean using `ruby-next` CLI and runtime transpiling. Transpiled code may run on Ruby 2.0+.
449
+
448
450
  Ruby Next itself relies on 2.5 features and contains polyfills only for version 2.5+ (and that won't change).
449
451
  Thus, to make it work with <2.5 we need to backport some APIs ourselves.
450
452
 
@@ -475,6 +477,8 @@ RUBY_NEXT_CORE_STRATEGY=backports ruby-next nextify lib/
475
477
 
476
478
  **NOTE:** For Ruby 2.2, safe navigation operator (`&.`) and squiggly heredocs (`<<~TXT`) support is provided.
477
479
 
480
+ **IMPORTANT:** Unparser `~> 0.4.8` is required to run the transpiler on Ruby <2.4.
481
+
478
482
  ## Proposed and edge features
479
483
 
480
484
  Ruby Next aims to bring edge and proposed features to Ruby community before they (hopefully) reach an official Ruby release.
@@ -506,17 +510,13 @@ require "ruby-next/language/runtime"
506
510
 
507
511
  ### Supported edge features
508
512
 
509
- - "Endless" method definition (`def foo() = 42`) ([#16746](https://bugs.ruby-lang.org/issues/16746)).
510
-
511
- - Right-hand assignment (`13.divmod(5) => a,b`) ([#15921](https://bugs.ruby-lang.org/issues/15921)).
512
-
513
- - Find pattern (`[0, 1, 2] in [*, 1 => a, *c]`) ([#16828](https://bugs.ruby-lang.org/issues/16828)).
513
+ No new features since 3.0 release.
514
514
 
515
515
  ### Supported proposed features
516
516
 
517
517
  - _Method reference_ operator (`.:`) ([#13581](https://bugs.ruby-lang.org/issues/13581)).
518
518
 
519
- - Shorthand Hash notation (`data = {x, y}`) ([#15236](https://bugs.ruby-lang.org/issues/15236)).
519
+ - Shorthand Hash/kwarg notation (`data = {x, y}` or `foo(x:, y:)`) ([#15236](https://bugs.ruby-lang.org/issues/15236)).
520
520
 
521
521
  ## Contributing
522
522
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-next
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-28 00:00:00.000000000 Z
11
+ date: 2021-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.3
19
+ version: 0.12.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.3
26
+ version: 0.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-next-parser
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0.1
33
+ version: 3.0.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0.1
40
+ version: 3.0.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: unparser
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.8
47
+ version: 0.5.6
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: 0.6.0
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - ">="
53
56
  - !ruby/object:Gem::Version
54
- version: 0.4.8
57
+ version: 0.5.6
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.6.0
55
61
  description: "\n Ruby Next is a collection of polyfills and a transpiler for supporting
56
62
  latest and upcoming edge CRuby features\n in older versions and alternative implementations
57
63
  (such as mruby, JRuby, Opal, Artichoke, RubyMotion, etc.).\n "