ruby-next-core 0.15.3 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +127 -54
  4. data/bin/mspec +11 -0
  5. data/lib/.rbnext/2.1/ruby-next/commands/nextify.rb +295 -0
  6. data/lib/.rbnext/2.1/ruby-next/core.rb +10 -2
  7. data/lib/.rbnext/2.1/ruby-next/language.rb +59 -12
  8. data/lib/.rbnext/2.3/ruby-next/commands/nextify.rb +83 -3
  9. data/lib/.rbnext/2.3/ruby-next/config.rb +79 -0
  10. data/lib/.rbnext/2.3/ruby-next/core/data.rb +163 -0
  11. data/lib/.rbnext/2.3/ruby-next/language/eval.rb +4 -4
  12. data/lib/.rbnext/2.3/ruby-next/language/rewriters/2.7/pattern_matching.rb +2 -2
  13. data/lib/.rbnext/2.3/ruby-next/language/rewriters/base.rb +6 -32
  14. data/lib/.rbnext/2.3/ruby-next/utils.rb +3 -22
  15. data/lib/.rbnext/2.6/ruby-next/core/data.rb +163 -0
  16. data/lib/.rbnext/2.7/ruby-next/core/data.rb +163 -0
  17. data/lib/.rbnext/2.7/ruby-next/core.rb +10 -2
  18. data/lib/.rbnext/2.7/ruby-next/language/paco_parsers/string_literals.rb +109 -0
  19. data/lib/.rbnext/2.7/ruby-next/language/rewriters/2.7/pattern_matching.rb +2 -2
  20. data/lib/.rbnext/2.7/ruby-next/language/rewriters/text.rb +132 -0
  21. data/lib/.rbnext/3.2/ruby-next/commands/base.rb +55 -0
  22. data/lib/.rbnext/3.2/ruby-next/language/rewriters/2.7/pattern_matching.rb +1095 -0
  23. data/lib/.rbnext/3.2/ruby-next/rubocop.rb +210 -0
  24. data/lib/ruby-next/commands/nextify.rb +85 -3
  25. data/lib/ruby-next/config.rb +29 -2
  26. data/lib/ruby-next/core/data.rb +163 -0
  27. data/lib/ruby-next/core/matchdata/deconstruct.rb +9 -0
  28. data/lib/ruby-next/core/matchdata/deconstruct_keys.rb +20 -0
  29. data/lib/ruby-next/core/matchdata/named_captures.rb +11 -0
  30. data/lib/ruby-next/core/refinement/import.rb +44 -36
  31. data/lib/ruby-next/core/time/deconstruct_keys.rb +30 -0
  32. data/lib/ruby-next/core.rb +10 -2
  33. data/lib/ruby-next/irb.rb +2 -2
  34. data/lib/ruby-next/language/bootsnap.rb +2 -25
  35. data/lib/ruby-next/language/eval.rb +4 -4
  36. data/lib/ruby-next/language/paco_parser.rb +7 -0
  37. data/lib/ruby-next/language/paco_parsers/base.rb +47 -0
  38. data/lib/ruby-next/language/paco_parsers/comments.rb +26 -0
  39. data/lib/ruby-next/language/paco_parsers/string_literals.rb +109 -0
  40. data/lib/ruby-next/language/parser.rb +31 -6
  41. data/lib/ruby-next/language/rewriters/3.0/args_forward_leading.rb +2 -2
  42. data/lib/ruby-next/language/rewriters/3.1/oneline_pattern_parensless.rb +1 -1
  43. data/lib/ruby-next/language/rewriters/3.1/shorthand_hash.rb +2 -1
  44. data/lib/ruby-next/language/rewriters/3.2/anonymous_restargs.rb +104 -0
  45. data/lib/ruby-next/language/rewriters/abstract.rb +57 -0
  46. data/lib/ruby-next/language/rewriters/base.rb +6 -32
  47. data/lib/ruby-next/language/rewriters/edge/it_param.rb +58 -0
  48. data/lib/ruby-next/language/rewriters/edge.rb +12 -0
  49. data/lib/ruby-next/language/rewriters/proposed/bind_vars_pattern.rb +3 -0
  50. data/lib/ruby-next/language/rewriters/proposed/method_reference.rb +9 -20
  51. data/lib/ruby-next/language/rewriters/text.rb +132 -0
  52. data/lib/ruby-next/language/runtime.rb +9 -86
  53. data/lib/ruby-next/language/setup.rb +5 -2
  54. data/lib/ruby-next/language/unparser.rb +5 -0
  55. data/lib/ruby-next/language.rb +59 -12
  56. data/lib/ruby-next/pry.rb +1 -1
  57. data/lib/ruby-next/rubocop.rb +2 -0
  58. data/lib/ruby-next/utils.rb +3 -22
  59. data/lib/ruby-next/version.rb +1 -1
  60. data/lib/uby-next.rb +2 -2
  61. metadata +63 -10
