parlour 3.0.0 → 5.0.0.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  3. data/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  4. data/.gitignore +1 -1
  5. data/.parlour +5 -0
  6. data/.rspec +0 -0
  7. data/.travis.yml +0 -0
  8. data/CHANGELOG.md +57 -0
  9. data/CODE_OF_CONDUCT.md +0 -0
  10. data/Gemfile +0 -0
  11. data/LICENSE.txt +0 -0
  12. data/README.md +233 -19
  13. data/Rakefile +0 -0
  14. data/exe/parlour +109 -4
  15. data/lib/parlour.rb +27 -1
  16. data/lib/parlour/conflict_resolver.rb +31 -9
  17. data/lib/parlour/conversion/converter.rb +34 -0
  18. data/lib/parlour/conversion/rbi_to_rbs.rb +223 -0
  19. data/lib/parlour/debugging.rb +0 -0
  20. data/lib/parlour/detached_rbi_generator.rb +1 -6
  21. data/lib/parlour/detached_rbs_generator.rb +25 -0
  22. data/lib/parlour/generator.rb +34 -0
  23. data/lib/parlour/kernel_hack.rb +0 -0
  24. data/lib/parlour/options.rb +71 -0
  25. data/lib/parlour/parse_error.rb +0 -0
  26. data/lib/parlour/plugin.rb +1 -1
  27. data/lib/parlour/rbi_generator.rb +24 -37
  28. data/lib/parlour/rbi_generator/arbitrary.rb +5 -2
  29. data/lib/parlour/rbi_generator/attribute.rb +14 -5
  30. data/lib/parlour/rbi_generator/class_namespace.rb +8 -3
  31. data/lib/parlour/rbi_generator/constant.rb +28 -8
  32. data/lib/parlour/rbi_generator/enum_class_namespace.rb +8 -3
  33. data/lib/parlour/rbi_generator/extend.rb +5 -2
  34. data/lib/parlour/rbi_generator/include.rb +5 -2
  35. data/lib/parlour/rbi_generator/method.rb +15 -10
  36. data/lib/parlour/rbi_generator/module_namespace.rb +7 -2
  37. data/lib/parlour/rbi_generator/namespace.rb +68 -18
  38. data/lib/parlour/rbi_generator/parameter.rb +13 -7
  39. data/lib/parlour/rbi_generator/rbi_object.rb +19 -78
  40. data/lib/parlour/rbi_generator/struct_class_namespace.rb +9 -2
  41. data/lib/parlour/rbi_generator/struct_prop.rb +12 -9
  42. data/lib/parlour/rbi_generator/type_alias.rb +101 -0
  43. data/lib/parlour/rbs_generator.rb +24 -0
  44. data/lib/parlour/rbs_generator/arbitrary.rb +92 -0
  45. data/lib/parlour/rbs_generator/attribute.rb +82 -0
  46. data/lib/parlour/rbs_generator/block.rb +49 -0
  47. data/lib/parlour/rbs_generator/class_namespace.rb +106 -0
  48. data/lib/parlour/rbs_generator/constant.rb +95 -0
  49. data/lib/parlour/rbs_generator/extend.rb +92 -0
  50. data/lib/parlour/rbs_generator/include.rb +92 -0
  51. data/lib/parlour/rbs_generator/interface_namespace.rb +34 -0
  52. data/lib/parlour/rbs_generator/method.rb +146 -0
  53. data/lib/parlour/rbs_generator/method_signature.rb +104 -0
  54. data/lib/parlour/rbs_generator/module_namespace.rb +35 -0
  55. data/lib/parlour/rbs_generator/namespace.rb +627 -0
  56. data/lib/parlour/rbs_generator/parameter.rb +146 -0
  57. data/lib/parlour/rbs_generator/rbs_object.rb +78 -0
  58. data/lib/parlour/rbs_generator/type_alias.rb +96 -0
  59. data/lib/parlour/type_loader.rb +25 -12
  60. data/lib/parlour/type_parser.rb +174 -17
  61. data/lib/parlour/typed_object.rb +87 -0
  62. data/lib/parlour/types.rb +539 -0
  63. data/lib/parlour/version.rb +1 -1
  64. data/parlour.gemspec +1 -1
  65. data/plugin_examples/foobar_plugin.rb +0 -0
  66. data/rbi/parlour.rbi +1856 -0
  67. metadata +35 -10
  68. data/lib/parlour/rbi_generator/options.rb +0 -74
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: 3.0.0
4
+ version: 5.0.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Christiansen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description:
139
+ description:
140
140
  email:
141
141
  - hello@aaronc.cc
142
142
  executables:
@@ -147,6 +147,7 @@ files:
147
147
  - ".github/ISSUE_TEMPLATE/bug-report.md"
148
148
  - ".github/ISSUE_TEMPLATE/feature-request.md"
149
149
  - ".gitignore"
150
+ - ".parlour"
150
151
  - ".rspec"
151
152
  - ".travis.yml"
152
153
  - CHANGELOG.md
@@ -158,9 +159,14 @@ files:
158
159
  - exe/parlour
159
160
  - lib/parlour.rb
160
161
  - lib/parlour/conflict_resolver.rb
162
+ - lib/parlour/conversion/converter.rb
163
+ - lib/parlour/conversion/rbi_to_rbs.rb
161
164
  - lib/parlour/debugging.rb
162
165
  - lib/parlour/detached_rbi_generator.rb
166
+ - lib/parlour/detached_rbs_generator.rb
167
+ - lib/parlour/generator.rb
163
168
  - lib/parlour/kernel_hack.rb
169
+ - lib/parlour/options.rb
164
170
  - lib/parlour/parse_error.rb
165
171
  - lib/parlour/plugin.rb
166
172
  - lib/parlour/rbi_generator.rb
@@ -174,21 +180,40 @@ files:
174
180
  - lib/parlour/rbi_generator/method.rb
175
181
  - lib/parlour/rbi_generator/module_namespace.rb
176
182
  - lib/parlour/rbi_generator/namespace.rb
177
- - lib/parlour/rbi_generator/options.rb
178
183
  - lib/parlour/rbi_generator/parameter.rb
179
184
  - lib/parlour/rbi_generator/rbi_object.rb
180
185
  - lib/parlour/rbi_generator/struct_class_namespace.rb
181
186
  - lib/parlour/rbi_generator/struct_prop.rb
187
+ - lib/parlour/rbi_generator/type_alias.rb
188
+ - lib/parlour/rbs_generator.rb
189
+ - lib/parlour/rbs_generator/arbitrary.rb
190
+ - lib/parlour/rbs_generator/attribute.rb
191
+ - lib/parlour/rbs_generator/block.rb
192
+ - lib/parlour/rbs_generator/class_namespace.rb
193
+ - lib/parlour/rbs_generator/constant.rb
194
+ - lib/parlour/rbs_generator/extend.rb
195
+ - lib/parlour/rbs_generator/include.rb
196
+ - lib/parlour/rbs_generator/interface_namespace.rb
197
+ - lib/parlour/rbs_generator/method.rb
198
+ - lib/parlour/rbs_generator/method_signature.rb
199
+ - lib/parlour/rbs_generator/module_namespace.rb
200
+ - lib/parlour/rbs_generator/namespace.rb
201
+ - lib/parlour/rbs_generator/parameter.rb
202
+ - lib/parlour/rbs_generator/rbs_object.rb
203
+ - lib/parlour/rbs_generator/type_alias.rb
182
204
  - lib/parlour/type_loader.rb
183
205
  - lib/parlour/type_parser.rb
206
+ - lib/parlour/typed_object.rb
207
+ - lib/parlour/types.rb
184
208
  - lib/parlour/version.rb
