class Reviewer::Keywords::Git::Staged
Provides a convenient interface to get the list of staged files via Git
Constants
- OPTIONS
Attributes
exit_status[R]
status[R]
stderr[R]
stdout[R]
Public Class Methods
list()
click to toggle source
# File lib/reviewer/keywords/git/staged.rb, line 27 def self.list new.list end
Public Instance Methods
command()
click to toggle source
# File lib/reviewer/keywords/git/staged.rb, line 31 def command command_parts.join(' ') end
list()
click to toggle source
# File lib/reviewer/keywords/git/staged.rb, line 20 def list @stdout, @stderr, @status = Open3.capture3(command) @exit_status = @status.exitstatus.to_i @status.success? ? to_a : raise_command_line_error end
to_a()
click to toggle source
# File lib/reviewer/keywords/git/staged.rb, line 16 def to_a stdout.strip.empty? ? [] : stdout.split("\n") end
Private Instance Methods
command_parts()
click to toggle source
# File lib/reviewer/keywords/git/staged.rb, line 42 def command_parts BASE_COMMAND + OPTIONS end
raise_command_line_error()
click to toggle source
# File lib/reviewer/keywords/git/staged.rb, line 37 def raise_command_line_error message = "Git Error: #{stderr} (#{command})" raise SystemCallError.new(message, exit_status) end