lib/spoom/cli/bump.rb in spoom-1.1.16 vs lib/spoom/cli/bump.rb in spoom-1.2.0

- old
+ new

@@ -45,12 +45,11 @@ default: false, desc: "Count the number of errors if all files were bumped" option :sorbet_options, type: :string, default: "", desc: "Pass options to Sorbet" sig { params(directory: String).void } def bump(directory = ".") - in_sorbet_project! - + context = context_requiring_sorbet! from = options[:from] to = options[:to] force = options[:force] dry = options[:dry] only = options[:only] @@ -75,11 +74,11 @@ say("Checking files...") directory = File.expand_path(directory) files_to_bump = Sorbet::Sigils.files_with_sigil_strictness(directory, from) - files_from_config = config_files(path: exec_path) + files_from_config = context.srb_files.map { |file| File.expand_path(file) } files_to_bump.select! { |file| files_from_config.include?(file) } if only list = File.read(only).lines.map { |file| File.expand_path(file.strip) } files_to_bump.select! { |file| list.include?(File.expand_path(file)) } @@ -100,14 +99,13 @@ exit(files_to_bump.empty?) end error_url_base = Spoom::Sorbet::Errors::DEFAULT_ERROR_URL_BASE result = begin - Sorbet.srb_tc( + T.unsafe(context).srb_tc( *options[:sorbet_options].split(" "), "--error-url-base=#{error_url_base}", - path: exec_path, capture_err: true, sorbet_bin: options[:sorbet], ) rescue Spoom::Sorbet::Error::Segfault => error say_error(<<~ERR, status: nil) @@ -192,15 +190,9 @@ end end def undo_changes(files, from_strictness) Sorbet::Sigils.change_sigil_in_files(files, from_strictness) - end - - def config_files(path: ".") - config = sorbet_config - files = Sorbet.srb_files(config, path: path) - files.map { |file| File.expand_path(file) } end end end end end