Sha256: 8bed8d34a289cdf0691179d9fd501547bf70e539a66e8d50891062bf64871605
Contents?: true
Size: 1.48 KB
Versions: 24
Compression:
Stored size: 1.48 KB
Contents
module LanguagePack module ShellHelpers # display error message and stop the build process # @param [String] error message def error(message) Kernel.puts " !" message.split("\n").each do |line| Kernel.puts " ! #{line.strip}" end Kernel.puts " !" log "exit", :error => message exit 1 end # run a shell comannd and pipe stderr to stdout # @param [String] command to be run # @return [String] output of stdout and stderr def run(command) %x{ #{command} 2>&1 } end # run a shell command and pipe stderr to /dev/null # @param [String] command to be run # @return [String] output of stdout def run_stdout(command) %x{ #{command} 2>/dev/null } end # run a shell command and stream the output # @param [String] command to be run def pipe(command) output = "" IO.popen(command) do |io| until io.eof? buffer = io.gets output << buffer puts buffer end end output end # display a topic message # (denoted by ----->) # @param [String] topic message to be displayed def topic(message) Kernel.puts "-----> #{message}" $stdout.flush end # display a message in line # (indented by 6 spaces) # @param [String] message to be displayed def puts(message) message.split("\n").each do |line| super " #{line.strip}" end $stdout.flush end end end
Version data entries
24 entries across 24 versions & 1 rubygems