tapioca 0.11.8 → 0.11.9

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +116 -49
  3. data/lib/tapioca/cli.rb +76 -67
  4. data/lib/tapioca/commands/{dsl.rb → abstract_dsl.rb} +32 -78
  5. data/lib/tapioca/commands/{gem.rb → abstract_gem.rb} +26 -93
  6. data/lib/tapioca/commands/annotations.rb +9 -7
  7. data/lib/tapioca/commands/check_shims.rb +2 -0
  8. data/lib/tapioca/commands/command.rb +9 -2
  9. data/lib/tapioca/commands/configure.rb +2 -2
  10. data/lib/tapioca/commands/dsl_compiler_list.rb +31 -0
  11. data/lib/tapioca/commands/dsl_generate.rb +40 -0
  12. data/lib/tapioca/commands/dsl_verify.rb +25 -0
  13. data/lib/tapioca/commands/gem_generate.rb +51 -0
  14. data/lib/tapioca/commands/gem_sync.rb +37 -0
  15. data/lib/tapioca/commands/gem_verify.rb +36 -0
  16. data/lib/tapioca/commands/require.rb +2 -0
  17. data/lib/tapioca/commands/todo.rb +21 -2
  18. data/lib/tapioca/commands.rb +8 -2
  19. data/lib/tapioca/dsl/compiler.rb +8 -4
  20. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +3 -1
  21. data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +94 -0
  22. data/lib/tapioca/dsl/compilers/active_record_columns.rb +19 -9
  23. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +3 -2
  24. data/lib/tapioca/dsl/compilers/active_support_concern.rb +1 -1
  25. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -1
  26. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +9 -2
  27. data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +208 -0
  28. data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +20 -4
  29. data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +20 -3
  30. data/lib/tapioca/dsl/pipeline.rb +6 -4
  31. data/lib/tapioca/gem/pipeline.rb +103 -36
  32. data/lib/tapioca/gemfile.rb +13 -7
  33. data/lib/tapioca/helpers/git_attributes.rb +34 -0
  34. data/lib/tapioca/helpers/test/template.rb +4 -4
  35. data/lib/tapioca/internal.rb +1 -0
  36. data/lib/tapioca/loaders/dsl.rb +11 -1
  37. data/lib/tapioca/sorbet_ext/generic_name_patch.rb +0 -27
  38. data/lib/tapioca/static/symbol_loader.rb +9 -8
  39. data/lib/tapioca/version.rb +1 -1
  40. metadata +19 -10
@@ -3,10 +3,12 @@
3
3
 
4
4
  module Tapioca
5
5
  module Commands
6
- class Dsl < CommandWithoutTracker
6
+ class AbstractDsl < CommandWithoutTracker
7
7
  include SorbetHelper
8
8
  include RBIFilesHelper
9
9
 
10
+ abstract!
11
+
10
12
  sig do
