Top Level Namespace

Defined Under Namespace

Modules: NuoDB

Instance Method Summary collapse

Instance Method Details

#dir_exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


125
126
127
# File 'ext/nuodb/extconf.rb', line 125

def dir_exists? (path)
  !path.nil? and File.directory? path
end

#dylib_extensionObject



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'ext/nuodb/extconf.rb', line 56

def dylib_extension
  case RUBY_PLATFORM
    when /bsd/i, /darwin/i
      # extras here...
      'dylib'
    when /linux/i, /solaris|sunos/i
      # extras here...
      'so'
    else
      puts "Unsupported platform '#{RUBY_PLATFORM}'. Supported platforms are BSD, DARWIN, SOLARIS, and LINUX."
      raise
  end
end

#nuodb_home?(path) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
73
74
75
76
77
78
79
80
# File 'ext/nuodb/extconf.rb', line 70

def nuodb_home?(path)
  unless path.nil?
    incl = File.join(path, 'include')
    libs = File.join(path, 'lib64')
    if File.directory? incl and File.directory? libs
      [incl, libs]
    else
      [nil, nil]
    end
  end
end

#nuodb_srcs?(path) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'ext/nuodb/extconf.rb', line 82

def nuodb_srcs?(path)
  if File.directory? path
    entries = Dir.entries path
    if entries.include? 'CMakeLists.txt'
      remote_dir = File.join(path, 'Remote')
      dylib_paths = []
      Find.find(remote_dir) do |file|
        if File.file? file
          basename = "libNuoRemote.#{dylib_extension}"
          dylib_paths << file unless file !~ /#{basename}/
        end
      end
      [File.join(path, 'Remote'), File.dirname(dylib_paths[0])] unless dylib_paths.length == 0
    else
      pathname = Pathname.new path
      nuodb_srcs? File.expand_path("..", path) unless pathname.root?
    end
  end
end