ruby-next 0.8.0 → 0.9.0.pre

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 +5 -0
  3. data/README.md +60 -7
  4. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5626ab449756c03ea645d47a3f7349714fa92c5ae9b47b1b397e083ffc860df
4
- data.tar.gz: c9c5a78f115b45c08975f013dd424aad52a7f18a0bd8268b609a617df0de89f2
3
+ metadata.gz: e3b24fea20ed62650b72a5588e4c3d64ddf19401225e92bb5080b12b358b2b66
4
+ data.tar.gz: d9db7ac458b8c4d05d6badf8e49203162a849d11934900cb55606e014eddd9ff
5
5
  SHA512:
6
- metadata.gz: 177deead076e6be424ca70543466897748a1663e9a68ecdd84f994b2e32a101ac8d8d029cc0f94548d7b45efe74dba8738913c600d830488e74efd7dfaa72e2c
7
- data.tar.gz: 7c97bfa0c135d06688e6e65b248f11f91882b93d365478f712fad42bc7c3134246511e6102a078b18470919dd308d2268ab16ed06c29e4847829acb6a77a9f82
6
+ metadata.gz: d7f197f195b85df6e9743f74a26f68dc6415fdada1deadcce5a88d42d455e756351dda9eeab157fb458d6c2c0dc1e06201ca6a0b9321bf01d6c20cec5a6531b4
7
+ data.tar.gz: 6ad83886980fd29b269947c251a65b5df88a71bb4d2935f1047a004db3282b85dfd04073bebd1fccd9a2302bf6beb71828d1db561ce11eade15bfeb15e5dd118
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ - Add Ruby 2.4 support. ([@palkan][])
6
+
7
+ APIs for <2.5 must be backported via [backports][] gem. Refinements are not supported.
8
+
5
9
  ## 0.8.0 (2020-05-01) 🚩
6
10
 
7
11
  - Add right-hand assignment support. ([@palkan][])
@@ -178,3 +182,4 @@ p a #=> 1
178
182
  - Add `Kernel#then`. ([@palkan][])
179
183
 
180
184
  [@palkan]: https://github.com/palkan
185
+ [backports]: https://github.com/marcandre/backports
data/README.md CHANGED
@@ -17,13 +17,29 @@ Who might be interested in Ruby Next?
17
17
  Ruby Next also aims to help the community to assess new, _experimental_, MRI features by making it easier to play with them.
18
18
  That's why Ruby Next implements the `master` features as fast as possible.
19
19
 
20
+ 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).
21
+
20
22
  <a href="https://evilmartians.com/?utm_source=ruby-next">
21
23
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
22
24
 
