module Librarian::Puppet::Simple::Util
Public Instance Methods
base_dir()
click to toggle source
figure out what directory we are working out og
# File lib/librarian/puppet/simple/util.rb, line 14 def base_dir @base_dir ||= Dir.pwd end
forge(repo)
click to toggle source
# File lib/librarian/puppet/simple/util.rb, line 10 def forge(repo) # this does nothing atm end
module_path(dir=base_dir)
click to toggle source
figure out what the modulepath is
# File lib/librarian/puppet/simple/util.rb, line 19 def module_path(dir=base_dir) unless @module_path if @custom_module_path @module_path = File.expand_path @custom_module_path else @module_path = File.join(dir, 'modules') end Dir.mkdir(@module_path) unless File.exists?(@module_path) end @module_path end
print_verbose(text)
click to toggle source
# File lib/librarian/puppet/simple/util.rb, line 44 def print_verbose(text) puts text if @verbose end
system_cmd(cmd, print_output=false)
click to toggle source
run a command on the system
# File lib/librarian/puppet/simple/util.rb, line 32 def system_cmd (cmd, print_output=false) print_verbose "Running cmd: #{cmd}" output = %x#{cmd}`.split("\n") if print_output puts output else print_verbose output end raise(StandardError, "Cmd #{cmd} failed") unless $?.success? output end