Class: Landrush::DependentVMs
- Inherits:
-
Object
- Object
- Landrush::DependentVMs
- Extended by:
- Enumerable
- Defined in:
- lib/landrush/dependent_vms.rb
Class Method Summary collapse
- .add(hostname) ⇒ Object
- .clear! ⇒ Object
- .dir ⇒ Object
- .each(&block) ⇒ Object
- .file_for(hostname) ⇒ Object
- .list ⇒ Object
- .remove(hostname) ⇒ Object
Class Method Details
.add(hostname) ⇒ Object
16 17 18 |
# File 'lib/landrush/dependent_vms.rb', line 16 def self.add(hostname) FileUtils.touch(file_for(hostname)) end |
.clear! ⇒ Object
28 29 30 |
# File 'lib/landrush/dependent_vms.rb', line 28 def self.clear! dir.rmtree end |
.dir ⇒ Object
36 37 38 |
# File 'lib/landrush/dependent_vms.rb', line 36 def self.dir Server.working_dir.join('dependent_vms').tap(&:mkpath) end |
.each(&block) ⇒ Object
12 13 14 |
# File 'lib/landrush/dependent_vms.rb', line 12 def self.each(&block) (dir.directory? ? dir.children : []).each(&block) end |
.file_for(hostname) ⇒ Object
32 33 34 |
# File 'lib/landrush/dependent_vms.rb', line 32 def self.file_for(hostname) dir.join(hostname) end |
.list ⇒ Object
24 25 26 |
# File 'lib/landrush/dependent_vms.rb', line 24 def self.list map { |path| path.basename.to_s } end |
.remove(hostname) ⇒ Object
20 21 22 |
# File 'lib/landrush/dependent_vms.rb', line 20 def self.remove(hostname) file_for(hostname).tap { |f| f.delete if f.exist? } end |