23
- ## Links
25
+ ## Posts
26
+
27
+ - [Ruby Next: Make all Rubies quack alike](https://evilmartians.com/chronicles/ruby-next-make-all-rubies-quack-alike)
28
+
29
+ ## Talks
24
30
 
25
31
  - [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
32
 
33
+ ## Examples
34
+
35
+ - Ruby gems
36
+ - [anyway_config](https://github.com/palkan/anyway_config)
37
+ - [graphql-fragment_cache](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache)
38
+ - mruby
39
+ - [ACLI](https://github.com/palkan/acli)
40
+
41
+ _Please, submit a PR to add your project to the list!_
42
+
27
43
  ## Table of contents
28
44
 
29
45
  - [Overview](#overview)
@@ -38,6 +54,7 @@ That's why Ruby Next implements the `master` features as fast as possible.
38
54
  - [`ruby -ruby-next`](#uby-next)
39
55
  - [Logging & Debugging](#logging-and-debugging)
40
56
  - [RuboCop](#rubocop)
57
+ - [Using with EOL Rubies](#using-with-eol-rubies)
41
58
  - [Proposed & edge features](#proposed-and-edge-features)
42
59
 
43
60
  ## Overview
@@ -49,8 +66,9 @@ Core provides **polyfills** for Ruby core classes APIs via Refinements (default
49
66
  Language is responsible for **transpiling** edge Ruby syntax into older versions. It could be done
50
67
  programmatically or via CLI. It also could be done in runtime.
51
68
 
52
- Currently, Ruby Next supports Ruby versions 2.5+ (including JRuby 9.2.8+).
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.
69
+ Currently, Ruby Next supports Ruby versions 2.4+ (including JRuby 9.2.8+). Support for EOL versions (<2.5) slightly differs though ([see below](#using-with-eol-rubies)).
70
+
71
+ 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.
54
72
 
55
73
  ## Quick start
56
74
 
@@ -297,17 +315,17 @@ If you're using [runtime mode](#runtime-usage) a long with `setup_gem_load_path`
297
315
 
298
316
  \* 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).
299
317
 
300
- ### Transpiled files vs. VSC vs. installing from source
318
+ ### Transpiled files vs. VCS vs. installing from source
301
319
 
302
320
  It's a best practice to not keep generated files in repositories. In case of Ruby Next, it's a `lib/.rbnext` folder.
303
321
 
304
- 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 VSC (e.g., `echo ".rbnext/" >> .gitignore`). That would make transpiled files available in releases without polluting your repository.
322
+ 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.
305
323
 
306
- What if someone decides to install your gem from the VSC source? They would likely face some syntax errors due to the missing transpiled files.
324
+ 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.
307
325
 
308
326
  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:
309
327
 
310
- - We in the Bundler context (since that's the most common way of installing gems from source).
328
+ - We are in the Bundler context (since that's the most common way of installing gems from source).
311
329
  - Our Gemfile contains `ruby-next` gem.
312
330
  - We use [`.rbnextrc`](#CLI-configuration-file) for transpiling options.
313
331
 
@@ -406,6 +424,40 @@ AllCops:
406
424
 
407
425
  **NOTE:** you need `ruby-next` gem available in the environment where you run RuboCop (having `ruby-next-core` is not enough).
408
426
 
427
+ ## Using with EOL Rubies
428
+
429
+ **NOTE:** Use Ruby Next `0.9.0.pre` to use this feature.
430
+
431
+ We currently provide experimental support for Ruby 2.4. Work on older Rubies (down to 2.2) is in progress.
432
+
433
+ Ruby Next itself relies on 2.5 features and contains polyfills only for version 2.5+ (and that won't change).
434
+ Thus, to make it work with <2.5 we need to backport some APIs ourselves.
435
+
436
+ The recommended way of doing this is to use [backports][] gem. You need to load backports **before Ruby Next**.
437
+
438
+ When using runtime features, you should do the following:
439
+
440
+ ```ruby
441
+ # first, require backports upto 2.5
442
+ require "backports/2.5"
443
+ # then, load Ruby Next
444
+ require "ruby-next"
445
+ # if you need 2.6+ APIs, add Ruby Next core_ext
446
+ require "ruby-next/core_ext"
447
+ # then, load runtime transpiling
448
+ require "ruby-next/language/runtime"
449
+ # or
450
+ require "ruby-next/language/bootsnap"
451
+ ```
452
+
453
+ To load backports while using `ruby-next nextify` command, you must configure the environment variable:
454
+
455
+ ```sh
456
+ RUBY_NEXT_CORE_STRATEGY=backports ruby-next nextify lib/
457
+ ```
458
+
459
+ **NOTE:** Make sure you have `backports` gem installed globally or added to your bundle (if you're using `bundle exec ruby-next ...`).
460
+
409
461
  ## Proposed and edge features
410
462
 
411
463
  Ruby Next aims to bring edge and proposed features to Ruby community before they (hopefully) reach an official Ruby release.
@@ -470,3 +522,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
470
522
  [next_parser]: https://github.com/ruby-next/parser
471
523
  [Bootsnap]: https://github.com/Shopify/bootsnap
472
524
  [rubocop]: https://github.com/rubocop-hq/rubocop
525
+ [backports]: https://github.com/marcandre/backports
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-next
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0.pre
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-05-01 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.9.0.pre
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'
26
+ version: 0.9.0.pre
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-next-parser
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,12 +81,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 2.5.0
84
+ version: 2.4.0
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ">"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 1.3.1
90
90
  requirements: []
91
91
  rubygems_version: 3.0.6
92
92
  signing_key: