ruby-next 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +45 -36
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b1c1af8cbe6211f553a3111863bf727e7438220174dc3d5b1126fdd46c5c5ba
|
4
|
+
data.tar.gz: 66fe1d334298706ec37cc73af042b83f6e770f8888b8a2a9227b1950d139df23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a24a83d3f705da786d64878bf87c9375685508e6eb9c69b84144d02d005733fc92ff58adafa89d49721b75983ff4b8d1c8f193cd02868b613f6dc829e04907c
|
7
|
+
data.tar.gz: 0c5aa1e100aec167c965c13330fc4fa71ac0210233ee800ed09ddf0cf0256b97aa52ab6cfc0d210e5aa8d19bb2220d21766f90761edb3be271efbda922adae39
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.6.0 (2020-04-23)
|
6
|
+
|
7
|
+
- Changed the way edge/proposed features are activated. ([@palkan][])
|
8
|
+
|
9
|
+
Use `--edge` or `--proposed` flags for `ruby-next nextify` or
|
10
|
+
`require "ruby-next/language/{edge,proposed}"` in your code.
|
11
|
+
|
12
|
+
See more in the [Readme](./README.md#proposed-and-edge-features).
|
13
|
+
|
14
|
+
- Updated RuboCop integration. ([@palkan][])
|
15
|
+
|
16
|
+
Make sure you use `TargetRubyVersion: next` in your RuboCop configuration.
|
17
|
+
|
18
|
+
- Upgraded to `ruby-next-parser` for edge features. ([@palkan][])
|
19
|
+
|
20
|
+
It's no longer needed to use Parser gem from Ruby Next package registry.
|
21
|
+
|
5
22
|
## 0.5.3 (2020-03-25)
|
6
23
|
|
7
24
|
- Enhance logging. ([@palkan][])
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ That's why Ruby Next implements the `master` features as fast as possible.
|
|
27
27
|
## Table of contents
|
28
28
|
|
29
29
|
- [Overview](#overview)
|
30
|
+
- [Quick Start](#quick-start)
|
30
31
|
- [Polyfills](#using-only-polyfills)
|
31
32
|
- [Transpiling](#transpiling)
|
32
33
|
- [Modes](#transpiler-modes)
|
@@ -51,6 +52,27 @@ programmatically or via CLI. It also could be done in runtime.
|
|
51
52
|
Currently, Ruby Next supports Ruby versions 2.5+ (including JRuby 9.2.8+).
|
52
53
|
Please, [open an issue](https://github.com/ruby-next/ruby-next/issues/new/choose) if you would like us to support older Ruby versions.
|
53
54
|
|
55
|
+
## Quick start
|
56
|
+
|
57
|
+
The quickest way to start experimenting with Ruby Next is to install the gem and run a sample script. For example:
|
58
|
+
|
59
|
+
```sh
|
60
|
+
# Install Ruby Next globally
|
61
|
+
$ gem install ruby-next
|
62
|
+
|
63
|
+
# Call ruby with -ruby-next flag
|
64
|
+
$ ruby -ruby-next -e "
|
65
|
+
case {hello: 'martian'}
|
66
|
+
in hello: hello if hello =~ /human/
|
67
|
+
puts '🙂'
|
68
|
+
in hello: 'martian'
|
69
|
+
puts '👽'
|
70
|
+
end
|
71
|
+
"
|
72
|
+
|
73
|
+
=> 👽
|
74
|
+
```
|
75
|
+
|
54
76
|
## Using only polyfills
|
55
77
|
|
56
78
|
First, install a gem:
|
@@ -79,7 +101,7 @@ using RubyNext
|
|
79
101
|
|
80
102
|
Ruby Next only refines core classes if necessary; thus, this line wouldn't have any effect in the edge Ruby.
|
81
103
|
|
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
|
104
|
+
**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
105
|
|
84
106
|
Alternatively, you can go with monkey-patches. Just add this line:
|
85
107
|
|
@@ -124,7 +146,7 @@ gem install ruby-next
|
|
124
146
|
|
125
147
|
Ruby Next currently provides two different modes of generating transpiled code: _AST_ and _rewrite_.
|
126
148
|
|
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
|
149
|
+
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
150
|
|
129
151
|
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
152
|
|
@@ -292,10 +314,12 @@ To enable this integration, add the following line after the `require "bootsnap/
|
|
292
314
|
require "ruby-next/language/bootsnap"
|
293
315
|
```
|
294
316
|
|
295
|
-
**NOTE:**
|
317
|
+
**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
318
|
|
297
319
|
## `uby-next`
|
298
320
|
|
321
|
+
_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._
|
322
|
+
|
299
323
|
You can also enable runtime mode by requiring `uby-next` while running a Ruby executable:
|
300
324
|
|
301
325
|
```sh
|
@@ -328,7 +352,7 @@ require:
|
|
328
352
|
- ruby-next/rubocop
|
329
353
|
```
|
330
354
|
|
331
|
-
|
355
|
+
You must set `TargetRubyVersion: next` to make RuboCop use a Ruby Next parser.
|
332
356
|
|
333
357
|
Alternatively, you can load the patch from the command line by running: `rubocop -r ruby-next/rubocop ...`.
|
334
358
|
|
@@ -349,48 +373,33 @@ This includes:
|
|
349
373
|
- Features proposed in [Ruby bug tracker](https://bugs.ruby-lang.org/) (_proposed_)
|
350
374
|
- Features once merged to master but got reverted.
|
351
375
|
|
352
|
-
These features
|
376
|
+
These features are disabled by default, you must opt-in in one of the following ways:
|
353
377
|
|
354
|
-
|
378
|
+
- Add `--edge` or `--proposed` option to `nextify` command when using CLI.
|
379
|
+
- Enable programmatically when using a runtime mode:
|
355
380
|
|
356
|
-
|
357
|
-
|
358
|
-
-
|
359
|
-
|
360
|
-
### Prerequisites
|
361
|
-
|
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.
|
363
|
-
|
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).
|
365
|
-
|
366
|
-
### Installing with Bundler
|
381
|
+
```ruby
|
382
|
+
# It's important to load language module first
|
383
|
+
require "ruby-next/language"
|
367
384
|
|
368
|
-
|
385
|
+
require "ruby-next/language/edge"
|
386
|
+
# or
|
387
|
+
require "ruby-next/language/proposed"
|
369
388
|
|
370
|
-
|
371
|
-
|
389
|
+
# and then activate the runtime mode
|
390
|
+
require "ruby-next/language/runtime"
|
391
|
+
# or require "ruby-next/language/bootsnap"
|
372
392
|
```
|
373
393
|
|
374
|
-
|
375
|
-
|
376
|
-
```ruby
|
377
|
-
source "https://rubygems.pkg.github.com/ruby-next" do
|
378
|
-
gem "parser", "~> 2.7.0.100", "< 2.7.1"
|
379
|
-
end
|
380
|
-
|
381
|
-
gem "ruby-next"
|
382
|
-
```
|
394
|
+
- Set `RUBY_NEXT_EDGE=1` or `RUBY_NEXT_PROPOSED=1` environment variable.
|
383
395
|
|
384
|
-
|
396
|
+
### Supported edge features
|
385
397
|
|
386
|
-
|
398
|
+
Not yet.
|
387
399
|
|
388
|
-
|
400
|
+
### Supported proposed features
|
389
401
|
|
390
|
-
|
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
|
-
```
|
402
|
+
- _Method reference_ operator (`.:`) ([link](https://bugs.ruby-lang.org/issues/13581)).
|
394
403
|
|
395
404
|
## Contributing
|
396
405
|
|
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.
|
4
|
+
version: 0.6.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-
|
11
|
+
date: 2020-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-next-core
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: parser
|
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: 2.
|
33
|
+
version: 2.8.0.0
|
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: 2.
|
40
|
+
version: 2.8.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: unparser
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|