Module: Gemspec::Git

Extended by:
Memoist
Defined in:
lib/gemspec/git.rb

Class Method Summary collapse

Class Method Details

.cdroot(&blk) ⇒ Object

Go to the repo’s root – block must be given



46
47
48
49
# File 'lib/gemspec/git.rb', line 46

def cdroot(&blk)
  return unless blk
  cdroot! &blk
end

.cdroot!(&blk) ⇒ Object

Go to the repo’s root (and back if a block is given)



35
36
37
38
39
40
41
42
# File 'lib/gemspec/git.rb', line 35

def cdroot!(&blk)
  cdup = '.' if (cdup=`git rev-parse --show-cdup`.chomp) == ""
  if blk
    Dir.chdir cdup, &blk
  else
    Dir.chdir cdup
  end
end

.clean?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/gemspec/git.rb', line 51

def clean?
  `git status --porcelain`.chomp == ""
end