Class: Cocov::PluginKit::Realloc

Inherits:
Object
  • Object
show all
Defined in:
lib/cocov/plugin_kit/realloc.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.bindingsObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cocov/plugin_kit/realloc.rb', line 7

def self.bindings
  secrets_path = Pathname.new("/secrets")
  bindings_path = secrets_path.join("bindings")
  return {} if !bindings_path.exist? || bindings_path.directory?

  bindings_path.read.split("\0").to_h do |entry|
    from, to = entry.split("=", 2)
    from_path = secrets_path.join(from)
    to_path = Pathname.new(File.expand_path(to))
    [from_path, to_path]
  end
end

.mounts!Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cocov/plugin_kit/realloc.rb', line 20

def self.mounts!
  bindings.each do |from_path, to_path|
    unless from_path.exist?
      puts "Expected binding of #{from_path} to exist, but could not locate it"
      exit 1
    end

    to_path.dirname.mkpath

    FileUtils.cp from_path, to_path
  end
end