11
13
  params(
12
14
  requested_constants: T::Array[String],
@@ -16,7 +18,6 @@ module Tapioca
16
18
  exclude: T::Array[String],
17
19
  file_header: T::Boolean,
18
20
  tapioca_path: String,
19
- should_verify: T::Boolean,
20
21
  quiet: T::Boolean,
21
22
  verbose: T::Boolean,
22
23
  number_of_workers: T.nilable(Integer),
@@ -35,7 +36,6 @@ module Tapioca
35
36
  exclude:,
36
37
  file_header:,
37
38
  tapioca_path:,
38
- should_verify: false,
39
39
  quiet: false,
40
40
  verbose: false,
41
41
  number_of_workers: nil,
@@ -52,7 +52,6 @@ module Tapioca
52
52
  @exclude = exclude
53
53
  @file_header = file_header
54
54
  @tapioca_path = tapioca_path
55
- @should_verify = should_verify
56
55
  @quiet = quiet
57
56
  @verbose = verbose
58
57
  @number_of_workers = number_of_workers
@@ -65,58 +64,13 @@ module Tapioca
65
64
  super()
66
65
  end
67
66
 
68
- sig { void }
69
- def list_compilers
70
- Loaders::Dsl.load_application(
71
- tapioca_path: @tapioca_path,
72
- eager_load: @requested_constants.empty? && @requested_paths.empty?,
73
- app_root: @app_root,
74
- halt_upon_load_error: @halt_upon_load_error,
75
- )
76
-
77
- pipeline = create_pipeline
78
-
79
- say("")
80
- say("Loaded DSL compiler classes:")
81
- say("")
82
-
83
- table = pipeline.compilers.map do |compiler|
84
- status = if pipeline.active_compilers.include?(compiler)
85
- set_color("enabled", :green)
86
- else
87
- set_color("disabled", :red)
88
- end
89
-
90
- [compiler.name, status]
91
- end
92
-
93
- print_table(table, { indent: 2 })
94
- end
95
-
96
- sig { override.void }
97
- def execute
98
- Loaders::Dsl.load_application(
99
- tapioca_path: @tapioca_path,
100
- eager_load: @requested_constants.empty? && @requested_paths.empty?,
101
- app_root: @app_root,
102
- halt_upon_load_error: @halt_upon_load_error,
103
- )
104
-
105
- if @should_verify
106
- say("Checking for out-of-date RBIs...")
107
- else
108
- say("Compiling DSL RBI files...")
109
- end
110
- say("")
111
-
112
- all_requested_constants = @requested_constants + constants_from_requested_paths
113
-
114
- outpath = @should_verify ? Pathname.new(Dir.mktmpdir) : @outpath
115
- rbi_files_to_purge = existing_rbi_filenames(all_requested_constants)
67
+ private
116
68
 
117
- pipeline = create_pipeline
69
+ sig { params(outpath: Pathname, quiet: T::Boolean).returns(T::Set[Pathname]) }
70
+ def generate_dsl_rbi_files(outpath, quiet:)
71
+ existing_rbi_files = existing_rbi_filenames(all_requested_constants)
118
72
 
119
- processed_files = pipeline.run do |constant, contents|
73
+ generated_files = pipeline.run do |constant, contents|
120
74
  constant_name = T.must(Tapioca::Runtime::Reflection.name_of(constant))
121
75
 
122
76
  if @verbose && !@quiet
@@ -127,37 +81,37 @@ module Tapioca
127
81
  constant_name,
128
82
  contents,
129
83
  outpath: outpath,
130
- quiet: @should_verify || (@quiet && !@verbose),
84
+ quiet: quiet,
131
85
  )
132
- end
86
+ end.compact
133
87
 
134
- processed_files.each { |filename| rbi_files_to_purge.delete(T.must(filename)) }
88
+ files_to_purge = existing_rbi_files - generated_files
135
89
 
136
- say("")
90
+ files_to_purge
91
+ end
137
92
 
138
- if @should_verify
139
- perform_dsl_verification(outpath)
140
- else
141
- purge_stale_dsl_rbi_files(rbi_files_to_purge)
142
- say("Done", :green)
143
-
144
- if @auto_strictness
145
- say("")
146
- validate_rbi_files(
147
- command: default_command(:dsl, all_requested_constants.join(" ")),
148
- gem_dir: @gem_dir,
149
- dsl_dir: @outpath.to_s,
150
- auto_strictness: @auto_strictness,
151
- compilers: pipeline.active_compilers,
152
- )
153
- end
93
+ sig { returns(T::Array[String]) }
94
+ def all_requested_constants
95
+ @all_requested_constants ||= T.let(
96
+ @requested_constants + constants_from_requested_paths,
97
+ T.nilable(T::Array[String]),
98
+ )
99
+ end
154
100
 
155
- say("All operations performed in working directory.", [:green, :bold])
156
- say("Please review changes and commit them.", [:green, :bold])
157
- end
101
+ sig { returns(Tapioca::Dsl::Pipeline) }
102
+ def pipeline
103
+ @pipeline ||= T.let(create_pipeline, T.nilable(Tapioca::Dsl::Pipeline))
158
104
  end
159
105
 
160
- private
106
+ sig { void }
107
+ def load_application
108
+ Loaders::Dsl.load_application(
109
+ tapioca_path: @tapioca_path,
110
+ eager_load: @requested_constants.empty? && @requested_paths.empty?,
111
+ app_root: @app_root,
112
+ halt_upon_load_error: @halt_upon_load_error,
113
+ )
114
+ end
161
115
 