185
209
  - parlour.gemspec
186
210
  - plugin_examples/foobar_plugin.rb
211
+ - rbi/parlour.rbi
187
212
  homepage: https://github.com/AaronC81/parlour
188
213
  licenses:
189
214
  - MIT
190
215
  metadata: {}
191
- post_install_message:
216
+ post_install_message:
192
217
  rdoc_options: []
193
218
  require_paths:
194
219
  - lib
@@ -199,12 +224,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
224
  version: '0'
200
225
  required_rubygems_version: !ruby/object:Gem::Requirement
201
226
  requirements:
202
- - - ">="
227
+ - - ">"
203
228
  - !ruby/object:Gem::Version
204
- version: '0'
229
+ version: 1.3.1
205
230
  requirements: []
206
231
  rubygems_version: 3.0.3
207
- signing_key:
232
+ signing_key:
208
233
  specification_version: 4
209
- summary: An RBI generator, merger and parser for Sorbet
234
+ summary: A type information generator, merger and parser for Sorbet and Ruby 3/Steep
210
235
  test_files: []
@@ -1,74 +0,0 @@
1
- # typed: true
2
- module Parlour
3
- class RbiGenerator
4
- # A set of immutable formatting options passed to all calls of
5
- # {RbiObject#generate_rbi}.
6
- class Options
7
- extend T::Sig
8
-
9
- sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
10
- # Creates a new set of formatting options.
11
- #
12
- # @example Create Options with +break_params+ of +4+ and +tab_size+ of +2+.
13
- # Parlour::RbiGenerator::Options.new(break_params: 4, tab_size: 2)
14
- #
15
- # @param break_params [Integer] If there are at least this many parameters in a
16
- # Sorbet +sig+, then it is broken onto separate lines.
17
- # @param tab_size [Integer] The number of spaces to use per indent.
18
- # @param sort_namespaces [Boolean] Whether to sort all items within a
19
- # namespace alphabetically.
20
- # @return [void]
21
- def initialize(break_params:, tab_size:, sort_namespaces:)
22
- @break_params = break_params
23
- @tab_size = tab_size
24
- @sort_namespaces = sort_namespaces
25
- end
26
-
27
- sig { returns(Integer) }
28
- # If there are at least this many parameters in a Sorbet +sig+, then it
29
- # is broken onto separate lines.
30
- #
31
- # # With break_params: 5
32
- # sig { params(name: String, age: Integer, hobbies: T::Array(String), country: Symbol).void }
33
- #
34
- # # With break_params: 4
35
- # sig do
36
- # params(
37
- # name: String,
38
- # age: Integer,
39
- # hobbies: T::Array(String),
40
- # country: Symbol
41
- # ).void
42
- # end
43
- #
44
- # @return [Integer]
45
- attr_reader :break_params
46
-
47
- sig { returns(Integer) }
48
- # The number of spaces to use per indent.
49
- # @return [Integer]
50
- attr_reader :tab_size
51
-
52
- sig { returns(T::Boolean) }
53
- # Whether to sort all items within a namespace alphabetically.
54
- # Items which are typically grouped together, such as "include" or
55
- # "extend" calls, will remain grouped together when sorted.
56
- # If true, items are sorted by their name when the RBI is generated.
57
- # If false, items are generated in the order they are added to the
58
- # namespace.
59
- # @return [Boolean]
60
- attr_reader :sort_namespaces
61
-
62
- sig { params(level: Integer, str: String).returns(String) }
63
- # Returns a string indented to the given indent level, according to the
64
- # set {tab_size}.
65
- #
66
- # @param level [Integer] The indent level, as an integer. 0 is totally unindented.
67
- # @param str [String] The string to indent.
68
- # @return [String] The indented string.
69
- def indented(level, str)
70
- " " * (level * tab_size) + str
71
- end
72
- end
73
- end
74
- end