Skip to content

Commit 1ee1e56

Browse files
committed
feat: Show list of ignored gems
1 parent e7a2f96 commit 1ee1e56

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

lib/tapioca/cli.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def gem(*gems)
301301
rbi_formatter: rbi_formatter(options),
302302
halt_upon_load_error: options[:halt_upon_load_error],
303303
lsp_addon: options[:lsp_addon],
304+
skipped_gems: []
304305
}
305306

306307
command = if verify

lib/tapioca/commands/abstract_gem.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class AbstractGem < Command
88
include SorbetHelper
99
include RBIFilesHelper
1010

11-
#: (gem_names: Array[String], exclude: Array[String], include_dependencies: bool, prerequire: String?, postrequire: String, typed_overrides: Hash[String, String], outpath: Pathname, file_header: bool, include_doc: bool, include_loc: bool, include_exported_rbis: bool, ?number_of_workers: Integer?, ?auto_strictness: bool, ?dsl_dir: String, ?rbi_formatter: RBIFormatter, ?halt_upon_load_error: bool, ?lsp_addon: bool?) -> void
11+
#: (gem_names: Array[String], exclude: Array[String], include_dependencies: bool, prerequire: String?, postrequire: String, typed_overrides: Hash[String, String], outpath: Pathname, file_header: bool, include_doc: bool, include_loc: bool, include_exported_rbis: bool, skipped_gems: Array[String], ?number_of_workers: Integer?, ?auto_strictness: bool, ?dsl_dir: String, ?rbi_formatter: RBIFormatter, ?halt_upon_load_error: bool, ?lsp_addon: bool?) -> void
1212
def initialize(
1313
gem_names:,
1414
exclude:,
@@ -21,6 +21,7 @@ def initialize(
2121
include_doc:,
2222
include_loc:,
2323
include_exported_rbis:,
24+
skipped_gems:,
2425
number_of_workers: nil,
2526
auto_strictness: true,
2627
dsl_dir: DEFAULT_DSL_DIR,
@@ -50,6 +51,7 @@ def initialize(
5051
@include_doc = include_doc #: bool
5152
@include_loc = include_loc #: bool
5253
@include_exported_rbis = include_exported_rbis
54+
@skipped_gems = skipped_gems
5355
@halt_upon_load_error = halt_upon_load_error
5456
end
5557

lib/tapioca/commands/gem_generate.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def execute
2222
perform_removals,
2323
gem_queue.any?,
2424
].any?
25+
anything_excluded = @skipped_gems
2526

2627
Executor.new(gem_queue, number_of_workers: @number_of_workers).run_in_parallel do |gem|
2728
shell.indent do
@@ -44,6 +45,10 @@ def execute
4445
else
4546
say("No operations performed, all RBIs are up-to-date.", [:green, :bold])
4647
end
48+
unless anything_excluded.empty?
49+
say("\nNote, the following gems have been excluded from Tapioca:",[:yellow, :bold])
50+
say(@skipped_gems.join(", "), [:yellow, :bold])
51+
end
4752
ensure
4853
GitAttributes.create_generated_attribute_file(@outpath)
4954
end
@@ -56,11 +61,15 @@ def gems_to_generate(gem_names)
5661
gem = @bundle.gem(gem_name)
5762

5863
if gem.nil?
59-
next if @lsp_addon
60-
61-
raise Tapioca::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
64+
if @lsp_addon
65+
next
66+
elsif Gemfile::GemSpec::IGNORED_GEMS.include?(gem_name)
67+
@skipped_gems << gem_name
68+
next
69+
else
70+
raise Tapioca::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
71+
end
6272
end
63-
6473
gems.concat(gem_dependencies(gem)) if @include_dependencies
6574
gems << gem
6675
end

0 commit comments

Comments
 (0)