162
116
  sig { returns(Tapioca::Dsl::Pipeline) }
163
117
  def create_pipeline
@@ -3,14 +3,17 @@
3
3
 
4
4
  module Tapioca
5
5
  module Commands
6
- class Gem < Command
6
+ class AbstractGem < Command
7
7
  include SorbetHelper
8
8
  include RBIFilesHelper
9
9
 
10
+ abstract!
11
+
10
12
  sig do
11
13
  params(
12
14
  gem_names: T::Array[String],
13
15
  exclude: T::Array[String],
16
+ include_dependencies: T::Boolean,
14
17
  prerequire: T.nilable(String),
15
18
  postrequire: String,
16
19
  typed_overrides: T::Hash[String, String],
@@ -29,6 +32,7 @@ module Tapioca
29
32
  def initialize(
30
33
  gem_names:,
31
34
  exclude:,
35
+ include_dependencies:,
32
36
  prerequire:,
33
37
  postrequire:,
34
38
  typed_overrides:,
@@ -45,6 +49,7 @@ module Tapioca
45
49
  )
46
50
  @gem_names = gem_names
47
51
  @exclude = exclude
52
+ @include_dependencies = include_dependencies
48
53
  @prerequire = prerequire
49
54
  @postrequire = postrequire
50
55
  @typed_overrides = typed_overrides
@@ -66,91 +71,38 @@ module Tapioca
66
71
  @halt_upon_load_error = halt_upon_load_error
67
72
  end
68
73
 
69
- sig { override.void }
70
- def execute
71
- Loaders::Gem.load_application(
72
- bundle: @bundle,
73
- prerequire: @prerequire,
74
- postrequire: @postrequire,
75
- default_command: default_command(:require),
76
- halt_upon_load_error: @halt_upon_load_error,
77
- )
78
-
79
- gem_queue = gems_to_generate(@gem_names).reject { |gem| @exclude.include?(gem.name) }
80
- anything_done = [
81
- perform_removals,
82
- gem_queue.any?,
83
- ].any?
84
-
85
- Executor.new(gem_queue, number_of_workers: @number_of_workers).run_in_parallel do |gem|
86
- shell.indent do
87
- compile_gem_rbi(gem)
88
- puts
89
- end
90
- end
91
-
92
- if anything_done
93
- validate_rbi_files(
94
- command: default_command(:gem, @gem_names.join(" ")),
95
- gem_dir: @outpath.to_s,
96
- dsl_dir: @dsl_dir,
97
- auto_strictness: @auto_strictness,
98
- gems: @bundle.dependencies,
99
- )
100
-
101
- say("All operations performed in working directory.", [:green, :bold])
102
- say("Please review changes and commit them.", [:green, :bold])
103
- else
104
- say("No operations performed, all RBIs are up-to-date.", [:green, :bold])
105
- end
106
- end
107
-
108
- sig { params(should_verify: T::Boolean, exclude: T::Array[String]).void }
109
- def sync(should_verify: false, exclude: [])
110
- if should_verify
111
- say("Checking for out-of-date RBIs...")
112
- say("")
113
- perform_sync_verification(exclude: exclude)
114
- return
115
- end
116
-
117
- anything_done = [
118
- perform_removals,
119
- perform_additions,
120
- ].any?
121
-
122
- if anything_done
123
- validate_rbi_files(
124
- command: default_command(:gem),
125
- gem_dir: @outpath.to_s,
126
- dsl_dir: @dsl_dir,
127
- auto_strictness: @auto_strictness,
128
- gems: @bundle.dependencies,
129
- )
130
-
131
- say("All operations performed in working directory.", [:green, :bold])
132
- say("Please review changes and commit them.", [:green, :bold])
133
- else
134
- say("No operations performed, all RBIs are up-to-date.", [:green, :bold])
135
- end
136
-
137
- puts
138
- end
139
-
140
74
  private
141
75
 
142
76
  sig { params(gem_names: T::Array[String]).returns(T::Array[Gemfile::GemSpec]) }
143
77
  def gems_to_generate(gem_names)
144
78
  return @bundle.dependencies if gem_names.empty?
145
79
 
146
- gem_names.map do |gem_name|
80
+ gem_names.each_with_object([]) do |gem_name, gems|
147
81
  gem = @bundle.gem(gem_name)
148
82
 
149
83
  if gem.nil?
150
84
  raise Thor::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
151
85
  end
152
86
 
153
- gem
87
+ gems.concat(gem_dependencies(gem)) if @include_dependencies
88
+ gems << gem
89
+ end
90
+ end
91
+
92
+ sig do
93
+ params(
94
+ gem: Gemfile::GemSpec,
95
+ dependencies: T::Array[Gemfile::GemSpec],
96
+ ).returns(T::Array[Gemfile::GemSpec])
97
+ end
98
+ def gem_dependencies(gem, dependencies = [])
99
+ direct_dependencies = gem.dependencies.filter_map { |dependency| @bundle.gem(dependency.name) }
100
+ gems = dependencies | direct_dependencies
101
+
102
+ if direct_dependencies.empty?
103
+ gems
104
+ else
105
+ direct_dependencies.reduce(gems) { |result, gem| gem_dependencies(gem, result) }
154
106
  end
155
107
  end
156
108
 
@@ -185,25 +137,6 @@ module Tapioca
185
137
  end
186
138
  end
187
139
 
188
- sig { params(exclude: T::Array[String]).void }
189
- def perform_sync_verification(exclude: [])
190
- diff = {}
191
-
192
- removed_rbis.each do |gem_name|
193
- next if exclude.include?(gem_name)
194
-
195
- filename = existing_rbi(gem_name)
196
- diff[filename] = :removed
197
- end
198
-
199
- added_rbis.each do |gem_name|
200
- filename = expected_rbi(gem_name)
201
- diff[filename] = gem_rbi_exists?(gem_name) ? :changed : :added
202
- end
203
-
204
- report_diff_and_exit_if_out_of_date(diff, :gem)
205
- end
206
-
207
140
  sig { void }
208
141
  def perform_removals
209
142
  say("Removing RBI files of gems that have been removed:", [:blue, :bold])
@@ -23,6 +23,7 @@ module Tapioca
23
23
  typed_overrides: {}
24
24
  )
