Module: HelixRuntime

Defined in:
lib/helix_runtime.rb,
lib/helix_runtime/cli.rb,
lib/helix_runtime/project.rb,
lib/helix_runtime/version.rb,
lib/helix_runtime/platform.rb,
lib/helix_runtime/build_task.rb,
lib/helix_runtime/cli/bootstrap.rb,
lib/helix_runtime/parent_project.rb,
lib/helix_runtime/parent_build_task.rb

Defined Under Namespace

Modules: CLI, Platform Classes: BuildTask, MissingDllError, ParentBuildTask, ParentProject, Project

Constant Summary collapse

IS_WINDOWS =
RUBY_PLATFORM =~ /mingw/
VERSION =

Also update helix_runtime.c

"0.7.5"
GEM_VERSION =
VERSION.gsub("-", ".")
@@dll_filename =
"helix-runtime-#{VERSION.gsub('.', '-')}.#{Platform.libext}"
@@dll_path_searched =
false

Class Method Summary collapse

Class Method Details

.copy_dllObject



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/helix_runtime.rb', line 46

def self.copy_dll
  if IS_WINDOWS
    so_path = File.expand_path("../helix_runtime/native.#{Platform.dlext}", __FILE__)
    raise "Unable to find native bundle at #{so_path}" unless File.exists?(so_path)

    bindir = RbConfig::CONFIG['bindir']
    raise "Unable to determine Ruby bindir" unless bindir

    FileUtils.cp so_path, File.join(bindir, dll_filename)
  else
    # No-op
  end
end

.dll_filenameObject



20
21
22
# File 'lib/helix_runtime.rb', line 20

def self.dll_filename
  @@dll_filename
end

.dll_pathObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/helix_runtime.rb', line 24

def self.dll_path
  return nil unless IS_WINDOWS
  return @@dll_path if @@dll_path_searched

  dll_dir = ENV['PATH'].split(';').find do |dir|
    File.exist?(File.expand_path("#{dir}/#{dll_filename}", __FILE__))
  end

  @@dll_path_searched = true
  @@dll_path = dll_dir ? File.join(dll_dir, dll_filename) : nil
end

.ensure_dll!Object



36
37
38
39
40
41
42
43
44
# File 'lib/helix_runtime.rb', line 36

def self.ensure_dll!
  if IS_WINDOWS
    unless dll_path
      raise MissingDllError, "Unable to find #{dll_filename} in $PATH."
    end
  else
    # No-op
  end
end