Sha256: 111b24cfb1f1758c0885930681b3ff0beafa7ebeda9445017dd2a35017d983a1

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

require 'confctl/utils/file'
require 'etc'
require 'fileutils'

module ConfCtl
  module GCRoot
    extend Utils::File

    def self.dir
      File.join(
        '/nix/var/nix/gcroots/per-user',
        Etc.getlogin,
        "confctl-#{ConfDir.short_hash}"
      )
    end

    def self.exist?(name)
      File.symlink?(File.join(dir, name))
    end

    def self.add(name, path)
      FileUtils.mkdir_p(dir)
      File.symlink(path, File.join(dir, name))
    end

    def self.remove(name)
      unlink_if_exists(File.join(dir, name))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
confctl-2.0.0 lib/confctl/gcroot.rb
confctl-1.0.0 lib/confctl/gcroot.rb