25
25
  super()
26
+ @outpath = T.let(Pathname.new(DEFAULT_ANNOTATIONS_DIR), Pathname)
26
27
  @central_repo_root_uris = central_repo_root_uris
27
28
  @auth = auth
28
29
  @netrc_file = netrc_file
@@ -32,16 +33,19 @@ module Tapioca
32
33
  @typed_overrides = typed_overrides
33
34
  end
34
35
 
36
+ private
37
+
35
38
  sig { override.void }
36
39
  def execute
37
40
  @indexes = fetch_indexes
38
41
  project_gems = list_gemfile_gems
42
+
39
43
  remove_expired_annotations(project_gems)
40
44
  fetch_annotations(project_gems)
45
+ ensure
46
+ GitAttributes.create_vendored_attribute_file(@outpath)
41
47
  end
42
48
 
43
- private
44
-
45
49
  sig { returns(T::Array[String]) }
46
50
  def list_gemfile_gems
47
51
  say("Listing gems from Gemfile.lock... ", [:blue, :bold])
@@ -56,7 +60,7 @@ module Tapioca
56
60
  def remove_expired_annotations(project_gems)
57
61
  say("Removing annotations for gems that have been removed... ", [:blue, :bold])
58
62
 
59
- annotations = Pathname.glob("#{DEFAULT_ANNOTATIONS_DIR}/*.rbi").map { |f| f.basename(".*").to_s }
63
+ annotations = Pathname.glob(@outpath.join("*.rbi")).map { |f| f.basename(".*").to_s }
60
64
  expired = annotations - project_gems
61
65
 
62
66
  if expired.empty?
@@ -67,7 +71,7 @@ module Tapioca
67
71
  say("\n")
68
72
  expired.each do |gem_name|
69
73
  say("\n")
70
- path = "#{DEFAULT_ANNOTATIONS_DIR}/#{gem_name}.rbi"
74
+ path = @outpath.join("#{gem_name}.rbi")
71
75
  remove_file(path)
