diff --git a/lib/bundle.rb b/lib/bundle.rb index 09797d4ef..9eecf6fca 100644 --- a/lib/bundle.rb +++ b/lib/bundle.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true $LOAD_PATH.unshift(File.dirname(__FILE__)) diff --git a/lib/bundle/brew_checker.rb b/lib/bundle/brew_checker.rb index 8b1e32ba9..d70b858eb 100644 --- a/lib/bundle/brew_checker.rb +++ b/lib/bundle/brew_checker.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/brew_dumper.rb b/lib/bundle/brew_dumper.rb index af2ade27b..dae767ed1 100644 --- a/lib/bundle/brew_dumper.rb +++ b/lib/bundle/brew_dumper.rb @@ -1,3 +1,4 @@ +# typed: false # frozen_string_literal: true require "json" diff --git a/lib/bundle/brew_installer.rb b/lib/bundle/brew_installer.rb index e7e7ea5e7..cb72e78a3 100644 --- a/lib/bundle/brew_installer.rb +++ b/lib/bundle/brew_installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/brew_service_checker.rb b/lib/bundle/brew_service_checker.rb index 25d5ad6e9..def66c694 100644 --- a/lib/bundle/brew_service_checker.rb +++ b/lib/bundle/brew_service_checker.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/brew_services.rb b/lib/bundle/brew_services.rb index cd31f5363..4a9d90714 100644 --- a/lib/bundle/brew_services.rb +++ b/lib/bundle/brew_services.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/brewfile.rb b/lib/bundle/brewfile.rb index 913a92771..a543e8bcf 100644 --- a/lib/bundle/brewfile.rb +++ b/lib/bundle/brewfile.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/brewfile.rbi b/lib/bundle/brewfile.rbi new file mode 100644 index 000000000..321d02fb6 --- /dev/null +++ b/lib/bundle/brewfile.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module Brewfile + include Kernel + end +end diff --git a/lib/bundle/bundle.rb b/lib/bundle/bundle.rb index ff1af098a..bb374b167 100644 --- a/lib/bundle/bundle.rb +++ b/lib/bundle/bundle.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "English" @@ -8,7 +9,7 @@ def system(cmd, *args, verbose: false) return super cmd, *args if verbose logs = [] - success = nil + success = T.let(nil, T.nilable(T::Boolean)) IO.popen([cmd, *args], err: [:child, :out]) do |pipe| while (buf = pipe.gets) logs << buf @@ -66,7 +67,7 @@ def exchange_uid_if_needed!(&block) Process::Sys.seteuid(uid) end - return_value = with_env("HOME" => Etc.getpwuid(Process.uid).dir, &block) + return_value = with_env("HOME" => Etc.getpwuid(Process.uid)&.dir, &block) if process_reexchangeable Process::UID.re_exchange diff --git a/lib/bundle/cask_checker.rb b/lib/bundle/cask_checker.rb index 28e1b5baf..2d3d781af 100644 --- a/lib/bundle/cask_checker.rb +++ b/lib/bundle/cask_checker.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/cask_dumper.rb b/lib/bundle/cask_dumper.rb index a2196361d..9f3927b4d 100644 --- a/lib/bundle/cask_dumper.rb +++ b/lib/bundle/cask_dumper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/cask_dumper.rbi b/lib/bundle/cask_dumper.rbi new file mode 100644 index 000000000..7fe5bc5e7 --- /dev/null +++ b/lib/bundle/cask_dumper.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module CaskDumper + include Kernel + end +end diff --git a/lib/bundle/cask_installer.rb b/lib/bundle/cask_installer.rb index 173848fa9..ec4c9c804 100644 --- a/lib/bundle/cask_installer.rb +++ b/lib/bundle/cask_installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/cask_installer.rbi b/lib/bundle/cask_installer.rbi new file mode 100644 index 000000000..2532001e1 --- /dev/null +++ b/lib/bundle/cask_installer.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module CaskInstaller + include Kernel + end +end diff --git a/lib/bundle/checker.rb b/lib/bundle/checker.rb index fb2be58ae..bc7b59acf 100644 --- a/lib/bundle/checker.rb +++ b/lib/bundle/checker.rb @@ -1,3 +1,4 @@ +# typed: false # frozen_string_literal: true module Bundle diff --git a/lib/bundle/commands/check.rb b/lib/bundle/commands/check.rb index 9a4e7c0c3..1a037417c 100644 --- a/lib/bundle/commands/check.rb +++ b/lib/bundle/commands/check.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/commands/cleanup.rb b/lib/bundle/commands/cleanup.rb index 132d3cb68..0ca2db72b 100644 --- a/lib/bundle/commands/cleanup.rb +++ b/lib/bundle/commands/cleanup.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "utils/formatter" @@ -125,7 +126,7 @@ def kept_casks(global: false, file: nil) def recursive_dependencies(current_formulae, formulae_names, top_level: true) @checked_formulae_names = [] if top_level - dependencies = [] + dependencies = T.let([], T::Array[Dependency]) formulae_names.each do |name| next if @checked_formulae_names.include?(name) diff --git a/lib/bundle/commands/commands.rbi b/lib/bundle/commands/commands.rbi new file mode 100644 index 000000000..426933e7f --- /dev/null +++ b/lib/bundle/commands/commands.rbi @@ -0,0 +1,29 @@ +# typed: true + +module Bundle + module Commands + module Check + include Kernel + end + + module Cleanup + include Kernel + end + + module Dump + include Kernel + end + + module Exec + include Kernel + end + + module Install + include Kernel + end + + module List + include Kernel + end + end +end diff --git a/lib/bundle/commands/dump.rb b/lib/bundle/commands/dump.rb index 8a8747428..739e0270a 100644 --- a/lib/bundle/commands/dump.rb +++ b/lib/bundle/commands/dump.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/commands/exec.rb b/lib/bundle/commands/exec.rb index 4a8de947c..bcec514a5 100644 --- a/lib/bundle/commands/exec.rb +++ b/lib/bundle/commands/exec.rb @@ -1,3 +1,4 @@ +# typed: false # frozen_string_literal: true require "exceptions" diff --git a/lib/bundle/commands/install.rb b/lib/bundle/commands/install.rb index de9d917d5..fed0fc6d9 100644 --- a/lib/bundle/commands/install.rb +++ b/lib/bundle/commands/install.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/commands/list.rb b/lib/bundle/commands/list.rb index b4568ed46..0288f995c 100644 --- a/lib/bundle/commands/list.rb +++ b/lib/bundle/commands/list.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/dsl.rb b/lib/bundle/dsl.rb index 7d1007a37..d289ff42b 100644 --- a/lib/bundle/dsl.rb +++ b/lib/bundle/dsl.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle @@ -104,7 +105,7 @@ def self.sanitize_brew_name(name) user = Regexp.last_match(1) repo = Regexp.last_match(2) name = Regexp.last_match(3) - "#{user}/#{repo.sub("homebrew-", "")}/#{name}" + "#{user}/#{repo&.sub("homebrew-", "")}/#{name}" else name end diff --git a/lib/bundle/dumper.rb b/lib/bundle/dumper.rb index dd3ba6694..756fa1bea 100644 --- a/lib/bundle/dumper.rb +++ b/lib/bundle/dumper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "fileutils" diff --git a/lib/bundle/dumper.rbi b/lib/bundle/dumper.rbi new file mode 100644 index 000000000..e10eebfc2 --- /dev/null +++ b/lib/bundle/dumper.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module Dumper + include Kernel + end +end diff --git a/lib/bundle/extend/os/bundle.rb b/lib/bundle/extend/os/bundle.rb index f3da9d574..2c50c459b 100644 --- a/lib/bundle/extend/os/bundle.rb +++ b/lib/bundle/extend/os/bundle.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "bundle/extend/os/linux/bundle" if OS.linux? diff --git a/lib/bundle/extend/os/linux/bundle.rb b/lib/bundle/extend/os/linux/bundle.rb index 8156d3111..612ff893a 100644 --- a/lib/bundle/extend/os/linux/bundle.rb +++ b/lib/bundle/extend/os/linux/bundle.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/extend/os/linux/skipper.rb b/lib/bundle/extend/os/linux/skipper.rb index 3180cc8c4..d8cb908a2 100644 --- a/lib/bundle/extend/os/linux/skipper.rb +++ b/lib/bundle/extend/os/linux/skipper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/extend/os/skipper.rb b/lib/bundle/extend/os/skipper.rb index 819123c63..b611d2f1e 100644 --- a/lib/bundle/extend/os/skipper.rb +++ b/lib/bundle/extend/os/skipper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "bundle/extend/os/linux/skipper" if OS.linux? diff --git a/lib/bundle/installer.rb b/lib/bundle/installer.rb index 31015439f..1cedc0f33 100644 --- a/lib/bundle/installer.rb +++ b/lib/bundle/installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle @@ -37,6 +38,7 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false Bundle::TapInstaller end + next if cls.nil? next if Bundle::Skipper.skip? entry preinstall = if cls.preinstall(*args, **options, no_upgrade:, verbose:) diff --git a/lib/bundle/installer.rbi b/lib/bundle/installer.rbi new file mode 100644 index 000000000..7bd5ba08e --- /dev/null +++ b/lib/bundle/installer.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module Installer + include Kernel + end +end diff --git a/lib/bundle/lister.rb b/lib/bundle/lister.rb index 4d9693ccf..76e7679a0 100644 --- a/lib/bundle/lister.rb +++ b/lib/bundle/lister.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle @@ -10,7 +11,7 @@ def list(entries, brews:, casks:, taps:, mas:, whalebrew:, vscode:) end end - def self.show?(type, brews:, casks:, taps:, mas:, whalebrew:, vscode:) + def show?(type, brews:, casks:, taps:, mas:, whalebrew:, vscode:) return true if brews && type == :brew return true if casks && type == :cask return true if taps && type == :tap diff --git a/lib/bundle/lister.rbi b/lib/bundle/lister.rbi new file mode 100644 index 000000000..d39a82ca0 --- /dev/null +++ b/lib/bundle/lister.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module Lister + include Kernel + end +end diff --git a/lib/bundle/mac_app_store_checker.rb b/lib/bundle/mac_app_store_checker.rb index b5d426f06..cb3358846 100644 --- a/lib/bundle/mac_app_store_checker.rb +++ b/lib/bundle/mac_app_store_checker.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/mac_app_store_dumper.rb b/lib/bundle/mac_app_store_dumper.rb index 8acc69de0..ce7691937 100644 --- a/lib/bundle/mac_app_store_dumper.rb +++ b/lib/bundle/mac_app_store_dumper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "json" diff --git a/lib/bundle/mac_app_store_dumper.rbi b/lib/bundle/mac_app_store_dumper.rbi new file mode 100644 index 000000000..2d5b9a901 --- /dev/null +++ b/lib/bundle/mac_app_store_dumper.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module MacAppStoreDumper + include Kernel + end +end diff --git a/lib/bundle/mac_app_store_installer.rb b/lib/bundle/mac_app_store_installer.rb index 1213f50a7..091a1083a 100644 --- a/lib/bundle/mac_app_store_installer.rb +++ b/lib/bundle/mac_app_store_installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "os" diff --git a/lib/bundle/mac_app_store_installer.rbi b/lib/bundle/mac_app_store_installer.rbi new file mode 100644 index 000000000..68d9b4f1d --- /dev/null +++ b/lib/bundle/mac_app_store_installer.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module MacAppStoreInstaller + include Kernel + end +end diff --git a/lib/bundle/skipper.rb b/lib/bundle/skipper.rb index 3808bf9e3..2a3e9bf25 100644 --- a/lib/bundle/skipper.rb +++ b/lib/bundle/skipper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "hardware" diff --git a/lib/bundle/tap_checker.rb b/lib/bundle/tap_checker.rb index 77ccc7018..72a0e9f8e 100644 --- a/lib/bundle/tap_checker.rb +++ b/lib/bundle/tap_checker.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/tap_dumper.rb b/lib/bundle/tap_dumper.rb index 39125e2e6..e4dee2dcc 100644 --- a/lib/bundle/tap_dumper.rb +++ b/lib/bundle/tap_dumper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true require "json" diff --git a/lib/bundle/tap_dumper.rbi b/lib/bundle/tap_dumper.rbi new file mode 100644 index 000000000..c25939d3a --- /dev/null +++ b/lib/bundle/tap_dumper.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module TapDumper + include Kernel + end +end diff --git a/lib/bundle/tap_installer.rb b/lib/bundle/tap_installer.rb index 352c15436..3bd24051c 100644 --- a/lib/bundle/tap_installer.rb +++ b/lib/bundle/tap_installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/tap_installer.rbi b/lib/bundle/tap_installer.rbi new file mode 100644 index 000000000..2255777b8 --- /dev/null +++ b/lib/bundle/tap_installer.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module TapInstaller + include Kernel + end +end diff --git a/lib/bundle/vscode_extension_checker.rb b/lib/bundle/vscode_extension_checker.rb index 2e67eb730..fe99f8471 100644 --- a/lib/bundle/vscode_extension_checker.rb +++ b/lib/bundle/vscode_extension_checker.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/vscode_extension_dumper.rb b/lib/bundle/vscode_extension_dumper.rb index 7db7e2b34..ff37d9fd6 100644 --- a/lib/bundle/vscode_extension_dumper.rb +++ b/lib/bundle/vscode_extension_dumper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/vscode_extension_dumper.rbi b/lib/bundle/vscode_extension_dumper.rbi new file mode 100644 index 000000000..7caf262e6 --- /dev/null +++ b/lib/bundle/vscode_extension_dumper.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module VscodeExtensionDumper + include Kernel + end +end diff --git a/lib/bundle/vscode_extension_installer.rb b/lib/bundle/vscode_extension_installer.rb index e41866bb5..bcbc69c8d 100644 --- a/lib/bundle/vscode_extension_installer.rb +++ b/lib/bundle/vscode_extension_installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/vscode_extension_installer.rbi b/lib/bundle/vscode_extension_installer.rbi new file mode 100644 index 000000000..cd0ebdb62 --- /dev/null +++ b/lib/bundle/vscode_extension_installer.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module VscodeExtensionInstaller + include Kernel + end +end diff --git a/lib/bundle/whalebrew_dumper.rb b/lib/bundle/whalebrew_dumper.rb index 3617a3ec2..c375bd7a5 100644 --- a/lib/bundle/whalebrew_dumper.rb +++ b/lib/bundle/whalebrew_dumper.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/whalebrew_dumper.rbi b/lib/bundle/whalebrew_dumper.rbi new file mode 100644 index 000000000..7840a0bbb --- /dev/null +++ b/lib/bundle/whalebrew_dumper.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module WhalebrewDumper + include Kernel + end +end diff --git a/lib/bundle/whalebrew_installer.rb b/lib/bundle/whalebrew_installer.rb index 612b2f886..b239d78a7 100644 --- a/lib/bundle/whalebrew_installer.rb +++ b/lib/bundle/whalebrew_installer.rb @@ -1,3 +1,4 @@ +# typed: true # frozen_string_literal: true module Bundle diff --git a/lib/bundle/whalebrew_installer.rbi b/lib/bundle/whalebrew_installer.rbi new file mode 100644 index 000000000..d04a96081 --- /dev/null +++ b/lib/bundle/whalebrew_installer.rbi @@ -0,0 +1,7 @@ +# typed: true + +module Bundle + module WhalebrewInstaller + include Kernel + end +end