Sha256: ab838159a67783b882ddda73cbb6633aa81b417d2846cb374d4a986418b13f9f
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module Reviewer class Arguments class Keywords module Git # Provides a convenient interface to get the list of staged files class Staged OPTIONS = [ 'diff', '--staged', '--name-only' ].freeze attr_reader :stdout, :stderr, :status, :exit_status def to_a stdout.present? ? stdout.split("\n") : [] end def to_s stdout.present? ? stdout : '' end def inspect { command: command, stdout: stdout, stderr: stderr, status: status, results: results } end def list @stdout, @stderr, @status = Open3.capture3(command) @exit_status = @status.exitstatus.to_i @status.success? ? to_a : raise_command_line_error end def self.list new.list end def command command_parts.join(' ') end private def raise_command_line_error message = "Git Error: #{stderr} (#{command})" raise SystemCallError.new(message, exit_status) end def command_parts BASE_COMMAND + OPTIONS end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reviewer-0.1.3 | lib/reviewer/arguments/keywords/git/staged.rb |