class PuppetModule::Pkg::Tasks::System

Public Instance Methods

cp(src, dest) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 9
def cp(src, dest)
  FileUtils.cp_r only_existing_entries_of(ensure_array(src)), dest
end
ls(path) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 22
def ls(path)
  Dir.new(path).entries.reject { |d| d =~ /^\.*$/ }
end
mkdir(path) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 5
def mkdir(path)
  FileUtils.mkdir_p path
end
rm(path) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 13
def rm(path)
  FileUtils.rm_rf path
end
sh(cmd) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 17
def sh(cmd)
  # TODO: This should be supported through an external logger!
  puts `#{cmd}`
end

Private Instance Methods

ensure_array(src) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 28
def ensure_array(src)
  src.is_a?(Range) ? src.to_a : src
end
only_existing_entries_of(src) click to toggle source
# File lib/puppet_module/pkg/tasks/system.rb, line 32
def only_existing_entries_of(src)
  src.select { |f| File.exists? f }
end