Sha256: 2d561051f151c0003a51e3e68a25b2055889c45c462b3492e1c0d8c554f1ef05
Contents?: true
Size: 897 Bytes
Versions: 3
Compression:
Stored size: 897 Bytes
Contents
module RubyClock::Shell def shell_runner @shell_runner ||= begin require 'terrapin' require 'posix-spawn' unless Terrapin::CommandLine.runner.class == Terrapin::CommandLine::PosixRunner puts <<~MESSAGE 🤷 terrapin and posix-spawn are installed, but for some reason terrapin is not using posix-spawn as its runner. MESSAGE end puts '🐆 Using terrapin for shell commands.' :terrapin rescue LoadError puts <<~MESSAGE 🦥 Using ruby backticks for shell commands. For better performance, install the terrapin and posix-spawn gems. See README.md for more info. MESSAGE :backticks end end def shell(command) case shell_runner when :terrapin Terrapin::CommandLine.new(command).run when :backticks `#{command}` end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-clock-2.0.0.beta6 | lib/ruby-clock/shell.rb |
ruby-clock-2.0.0.beta5 | lib/ruby-clock/shell.rb |
ruby-clock-2.0.0.beta4 | lib/ruby-clock/shell.rb |