parlour 8.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +14 -0
- data/exe/parlour +1 -1
- data/lib/parlour/rbi_generator/attribute.rb +2 -2
- data/lib/parlour/rbi_generator/class_namespace.rb +1 -1
- data/lib/parlour/rbi_generator/enum_class_namespace.rb +1 -1
- data/lib/parlour/rbi_generator/module_namespace.rb +1 -1
- data/lib/parlour/rbi_generator/struct_class_namespace.rb +1 -1
- data/lib/parlour/rbs_generator/attribute.rb +2 -2
- data/lib/parlour/rbs_generator/class_namespace.rb +1 -1
- data/lib/parlour/type_parser.rb +14 -1
- data/lib/parlour/version.rb +1 -1
- data/parlour.gemspec +1 -1
- 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: 8988bf8b6435625031d284916803461e688cc3b28a755da9918cd3d83189f260
|
4
|
+
data.tar.gz: ff851e34b9f7a85fdfb11db892a0d7ef692337157125ad0bab14856e7e67ced2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e173ea6f2d50139c1fbd143d2eedafc1e7ed8eb9c757b4f1cc177033c08676b9feca6c3f5bbf04a37e3a41b51abb0d52414aeab5957f42649d21a41d471bcb3
|
7
|
+
data.tar.gz: a17dbc4f7731d531b3603e2f57cab06636ded32fbe187902e930c786ba263d2be4405ad3de92c7e286f6a06c17c1968230d3e2f0ec26d1d7ba24242623a6bbea
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
5
5
|
|
6
|
+
## [9.0.0] - 2024-06-04
|
7
|
+
### Changed
|
8
|
+
- Updated Commander dependency to 5.0, to remove `abbrev` deprecation warning.
|
9
|
+
**As a result, the minimum supported Ruby version is now 3.0.**
|
10
|
+
|
11
|
+
## [8.1.0] - 2023-01-01
|
12
|
+
### Added
|
13
|
+
- Parsed method definitions can now have a modifier before the `def` keyword.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Use `File#exist?` instead of `File#exists?` in CLI, fixing an exception on
|
17
|
+
Ruby 3.2.0.
|
18
|
+
- Resolved incorrect code generation for `T::Enum`s with only one variant.
|
19
|
+
|
6
20
|
## [8.0.0] - 2022-05-10
|
7
21
|
### Changed
|
8
22
|
- The parser now loads untyped methods named `initialize` as returning `void`, rather than
|
data/exe/parlour
CHANGED
@@ -18,7 +18,7 @@ command :run do |c|
|
|
18
18
|
working_dir = Dir.pwd
|
19
19
|
config_filename = File.join(working_dir, '.parlour')
|
20
20
|
|
21
|
-
if File.
|
21
|
+
if File.exist?(config_filename)
|
22
22
|
configuration = keys_to_symbols(YAML.load_file(config_filename))
|
23
23
|
else
|
24
24
|
configuration = {}
|
@@ -36,11 +36,11 @@ module Parlour
|
|
36
36
|
@class_attribute = class_attribute
|
37
37
|
case kind
|
38
38
|
when :accessor, :reader
|
39
|
-
super(generator, name, [], type, &block)
|
39
|
+
super(generator, name, [], type, &T.cast(block, T.nilable(T.proc.params(x: Method).void)))
|
40
40
|
when :writer
|
41
41
|
super(generator, name, [
|
42
42
|
Parameter.new(name, type: type)
|
43
|
-
], type, &block)
|
43
|
+
], type, &T.cast(block, T.nilable(T.proc.params(x: Method).void)))
|
44
44
|
else
|
45
45
|
raise 'unknown kind'
|
46
46
|
end
|
@@ -31,7 +31,7 @@ module Parlour
|
|
31
31
|
# @param block A block which the new instance yields itself to.
|
32
32
|
# @return [void]
|
33
33
|
def initialize(generator, name, final, sealed, superclass, abstract, &block)
|
34
|
-
super(generator, name, final, sealed, &block)
|
34
|
+
super(generator, name, final, sealed, &T.cast(block, T.nilable(T.proc.params(x: Namespace).void)))
|
35
35
|
@superclass = superclass
|
36
36
|
@abstract = abstract
|
37
37
|
end
|
@@ -30,7 +30,7 @@ module Parlour
|
|
30
30
|
# @param block A block which the new instance yields itself to.
|
31
31
|
# @return [void]
|
32
32
|
def initialize(generator, name, final, sealed, enums, abstract, &block)
|
33
|
-
super(generator, name, final, sealed, 'T::Enum', abstract, &block)
|
33
|
+
super(generator, name, final, sealed, 'T::Enum', abstract, &T.cast(block, T.nilable(T.proc.params(x: Namespace).void)))
|
34
34
|
@enums = enums
|
35
35
|
end
|
36
36
|
|
@@ -31,7 +31,7 @@ module Parlour
|
|
31
31
|
# @param block A block which the new instance yields itself to.
|
32
32
|
# @return [void]
|
33
33
|
def initialize(generator, name, final, sealed, interface, abstract, &block)
|
34
|
-
super(generator, name, final, sealed, &block)
|
34
|
+
super(generator, name, final, sealed, &T.cast(block, T.nilable(T.proc.params(x: Namespace).void)))
|
35
35
|
@name = name
|
36
36
|
@interface = interface
|
37
37
|
@abstract = abstract
|
@@ -31,7 +31,7 @@ module Parlour
|
|
31
31
|
# @param block A block which the new instance yields itself to.
|
32
32
|
# @return [void]
|
33
33
|
def initialize(generator, name, final, sealed, props, abstract, &block)
|
34
|
-
super(generator, name, final, sealed, 'T::Struct', abstract, &block)
|
34
|
+
super(generator, name, final, sealed, 'T::Struct', abstract, &T.cast(block, T.nilable(T.proc.params(x: Namespace).void)))
|
35
35
|
@props = props
|
36
36
|
end
|
37
37
|
|
@@ -29,11 +29,11 @@ module Parlour
|
|
29
29
|
@kind = kind
|
30
30
|
case kind
|
31
31
|
when :accessor, :reader
|
32
|
-
super(generator, name, [MethodSignature.new([], type)], &block)
|
32
|
+
super(generator, name, [MethodSignature.new([], type)], &T.cast(block, T.nilable(T.proc.params(x: Method).void)))
|
33
33
|
when :writer
|
34
34
|
super(generator, name, [MethodSignature.new([
|
35
35
|
Parameter.new(name, type: type)
|
36
|
-
], type)], &block)
|
36
|
+
], type)], &T.cast(block, T.nilable(T.proc.params(x: Method).void)))
|
37
37
|
else
|
38
38
|
raise 'unknown kind'
|
39
39
|
end
|
@@ -25,7 +25,7 @@ module Parlour
|
|
25
25
|
# @param block A block which the new instance yields itself to.
|
26
26
|
# @return [void]
|
27
27
|
def initialize(generator, name, superclass, &block)
|
28
|
-
super(generator, name, &block)
|
28
|
+
super(generator, name, &T.cast(block, T.nilable(T.proc.params(x: Namespace).void)))
|
29
29
|
@superclass = superclass
|
30
30
|
end
|
31
31
|
|
data/lib/parlour/type_parser.rb
CHANGED
@@ -245,7 +245,16 @@ module Parlour
|
|
245
245
|
(body.type == :begin ? body.to_a : [body]).find { |x| x.type == :block && x.to_a[0].type == :send && x.to_a[0].to_a[1] == :enums }
|
246
246
|
|
247
247
|
# Find the constant assigments within this block
|
248
|
-
|
248
|
+
# (If there's only one constant assignment, then that `casgn` node
|
249
|
+
# will be a direct child, not wrapped in a body)
|
250
|
+
enum_inner = enums_node.to_a[2]
|
251
|
+
if enum_inner.nil?
|
252
|
+
constant_nodes = []
|
253
|
+
elsif enum_inner.type == :begin
|
254
|
+
constant_nodes = enum_inner.to_a
|
255
|
+
else
|
256
|
+
constant_nodes = [enum_inner]
|
257
|
+
end
|
249
258
|
|
250
259
|
# Convert this to an array to enums as EnumClassNamespace expects
|
251
260
|
enums = constant_nodes.map do |constant_node|
|
@@ -490,6 +499,10 @@ module Parlour
|
|
490
499
|
# A :def node represents a definition like "def x; end"
|
491
500
|
# A :defs node represents a definition like "def self.x; end"
|
492
501
|
def_node = path.sibling(1).traverse(ast)
|
502
|
+
if def_node.type == :send && [:def, :defs].include?(def_node.children.last.type)
|
503
|
+
# bypass inline modifier (e.g. "private")
|
504
|
+
def_node = def_node.children.last
|
505
|
+
end
|
493
506
|
case def_node.type
|
494
507
|
when :def
|
495
508
|
class_method = false
|
data/lib/parlour/version.rb
CHANGED
data/parlour.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency "sorbet-runtime", ">= 0.5"
|
26
26
|
spec.add_dependency "rainbow", "~> 3.0"
|
27
|
-
spec.add_dependency "commander", "~>
|
27
|
+
spec.add_dependency "commander", "~> 5.0"
|
28
28
|
spec.add_dependency "parser"
|
29
29
|
|
30
30
|
spec.add_development_dependency "bundler", "~> 2.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parlour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Christiansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: parser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
246
|
+
rubygems_version: 3.5.9
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: A type information generator, merger and parser for Sorbet and Ruby 3/Steep
|