72
76
  end
73
77
  say("\nDone\n\n", :green)
@@ -140,10 +144,8 @@ module Tapioca
140
144
  content = apply_typed_override(gem_name, content)
141
145
  content = add_header(gem_name, content)
142
146
 
143
- dir = DEFAULT_ANNOTATIONS_DIR
144
- FileUtils.mkdir_p(dir)
145
147
  say("\n Fetched #{set_color(gem_name, :yellow, :bold)}", :green)
146
- create_file("#{dir}/#{gem_name}.rbi", content)
148
+ create_file(@outpath.join("#{gem_name}.rbi"), content)
147
149
  end
148
150
 
149
151
  sig { params(repo_uri: String, path: String).returns(T.nilable(String)) }
@@ -38,6 +38,8 @@ module Tapioca
38
38
  @number_of_workers = number_of_workers
39
39
  end
40
40
 
41
+ private
42
+
41
43
  sig { override.void }
42
44
  def execute
43
45
  index = RBI::Index.new
@@ -21,11 +21,18 @@ module Tapioca
21
21
  @file_writer = T.let(FileWriter.new, Thor::Actions)
22
22
  end
23
23
 
24
- sig { abstract.void }
25
- def execute; end
24
+ sig(:final) { void }
25
+ def run
26
+ Tapioca.silence_warnings do
27
+ execute
28
+ end
29
+ end
26
30
 
27
31
  private
28
32
 
33
+ sig { abstract.void }
34
+ def execute; end
35
+
29
36
  sig { params(command: Symbol, args: String).returns(String) }
30
37
  def default_command(command, *args)
31
38
  [Tapioca::BINARY_FILE, command.to_s, *args].join(" ")
@@ -26,6 +26,8 @@ module Tapioca
26
26
  @spec = T.let(nil, T.nilable(Bundler::StubSpecification))
27
27
  end
28
28
 
29
+ private
30
+
29
31
  sig { override.void }
30
32
  def execute
31
33
  create_sorbet_config
@@ -34,8 +36,6 @@ module Tapioca
34
36
  create_binstub
35
37
  end
36
38
 
37
- private
38
-
39
39
  sig { void }
40
40
  def create_sorbet_config
41
41
  create_file(@sorbet_config, <<~CONTENT, skip: true, force: false)
