Top Level Namespace

Defined Under Namespace

Modules: CMetrics Classes: BuildCMetrics

Constant Summary collapse

ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))

Instance Method Summary collapse

Instance Method Details

#determine_preferred_command(bin, default_bin) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'ext/cmetrics/extconf.rb', line 16

def determine_preferred_command(bin, default_bin)
  printf "checking for whether %s or %s is usable... ", bin, default_bin
  STDOUT.flush
  bin += RbConfig::CONFIG['EXEEXT']
  path = ENV['PATH'].split(RbConfig::CONFIG['PATH_SEPARATOR'])
  for dir in path
    file = File.join(dir, bin)
    if FileTest.executable?(file)
      printf "%s\n", bin
      return bin
    else
      next
    end
  end
  printf "%s\n", default_bin
  return default_bin
end

#linux?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'ext/cmetrics/extconf.rb', line 8

def linux?
  RUBY_PLATFORM =~ /linux/
end

#windows?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'ext/cmetrics/extconf.rb', line 12

def windows?
  RUBY_PLATFORM =~ /mingw|mswin/
end