module Berktacular
This module contains classes that allow for generating Berksfiles from chef environment files.
Constants
- VERSION
the gem version.
- VERSION_RE
Matches the numeric version information from a tag.
Public Class Methods
best_temp_dir()
click to toggle source
@return [String] the best tmpdir to use for this machine. Prefers /dev/shm if available.
# File lib/berktacular.rb, line 26 def self.best_temp_dir require 'tempfile' tmp = if File.directory?("/dev/shm") && File.writable?("/dev/shm") '/dev/shm' else '/tmp' end pat = [ Time.now().strftime('%Y_%m_%d-%H.%M.%S_'), '_berktacular' ] Dir.mktmpdir(pat, tmp) end
deep_copy(h)
click to toggle source
@param h [Object] does a deep copy of whatever is passed in. @return [Object] a deep copy of the passed in object.
# File lib/berktacular.rb, line 11 def self.deep_copy(h) Marshal.load(Marshal.dump(h)) end
run_command(cmd)
click to toggle source
@param [String] a command to run. @return [True] or raise on failure.
# File lib/berktacular.rb, line 17 def self.run_command(cmd) puts "Running command: #{cmd}" unless system(cmd) raise "Command failed with exit code #{$?.exitstatus}: #{cmd}" end true end