@@ -4,6 +4,7 @@
4
4
  # edge features and fix some bugs with 2.7+ syntax
5
5
 
6
6
  require "parser/ruby-next/version"
7
+ require "ruby-next/config"
7
8
  require "ruby-next/language/parser"
8
9
 
9
10
  module RuboCop
@@ -38,6 +39,7 @@ module RuboCop
38
39
  def parser_class(version)
39
40
  return super unless version == RUBY_NEXT_VERSION
40
41
 
42
+ require "parser/rubynext"
41
43
  Parser::RubyNext
42
44
  end
43
45
  end
@@ -4,28 +4,6 @@ module RubyNext
4
4
  module Utils
5
5
  module_function
6
6
 
7
- if $LOAD_PATH.respond_to?(:resolve_feature_path)
8
- def resolve_feature_path(feature)
9
- $LOAD_PATH.resolve_feature_path(feature)&.last
10
- rescue LoadError
11
- end
12
- else
13
- def resolve_feature_path(path)
14
- if File.file?(relative = File.expand_path(path))
15
- path = relative
16
- end
17
-
18
- path = "#{path}.rb" if File.extname(path).empty?
19
-
20
- return path if Pathname.new(path).absolute?
21
-
22
- $LOAD_PATH.find do |lp|
23
- lpath = File.join(lp, path)
24
- return File.realpath(lpath) if File.file?(lpath)
25
- end
26
- end
27
- end
28
-
29
7
  def source_with_lines(source, path)
30
8
  source.lines.map.with_index do |line, i|
31
9
  "#{(i + 1).to_s.rjust(4)}: #{line}"
@@ -36,6 +14,7 @@ module RubyNext
36
14
 
37
15
  # Returns true if modules refinement is supported in current version
38
16
  def refine_modules?
17
+ save_verbose, $VERBOSE = $VERBOSE, nil
39
18
  @refine_modules ||=
40
19
  begin
41
20
  # Make sure that including modules within refinements works
@@ -61,6 +40,8 @@ module RubyNext
61
40
  true
62
41
  rescue TypeError, NoMethodError
63
42
  false
43
+ ensure
44
+ $VERBOSE = save_verbose
64
45
  end
65
46
  end
66
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyNext
4
- VERSION = "0.15.3"
4
+ VERSION = "1.0.1"
5
5
  end
data/lib/uby-next.rb CHANGED
@@ -9,7 +9,7 @@ require "ruby-next/core/runtime"
9
9
 
10
10
  using RubyNext
11
11
 
12
- RubyNext::Language.watch_dirs << Dir.pwd
12
+ RubyNext::Language.include_patterns << File.join(Dir.pwd, ".rb")
13
13
 
14
14
  require "stringio"
15
15
 
@@ -36,7 +36,7 @@ end
36
36
  at_exit do
37
37
  $stderr = orig_stderr
38
38
 
39
- if NoMethodError === $! || SyntaxError === $!
39
+ if NoMethodError === $! || SyntaxError === $! || NameError === $!
40
40
  if $0 && File.exist?($0)
41
41
  load($0)
42
42
  exit!(0)
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-next-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-18 00:00:00.000000000 Z
11
+ date: 2024-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: require-hooks
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: ruby-next-parser
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: 3.1.1.0
33
+ version: 3.2.2.0
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - ">="
25
39
  - !ruby/object:Gem::Version
