Sha256: 4bfb0b5ce6b82f241e85c96a5d69fbebec446cf7e4c2cc81c13cf99c70e31f51
Contents?: true
Size: 739 Bytes
Versions: 2
Compression:
Stored size: 739 Bytes
Contents
require 'mixlib/shellout' module ThorSCMVersion class ShellUtils class << self def secure_password password = String.new while password.length < 20 password << ::OpenSSL::Random.random_bytes(1).gsub(/\W/, '') end password end def sh(cmd, dir = '.', &block) out, code = sh_with_excode(cmd, dir, &block) code == 0 ? out : raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out) end def sh_with_excode(cmd, dir = '.', &block) command = Mixlib::ShellOut.new(cmd << " 2>&1", :cwd => dir) command.run_command [command.stdout, command.exitstatus] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thor-scmversion-1.7.0 | lib/thor-scmversion/shell_utils.rb |
thor-scmversion-1.6.0 | lib/thor-scmversion/shell_utils.rb |