Class: VagrantRubydns::DependentVMs

Inherits:
Object
  • Object
show all
Extended by:
Enumerable
Defined in:
lib/vagrant-rubydns/dependent_vms.rb

Class Method Summary collapse

Class Method Details

.add(machine) ⇒ Object



16
17
18
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 16

def self.add(machine)
  FileUtils.touch(file_for(machine))
end

.clear!Object



28
29
30
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 28

def self.clear!
  dir.rmtree
end

.dirObject



36
37
38
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 36

def self.dir
  VagrantRubydns.working_dir.join('dependent_vms').tap(&:mkpath)
end

.each(&block) ⇒ Object



12
13
14
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 12

def self.each(&block)
  (dir.directory? ? dir.children : []).each(&block)
end

.file_for(machine) ⇒ Object



32
33
34
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 32

def self.file_for(machine)
  dir.join(Util.hostname(machine))
end

.listObject



24
25
26
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 24

def self.list
  self.map { |path| path.basename.to_s }
end

.remove(machine) ⇒ Object



20
21
22
# File 'lib/vagrant-rubydns/dependent_vms.rb', line 20

def self.remove(machine)
  file_for(machine).tap { |f| f.delete if f.exist? }
end