Module: Transpec::Git

Defined in:
lib/transpec/git.rb

Constant Summary collapse

GIT =
'git'

Class Method Summary collapse

Class Method Details

.clean?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/transpec/git.rb', line 20

def clean?
  `#{GIT} status --porcelain`.empty?
end

.command_available?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
# File 'lib/transpec/git.rb', line 9

def command_available?
  ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|
    git_path = File.join(path, GIT)
    File.exists?(git_path)
  end
end

.inside_of_repository?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/transpec/git.rb', line 16

def inside_of_repository?
  system("#{GIT} rev-parse --is-inside-work-tree > /dev/null 2> /dev/null")
end