tapioca 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6051054b5414fe5f3383fa6fefc8fabdfd426380c026f55fdf87ecee8e10d964
4
- data.tar.gz: 5054dacc20c7a8881c957540d0fa624d7ec406d57f8486a9dab9e088e2d270d0
3
+ metadata.gz: 700c54640e9ef8478e5f06732407c6ea33bbaa98def51be92be7952235915dab
4
+ data.tar.gz: 391a4ca32fba379e0131b8990150f2f4e2229367aa5f49261ebd8dcbea997936
5
5
  SHA512:
6
- metadata.gz: e67122acb9f97bef99088a6dd2cded0c29a73bde763ab8acaad0fae6470ba0b1fc4d2a9139e781ca9ba569595560a743eba69dc701b0632712b31104e41ce2cf
7
- data.tar.gz: 3ebf64268dc86b2740e68d3a508fdc67d458f976028781a4a9bce95eba883d2852840560fec32d3792d7193cdd224898bdfe913ffe800ddf3d5ad7be8a914ca6
6
+ metadata.gz: a3f626991d59d0f6813ee75f72787d657b86c334ac047457049d56e3f5ba86bf71258f060e3714ba3dba0dc70a5e0ce93fcc36a96c1b07d85fa9b6ab98782675
7
+ data.tar.gz: b93d8431e3486f2681cd388c69fb68016a470bf67571ecca77fe493567b0fcf49ad2d68250881cd9bf4f6700e7ccb3c33d756c5c2ee03785d58c3618f617f48c
@@ -25,6 +25,7 @@ module Tapioca
25
25
  sig { void }
26
26
  def initialize
27
27
  @processable_constants = T.let(Set.new(gather_constants), T::Set[Module])
28
+ @processable_constants.compare_by_identity
28
29
  @errors = T.let([], T::Array[String])
29
30
  end
30
31
 
@@ -37,6 +37,8 @@ module Tapioca
37
37
  sig { params(blk: T.proc.params(constant: Module, rbi: RBI::File).void).void }
38
38
  def run(&blk)
39
39
  constants_to_process = gather_constants(requested_constants)
40
+ .select { |c| Reflection.name_of(c) && Module === c } # Filter anonymous or value constants
41
+ .sort_by! { |c| T.must(Reflection.name_of(c)) }
40
42
 
41
43
  if constants_to_process.empty?
42
44
  report_error(<<~ERROR)
@@ -45,7 +47,7 @@ module Tapioca
45
47
  ERROR
46
48
  end
47
49
 
48
- constants_to_process.sort_by { |c| c.name.to_s }.each do |constant|
50
+ constants_to_process.each do |constant|
49
51
  rbi = rbi_for_constant(constant)
50
52
  next if rbi.nil?
51
53
 
@@ -168,7 +168,8 @@ module Tapioca
168
168
  comments = documentation_comments(name)
169
169
 
170
170
  if klass_name == "T::Private::Types::TypeAlias"
171
- constant = RBI::Const.new(name, "T.type_alias { #{T.unsafe(value).aliased_type} }", comments: comments)
171
+ type_alias = sanitize_signature_types(T.unsafe(value).aliased_type.to_s)
172
+ constant = RBI::Const.new(name, "T.type_alias { #{type_alias} }", comments: comments)
172
173
  tree << constant
173
174
  return
174
175
  end
@@ -229,7 +230,8 @@ module Tapioca
229
230
 
230
231
  sig { params(tree: RBI::Tree, constant: Module).void }
231
232
  def compile_module_helpers(tree, constant)
232
- abstract_type = T::Private::Abstract::Data.get(constant, :abstract_type)
233
+ abstract_type = T::Private::Abstract::Data.get(constant, :abstract_type) ||
234
+ T::Private::Abstract::Data.get(singleton_class_of(constant), :abstract_type)
233
235
 
234
236
  tree << RBI::Helper.new(abstract_type.to_s) if abstract_type
235
237
  tree << RBI::Helper.new("final") if T::Private::Final.final_module?(constant)
@@ -51,18 +51,27 @@ module Tapioca
51
51
  def generate
52
52
  require_gem_file
53
53
 
54
- gems_to_generate(@gem_names)
55
- .reject { |gem| @gem_excludes.include?(gem.name) }
56
- .each do |gem|
57
- say("Processing '#{gem.name}' gem:", :green)
58
- shell.indent do
59
- compile_gem_rbi(gem)
60
- puts
61
- end
54
+ gems_to_process = gems_to_generate(@gem_names).reject { |gem| @gem_excludes.include?(gem.name) }
55
+
56
+ anything_done = [
57
+ perform_removals,
58
+ gems_to_process.any?,
59
+ ].any?
60
+
61
+ gems_to_process.each do |gem|
62
+ say("Processing '#{gem.name}' gem:", :green)
63
+ shell.indent do
64
+ compile_gem_rbi(gem)
65
+ puts
62
66
  end
67
+ end
63
68
 
64
- say("All operations performed in working directory.", [:green, :bold])
65
- say("Please review changes and commit them.", [:green, :bold])
69
+ if anything_done
70
+ say("All operations performed in working directory.", [:green, :bold])
71
+ say("Please review changes and commit them.", [:green, :bold])
72
+ else
73
+ say("No operations performed, all RBIs are up-to-date.", [:green, :bold])
74
+ end
66
75
  end
67
76
 
68
77
  sig { params(should_verify: T::Boolean).void }
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.5.5"
5
+ VERSION = "0.5.6"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapioca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-11-25 00:00:00.000000000 Z
14
+ date: 2021-12-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler