Top Level Namespace

Defined Under Namespace

Modules: ActiveSupport, Couchbase, Rails

Constant Summary collapse

SDK_VERSION =
Couchbase::VERSION[:sdk]

Instance Method Summary collapse

Methods included from Couchbase::ForkHooks

#_fork

Instance Method Details

#check_version(name, extra_locations = []) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'ext/extconf.rb', line 55

def check_version(name, extra_locations = [])
  executable = which(name, extra_locations)
  puts "-- check #{name} (#{executable})"
  version = nil
  IO.popen([executable, "--version"]) do |io|
    version = io.read.split("\n").first
  end
  [executable, version]
end

#sys(*cmd) ⇒ Object



80
81
82
83
84
# File 'ext/extconf.rb', line 80

def sys(*cmd)
  puts "-- #{Dir.pwd}"
  puts "-- #{cmd.join(' ')}"
  system(*cmd) || abort("failed to execute command: #{$CHILD_STATUS.inspect}\n#{cmd.join(' ')}")
end

#which(name, extra_locations = []) ⇒ Object



46
47
48
49
50
51
52
53
# File 'ext/extconf.rb', line 46

def which(name, extra_locations = [])
  ENV.fetch("PATH", "")
     .split(File::PATH_SEPARATOR)
     .prepend(*extra_locations)
     .select { |path| File.directory?(path) }
     .map { |path| [path, name].join(File::SEPARATOR) + RbConfig::CONFIG["EXEEXT"] }
     .find { |file| File.executable?(file) }
end