module Traveler::Util
Public Instance Methods
appdir(*args)
click to toggle source
# File lib/traveler/util.rb, line 6 def appdir *args File.join(PWD, *args.flatten.map(&:to_s)) end
fail(reason = nil, caller = nil)
click to toggle source
# File lib/traveler/util.rb, line 33 def fail reason = nil, caller = nil buffer = [] buffer << error(:error.icon, ' ', reason) if reason buffer << info(' in %s' % caller.to_s.gsub(/.*:(\d+):in.*/, CONFIGFILE + ':\1')) if caller puts(*buffer) if buffer.any? exit(1) end
rubydir(*args)
click to toggle source
# File lib/traveler/util.rb, line 10 def rubydir *args appdir(FOLDER_NAME, *args) end
sh(*args)
click to toggle source
# File lib/traveler/util.rb, line 41 def sh *args puts '$ ' << info(cmd = args.map(&:to_s).join(" ")) PTY.spawn cmd do |r, w, pid| begin r.sync r.each_char {|c| print(c)} rescue Errno::EIO => e ensure _, status = Process.wait2(pid) fail('Exiting...') unless status == 0 end end end
skeldir(*args)
click to toggle source
# File lib/traveler/util.rb, line 14 def skeldir *args File.join(SKEL_PATH, *args.flatten.map(&:to_s)) end