Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/tapioca/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def gem(*gems)
rbi_formatter: rbi_formatter(options),
halt_upon_load_error: options[:halt_upon_load_error],
lsp_addon: options[:lsp_addon],
skipped_gems: []
}

command = if verify
Expand Down
4 changes: 3 additions & 1 deletion lib/tapioca/commands/abstract_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AbstractGem < Command
include SorbetHelper
include RBIFilesHelper

#: (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
#: (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
def initialize(
gem_names:,
exclude:,
Expand All @@ -21,6 +21,7 @@ def initialize(
include_doc:,
include_loc:,
include_exported_rbis:,
skipped_gems:,
number_of_workers: nil,
auto_strictness: true,
dsl_dir: DEFAULT_DSL_DIR,
Expand Down Expand Up @@ -50,6 +51,7 @@ def initialize(
@include_doc = include_doc #: bool
@include_loc = include_loc #: bool
@include_exported_rbis = include_exported_rbis
@skipped_gems = skipped_gems
@halt_upon_load_error = halt_upon_load_error
end

Expand Down
17 changes: 13 additions & 4 deletions lib/tapioca/commands/gem_generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def execute
perform_removals,
gem_queue.any?,
].any?
anything_excluded = @skipped_gems

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

if gem.nil?
next if @lsp_addon

raise Tapioca::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
if @lsp_addon
next
elsif Gemfile::GemSpec::IGNORED_GEMS.include?(gem_name)
@skipped_gems << gem_name
next
else
raise Tapioca::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
end
end

gems.concat(gem_dependencies(gem)) if @include_dependencies
gems << gem
end
Expand Down