Module: Librarian::Puppet::Simple::Util
Instance Method Summary collapse
-
#base_dir ⇒ Object
figure out what directory we are working out og.
- #forge(repo) ⇒ Object
-
#module_path(dir = base_dir) ⇒ Object
figure out what the modulepath is.
- #print_verbose(text) ⇒ Object
-
#system_cmd(cmd, print_output = false) ⇒ Object
run a command on the system.
Instance Method Details
#base_dir ⇒ Object
figure out what directory we are working out og
14 15 16 |
# File 'lib/librarian/puppet/simple/util.rb', line 14 def base_dir @base_dir ||= Dir.pwd end |
#forge(repo) ⇒ Object
10 11 12 |
# File 'lib/librarian/puppet/simple/util.rb', line 10 def forge(repo) # this does nothing atm end |
#module_path(dir = base_dir) ⇒ Object
figure out what the modulepath is
19 20 21 22 23 24 25 26 27 28 29 |
# 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. @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) ⇒ Object
44 45 46 |
# File 'lib/librarian/puppet/simple/util.rb', line 44 def print_verbose(text) puts text if @verbose end |
#system_cmd(cmd, print_output = false) ⇒ Object
run a command on the system
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/librarian/puppet/simple/util.rb', line 32 def system_cmd (cmd, print_output=false) print_verbose "Running cmd: #{cmd}" output = `#{cmd}`.split("\n") if print_output puts output else print_verbose output end raise(StandardError, "Cmd #{cmd} failed") unless $?.success? output end |