Class: Puppet::Provider::PortageFile

Inherits:
ParsedFile
  • Object
show all
Defined in:
lib/puppet/provider/portagefile.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_line(hash, sym) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/puppet/provider/portagefile.rb', line 17

def self.build_line(hash, sym)
  unless hash[:name] and hash[:name] != :absent
    raise ArgumentError, "name is a required attribute of portagefile providers"
  end

  str = hash[:name].dup

  if hash.include? sym
    if hash[sym].is_a? Array
      str << " " << hash[sym].join(" ")
    else
      str << " " << hash[sym]
    end
  end
  str
end

Instance Method Details

#flushObject



9
10
11
12
13
14
15
# File 'lib/puppet/provider/portagefile.rb', line 9

def flush
  # Ensure the target directory exists before creating file
  unless File.exist?(dir = File.dirname(target))
    Dir.mkdir(dir)
  end
  super
end