Top Level Namespace

Defined Under Namespace

Modules: Rugged Classes: CMakeTimeout

Constant Summary collapse

MAKE =
if Gem.win_platform?
  # On Windows, Ruby-DevKit only has 'make'.
  find_executable('make')
else
  find_executable('gmake') || find_executable('make')
end
CWD =
File.expand_path(File.dirname(__FILE__))
LIBGIT2_DIR =
File.join(CWD, '..', '..', 'vendor', 'libgit2')

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run_cmake(timeout, args) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'ext/rugged/extconf.rb', line 35

def self.run_cmake(timeout, args)
  # Set to process group so we can kill it and its children
  pgroup = Gem.win_platform? ? :new_pgroup : :pgroup
  pid = Process.spawn("cmake #{args}", pgroup => true)

  Timeout.timeout(timeout) do
    Process.waitpid(pid)
  end

rescue Timeout::Error
  # Kill it, #detach is essentially a background wait, since we don't actually
  # care about waiting for it now
  Process.kill(-9, pid)
  Process.detach(pid)
  raise CMakeTimeout.new("cmake has exceeded its timeout of #{timeout}s")
end

Instance Method Details

#repoObject

Loaded by script/console. Land helpers here.



8
9
10
# File 'lib/rugged/console.rb', line 8

def repo
  Rugged::Repository.new(File.expand_path('../../../', __FILE__))
end

#sys(cmd) ⇒ Object



23
24
25
26
27
28
29
# File 'ext/rugged/extconf.rb', line 23

def sys(cmd)
  puts " -- #{cmd}"
  unless ret = xsystem(cmd)
    raise "ERROR: '#{cmd}' failed"
  end
  ret
end