26
- version: 3.1.1.0
40
+ version: 3.2.2.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: unparser
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,20 @@ dependencies:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
54
  version: 0.6.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: paco
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.2'
41
69
  description: "\n Ruby Next Core is a zero deps version of Ruby Next meant to be
42
70
  used\n as as dependency in your gems.\n\n It contains all the polyfills and
43
71
  utility files but doesn't require transpiler\n dependencies to be install.\n
@@ -52,14 +80,18 @@ files:
52
80
  - CHANGELOG.md
53
81
  - LICENSE.txt
54
82
  - README.md
83
+ - bin/mspec
55
84
  - bin/parse
56
85
  - bin/reparse
57
86
  - bin/ruby-next
58
87
  - bin/transform
88
+ - lib/.rbnext/2.1/ruby-next/commands/nextify.rb
59
89
  - lib/.rbnext/2.1/ruby-next/core.rb
60
90
  - lib/.rbnext/2.1/ruby-next/language.rb
61
91
  - lib/.rbnext/2.3/ruby-next/commands/core_ext.rb
62
92
  - lib/.rbnext/2.3/ruby-next/commands/nextify.rb
93
+ - lib/.rbnext/2.3/ruby-next/config.rb
94
+ - lib/.rbnext/2.3/ruby-next/core/data.rb
63
95
  - lib/.rbnext/2.3/ruby-next/language/eval.rb
64
96
  - lib/.rbnext/2.3/ruby-next/language/rewriters/2.6/endless_range.rb
65
97
  - lib/.rbnext/2.3/ruby-next/language/rewriters/2.7/args_forward.rb
@@ -67,8 +99,15 @@ files:
67
99
  - lib/.rbnext/2.3/ruby-next/language/rewriters/3.1/anonymous_block.rb
68
100
  - lib/.rbnext/2.3/ruby-next/language/rewriters/base.rb
69
101
  - lib/.rbnext/2.3/ruby-next/utils.rb
102
+ - lib/.rbnext/2.6/ruby-next/core/data.rb
70
103
  - lib/.rbnext/2.7/ruby-next/core.rb
104
+ - lib/.rbnext/2.7/ruby-next/core/data.rb
105
+ - lib/.rbnext/2.7/ruby-next/language/paco_parsers/string_literals.rb
71
106
  - lib/.rbnext/2.7/ruby-next/language/rewriters/2.7/pattern_matching.rb
107
+ - lib/.rbnext/2.7/ruby-next/language/rewriters/text.rb
108
+ - lib/.rbnext/3.2/ruby-next/commands/base.rb
109
+ - lib/.rbnext/3.2/ruby-next/language/rewriters/2.7/pattern_matching.rb
110
+ - lib/.rbnext/3.2/ruby-next/rubocop.rb
72
111
  - lib/ruby-next.rb
73
112
  - lib/ruby-next/cli.rb
74
113
  - lib/ruby-next/commands/base.rb
@@ -81,6 +120,7 @@ files:
81
120
  - lib/ruby-next/core/array/intersect.rb
82
121
  - lib/ruby-next/core/constants/frozen_error.rb
83
122
  - lib/ruby-next/core/constants/no_matching_pattern_error.rb
123
+ - lib/ruby-next/core/data.rb
84
124
  - lib/ruby-next/core/enumerable/compact.rb
85
125
  - lib/ruby-next/core/enumerable/filter.rb
86
126
  - lib/ruby-next/core/enumerable/filter_map.rb
@@ -91,7 +131,10 @@ files:
91
131
  - lib/ruby-next/core/hash/merge.rb
92
132
  - lib/ruby-next/core/integer/try_convert.rb
93
133
  - lib/ruby-next/core/kernel/then.rb
134
+ - lib/ruby-next/core/matchdata/deconstruct.rb
135
+ - lib/ruby-next/core/matchdata/deconstruct_keys.rb
94
136
  - lib/ruby-next/core/matchdata/match.rb
137
+ - lib/ruby-next/core/matchdata/named_captures.rb
95
138
  - lib/ruby-next/core/proc/compose.rb
96
139
  - lib/ruby-next/core/refinement/import.rb
97
140
  - lib/ruby-next/core/runtime.rb
