ruby-next 0.6.0 → 0.7.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 +25 -0
  3. data/README.md +37 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b1c1af8cbe6211f553a3111863bf727e7438220174dc3d5b1126fdd46c5c5ba
4
- data.tar.gz: 66fe1d334298706ec37cc73af042b83f6e770f8888b8a2a9227b1950d139df23
3
+ metadata.gz: b3215bbbd87086368ad17287a6bc9b69a3fb6d5d28f3fb5364f2f85eef5a2e2e
4
+ data.tar.gz: a35527c354c57dacc97b178aaf182610dbe528e28b509e83191219c98d4647cb
5
5
  SHA512:
6
- metadata.gz: 8a24a83d3f705da786d64878bf87c9375685508e6eb9c69b84144d02d005733fc92ff58adafa89d49721b75983ff4b8d1c8f193cd02868b613f6dc829e04907c
7
- data.tar.gz: 0c5aa1e100aec167c965c13330fc4fa71ac0210233ee800ed09ddf0cf0256b97aa52ab6cfc0d210e5aa8d19bb2220d21766f90761edb3be271efbda922adae39
6
+ metadata.gz: 21acb52c5919ecf3e1950c8df15c32b1bc27d3228a6513d78fa20e5a8b6a1eb993637b447604ac6c9b38690507d2f4e3d28688df732a0a67c07cd17b0e6680cd
7
+ data.tar.gz: 0b2b034e5b3219b0f8f247d1d474950abe9e73a09eed885cb771227cb6cd8b51dc409898c603215c0b13c0fedb81572e09e81ebb122ffb3cdadf6f336d3c7b10
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## master
4
4
 
5
+ - Try to auto-transpile the source code on load in `.setup_gem_load_path` if transpiled files are missing. ([@palkan][])
6
+
7
+ This would make it possible to install gems from source if transpiled files do not exist in the repository.
8
+
9
+ - Use`./.rbnextrc` to define CLI args. ([@palkan][])
10
+
11
+ You can define CLI options in the configuration file to re-use them between environments or
12
+ simply avoid typing every time:
13
+
14
+ ```yml
15
+ # .rbnextrc
16
+ nextify: |
17
+ --transpiler-mode=rewrite
18
+ --edge
19
+ ```
20
+
21
+ - Add `--dry-run` option to CLI. ([@palkan][])
22
+
23
+ - Raise `SyntaxError` when parsing fails. ([@palkan][])
24
+
25
+ Previously, we let Parser to raise its `Parser::SyntaxError` but some exceptions
26
+ are not reported by Parser and should be handled by transpiler (and we raised `SyntaxError` in that case, as MRI does).
27
+
28
+ This change unifies the exceptions raised during transpiling.
29
+
5
30
  ## 0.6.0 (2020-04-23)
6
31
 
7
32
  - Changed the way edge/proposed features are activated. ([@palkan][])
data/README.md CHANGED
@@ -181,6 +181,7 @@ Usage: ruby-next nextify DIRECTORY_OR_FILE [options]
181
181
  --[no-]refine Do not inject `using RubyNext`
182
182
  -h, --help Print help
183
183
  -V Turn on verbose mode
184
+ --dry-run Print verbose output without generating files
184
185
  ```
185
186
 
186
187
  The behaviour depends on whether you transpile a single file or a directory:
@@ -212,6 +213,7 @@ Usage: ruby-next core_ext [options]
212
213
  -n, --name=NAME Filter extensions by name
213
214
  -h, --help Print help
214
215
  -V Turn on verbose mode
216
+ --dry-run Print verbose output without generating files
215
217
  ```
216
218
 
217
219
  The most common use-case is to backport the APIs required by pattern matching. You can do this, for example,
@@ -238,7 +240,21 @@ $ ruby-next core_ext -l --name=filter --name=deconstruct
238
240
  - StructDeconstruct
239
241
  ```
240
242
 
241
- ### Integrating into a gem development
243
+ ### CLI configuration file
244
+
245
+ 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`.
246
+
247
+ Configuration file is a YAML with commands as keys and options as multiline strings:
248
+
249
+ ```yml
250
+ # ./.rbnextrc
251
+
252
+ nextify: |
253
+ --transpiler-mode=rewrite
254
+ --edge
255
+ ```
256
+
257
+ ## Integrating into a gem development
242
258
 
243
259
  We recommend _pre-transpiling_ source code to work with older versions before releasing it.
244
260
 
@@ -275,6 +291,24 @@ If you're using [runtime mode](#runtime-usage) a long with `setup_gem_load_path`
275
291
 
276
292
  \* 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).
277
293
 
294
+ ### Transpiled files vs. VSC vs. installing from source
295
+
296
+ It's a best practice to not keep generated files in repositories. In case of Ruby Next, it's a `lib/.rbnext` folder.
297
+
298
+ 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.
299
+
300
+ 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.
301
+
302
+ 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:
303
+
304
+ - We in the Bundler context (since that's the most common way of installing gems from source).
305
+ - Our Gemfile contains `ruby-next` gem.
306
+ - We use [`.rbnextrc`](#CLI-configuration-file) for transpiling options.
307
+
308
+ If the command fails we warn the end user.
309
+
310
+ 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)`.
311
+
278
312
  ## Runtime usage
279
313
 
280
314
  It is also possible to transpile Ruby source code in run-time via Ruby Next.
@@ -364,6 +398,8 @@ AllCops:
364
398
  - 'lib/.rbnext/**/*'
365
399
  ```
366
400
 
401
+ **NOTE:** you need `ruby-next` gem available in the environment where you run RuboCop (having `ruby-next-core` is not enough).
402
+
367
403
  ## Proposed and edge features
368
404
 
369
405
  Ruby Next aims to bring edge and proposed features to Ruby community before they (hopefully) reach an official Ruby release.
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.6.0
4
+ version: 0.7.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-04-23 00:00:00.000000000 Z
11
+ date: 2020-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core