Top Level Namespace

Defined Under Namespace

Modules: GoogleRobotstxtParser 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
LIBROBOTSTXT_DIR =

CWD = __dir__ LIBROBOTSTXT_DIR = File.join(CWD, ‘robotstxt’)

File.join('.', 'robotstxt')
LIBDIR =
RbConfig::CONFIG['libdir']
INCLUDEDIR =
RbConfig::CONFIG['includedir']
HEADER_DIRS =
[
  LIBROBOTSTXT_DIR,
  "#{LIBROBOTSTXT_DIR}/c-build/libs/abseil-cpp-src"
]
LIB_DIRS =
[
  "#{LIBROBOTSTXT_DIR}/c-build"
]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run_cmake(timeout, args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'ext/robotstxt/extconf.rb', line 20

def self.run_cmake(timeout, args)
  # Set to process group so we can kill it and its children
  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

#sys(cmd) ⇒ Object



8
9
10
11
12
13
14
# File 'ext/robotstxt/extconf.rb', line 8

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