@@ -101,6 +144,7 @@ files:
101
144
  - lib/ruby-next/core/symbol/end_with.rb
102
145
  - lib/ruby-next/core/symbol/start_with.rb
103
146
  - lib/ruby-next/core/time/ceil.rb
147
+ - lib/ruby-next/core/time/deconstruct_keys.rb
104
148
  - lib/ruby-next/core/time/floor.rb
105
149
  - lib/ruby-next/core/unboundmethod/bind_call.rb
106
150
  - lib/ruby-next/core_ext.rb
@@ -108,6 +152,10 @@ files:
108
152
  - lib/ruby-next/language.rb
109
153
  - lib/ruby-next/language/bootsnap.rb
110
154
  - lib/ruby-next/language/eval.rb
155
+ - lib/ruby-next/language/paco_parser.rb
156
+ - lib/ruby-next/language/paco_parsers/base.rb
157
+ - lib/ruby-next/language/paco_parsers/comments.rb
158
+ - lib/ruby-next/language/paco_parsers/string_literals.rb
111
159
  - lib/ruby-next/language/parser.rb
112
160
  - lib/ruby-next/language/rewriters/2.1/numeric_literals.rb
113
161
  - lib/ruby-next/language/rewriters/2.1/required_kwargs.rb
@@ -129,12 +177,16 @@ files:
129
177
  - lib/ruby-next/language/rewriters/3.1/pin_vars_pattern.rb
130
178
  - lib/ruby-next/language/rewriters/3.1/refinement_import_methods.rb
131
179
  - lib/ruby-next/language/rewriters/3.1/shorthand_hash.rb
180
+ - lib/ruby-next/language/rewriters/3.2/anonymous_restargs.rb
181
+ - lib/ruby-next/language/rewriters/abstract.rb
132
182
  - lib/ruby-next/language/rewriters/base.rb
133
183
  - lib/ruby-next/language/rewriters/edge.rb
184
+ - lib/ruby-next/language/rewriters/edge/it_param.rb
134
185
  - lib/ruby-next/language/rewriters/proposed.rb
135
186
  - lib/ruby-next/language/rewriters/proposed/bind_vars_pattern.rb
136
187
  - lib/ruby-next/language/rewriters/proposed/method_reference.rb
137
188
  - lib/ruby-next/language/rewriters/runtime.rb
189
+ - lib/ruby-next/language/rewriters/text.rb
138
190
  - lib/ruby-next/language/runtime.rb
139
191
  - lib/ruby-next/language/setup.rb
140
192
  - lib/ruby-next/language/unparser.rb
@@ -147,15 +199,16 @@ files:
147
199
  - lib/uby-next.rb
148
200
  - lib/uby-next/irb.rb
149
201
  - lib/uby-next/pry.rb
150
- homepage: http://github.com/palkan/ruby-next
202
+ homepage: https://github.com/ruby-next/ruby-next
151
203
  licenses:
152
204
  - MIT
153
205
  metadata:
154
- bug_tracker_uri: http://github.com/ruby-next/ruby-next/issues
206
+ bug_tracker_uri: https://github.com/ruby-next/ruby-next/issues
155
207
  changelog_uri: https://github.com/ruby-next/ruby-next/blob/master/CHANGELOG.md
156
- documentation_uri: http://github.com/ruby-next/ruby-next/blob/master/README.md
157
- homepage_uri: http://github.com/ruby-next/ruby-next
158
- source_code_uri: http://github.com/ruby-next/ruby-next
208
+ documentation_uri: https://github.com/ruby-next/ruby-next/blob/master/README.md
209
+ homepage_uri: https://github.com/ruby-next/ruby-next
210
+ source_code_uri: https://github.com/ruby-next/ruby-next
211
+ funding_uri: https://github.com/sponsors/palkan
159
212
  post_install_message:
160
213
  rdoc_options: []
161
214
  require_paths:
@@ -171,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
224
  - !ruby/object:Gem::Version
172
225
  version: '0'
173
226
  requirements: []
174
- rubygems_version: 3.3.11
227
+ rubygems_version: 3.4.20
175
228
  signing_key:
176
229
  specification_version: 4
177
230
  summary: Ruby Next core functionality