Module: EacGit::Local::DirtyFiles

Defined in:
lib/eac_git/local/dirty_files.rb

Instance Method Summary collapse

Instance Method Details

#dirty?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/eac_git/local/dirty_files.rb', line 8

def dirty?
  dirty_files.any?
end

#dirty_file?(path) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/eac_git/local/dirty_files.rb', line 12

def dirty_file?(path)
  absolute_path = path.to_pathname.expand_path(root_path)
  dirty_files.any? do |df|
    df.absolute_path == absolute_path
  end
end

#dirty_filesObject



19
20
21
22
23
# File 'lib/eac_git/local/dirty_files.rb', line 19

def dirty_files
  command('status', '--porcelain=v1', '--untracked-files', '--no-renames')
    .execute!.each_line
    .map { |line| ::EacGit::Local::ChangedFile.by_porcelain_v1_line(self, line) }
end