diff --git a/lib/tapioca/cli.rb b/lib/tapioca/cli.rb index ad00e26f8..799f890a4 100644 --- a/lib/tapioca/cli.rb +++ b/lib/tapioca/cli.rb @@ -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 diff --git a/lib/tapioca/commands/abstract_gem.rb b/lib/tapioca/commands/abstract_gem.rb index 968248228..54e9e5c65 100644 --- a/lib/tapioca/commands/abstract_gem.rb +++ b/lib/tapioca/commands/abstract_gem.rb @@ -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:, @@ -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, @@ -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 diff --git a/lib/tapioca/commands/gem_generate.rb b/lib/tapioca/commands/gem_generate.rb index 6362655e5..ad3f1b6a9 100644 --- a/lib/tapioca/commands/gem_generate.rb +++ b/lib/tapioca/commands/gem_generate.rb @@ -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 @@ -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 @@ -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