@@ -0,0 +1,31 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module Commands
6
+ class DslCompilerList < AbstractDsl
7
+ private
8
+
9
+ sig { override.void }
10
+ def execute
11
+ load_application
12
+
13
+ say("")
14
+ say("Loaded DSL compiler classes:")
15
+ say("")
16
+
17
+ table = pipeline.compilers.map do |compiler|
18
+ status = if pipeline.active_compilers.include?(compiler)
19
+ set_color("enabled", :green)
20
+ else
21
+ set_color("disabled", :red)
22
+ end
23
+
24
+ [compiler.name, status]
25
+ end
26
+
27
+ print_table(table, { indent: 2 })
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,40 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module Commands
6
+ class DslGenerate < AbstractDsl
7
+ private
8
+
9
+ sig { override.void }
10
+ def execute
11
+ load_application
12
+
13
+ say("Compiling DSL RBI files...")
14
+ say("")
15
+
16
+ rbi_files_to_purge = generate_dsl_rbi_files(@outpath, quiet: @quiet && !@verbose)
17
+ say("")
18
+
19
+ purge_stale_dsl_rbi_files(rbi_files_to_purge)
20
+ say("Done", :green)
21
+
22
+ if @auto_strictness
23
+ say("")
24
+ validate_rbi_files(
25
+ command: default_command(:dsl, all_requested_constants.join(" ")),
26
+ gem_dir: @gem_dir,
27
+ dsl_dir: @outpath.to_s,
28
+ auto_strictness: @auto_strictness,
29
+ compilers: pipeline.active_compilers,
30
+ )
31
+ end
32
+
33
+ say("All operations performed in working directory.", [:green, :bold])
34
+ say("Please review changes and commit them.", [:green, :bold])
35
+ ensure
36
+ GitAttributes.create_generated_attribute_file(@outpath)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,25 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module Commands
6
+ class DslVerify < AbstractDsl
7
+ private
8
+
9
+ sig { override.void }
10
+ def execute
11
+ load_application
12
+
13
+ say("Checking for out-of-date RBIs...")
14
+ say("")
15
+
16
+ outpath = Pathname.new(Dir.mktmpdir)
17
+
18
+ generate_dsl_rbi_files(outpath, quiet: true)
19
+ say("")
20
+
21
+ perform_dsl_verification(outpath)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,51 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module Commands
6
+ class GemGenerate < AbstractGem
7
+ private
8
+
9
+ sig { override.void }
10
+ def execute
11
+ Loaders::Gem.load_application(
12
+ bundle: @bundle,
13
+ prerequire: @prerequire,
14
+ postrequire: @postrequire,
15
+ default_command: default_command(:require),
16
+ halt_upon_load_error: @halt_upon_load_error,
17
+ )
18
+
19
+ gem_queue = gems_to_generate(@gem_names).reject { |gem| @exclude.include?(gem.name) }
20
+ anything_done = [
21
+ perform_removals,
22
+ gem_queue.any?,
23
+ ].any?
24
+
25
+ Executor.new(gem_queue, number_of_workers: @number_of_workers).run_in_parallel do |gem|
26
+ shell.indent do
27
+ compile_gem_rbi(gem)
28
+ puts
29
+ end
30
+ end
31
+
32
+ if anything_done
33
+ validate_rbi_files(
34
+ command: default_command(:gem, @gem_names.join(" ")),
35
+ gem_dir: @outpath.to_s,
36
+ dsl_dir: @dsl_dir,
37
+ auto_strictness: @auto_strictness,
38
+ gems: @bundle.dependencies,
39
+ )
40
+
41
+ say("All operations performed in working directory.", [:green, :bold])
42
+ say("Please review changes and commit them.", [:green, :bold])
43
+ else
44
+ say("No operations performed, all RBIs are up-to-date.", [:green, :bold])
45
+ end
46
+ ensure
47
+ GitAttributes.create_generated_attribute_file(@outpath)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,37 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module Commands
6
+ class GemSync < AbstractGem
7
+ private
8
+
9
+ sig { override.void }
10
+ def execute
11
+ anything_done = [
12
+ perform_removals,
13
+ perform_additions,
14
+ ].any?
15
+
16
+ if anything_done
17
+ validate_rbi_files(
18
+ command: default_command(:gem),
19
+ gem_dir: @outpath.to_s,
20
+ dsl_dir: @dsl_dir,
21
+ auto_strictness: @auto_strictness,
22
+ gems: @bundle.dependencies,
23
+ )
24
+
25
+ say("All operations performed in working directory.", [:green, :bold])
26
+ say("Please review changes and commit them.", [:green, :bold])
27
+ else
28
+ say("No operations performed, all RBIs are up-to-date.", [:green, :bold])
29
+ end
30
+
31
+ puts
32
+ ensure
33
+ GitAttributes.create_generated_attribute_file(@outpath)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module Commands
6
+ class GemVerify < AbstractGem
7
+ private
8
+
9
+ sig { override.void }
10
+ def execute
11
+ say("Checking for out-of-date RBIs...")
12
+ say("")
13
+ perform_sync_verification
14
+ end
15
+
16
+ sig { void }
17
+ def perform_sync_verification
18
+ diff = {}
19
+
20
+ removed_rbis.each do |gem_name|
21
+ next if @exclude.include?(gem_name)
22
+
23
+ filename = existing_rbi(gem_name)
24
+ diff[filename] = :removed
25
+ end
26
+
27
+ added_rbis.each do |gem_name|
28
+ filename = expected_rbi(gem_name)
29
+ diff[filename] = gem_rbi_exists?(gem_name) ? :changed : :added
30
+ end
31
+
32
+ report_diff_and_exit_if_out_of_date(diff, :gem)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -17,6 +17,8 @@ module Tapioca
17
17
  super()
18
18
  end
19
19
 
20
+ private
21
+
20
22
  sig { override.void }
21
23
  def execute
22
24
  compiler = Static::RequiresCompiler.new(@sorbet_config_path)