module Git::Multi::Nike

the main `Git::Multi` capabilities

Public Instance Methods

just_do_it(interactive, pipelined, captured = nil, options = {}) click to toggle source

rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/CyclomaticComplexity

# File lib/git/multi.rb, line 144
def just_do_it(interactive, pipelined, captured = nil, options = {})
  working_dir = case (options[:in] || '').to_sym
                when :parent_dir then parent_dir
                when :local_path then local_path
                else Dir.pwd
                end
  Dir.chdir(working_dir) do
    if STDOUT.tty? && STDERR.tty?
      STDOUT.puts "#{full_name.invert} (#{fractional_index})"
      interactive.call(self)
    elsif STDERR.tty? && captured
      errors = File.join(ENV['TMPDIR'], "git-multi.#{$PID}")
      captured.call(self, errors)
      if File.exist?(errors) && !File.zero?(errors)
        # rubocop:disable Style/StderrPuts
        STDERR.puts "#{full_name.invert} (#{fractional_index})"
        Kernel.system "cat #{errors} > /dev/tty ;"
        # rubocop:enable Style/StderrPuts
      end
    else
      pipelined.call(self)
    end
  end
end
spputs(*args) click to toggle source

rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity

# File lib/git/multi.rb, line 171
def spputs(*args)
  # split, prefix and puts
  args.each do |arg|
    case arg
    when Array
      arg.each do |argh| puts("#{full_name}: #{argh}"); end
    when String
      spputs(arg.split($RS))
    else
      ssputs(arg.to_s)
    end
  end
end