Sha256: e4bfbf31e630e3e81a65148faf60dbd53f7a3909b14a733ebdab9d70b6da0403
Contents?: true
Size: 1.36 KB
Versions: 9
Compression:
Stored size: 1.36 KB
Contents
module Timber class CLI module OSHelper def self.can_copy_to_clipboard? `which pbcopy` != "" rescue Exception false end def self.copy_to_clipboard(input) ::IO.popen('pbcopy', 'w') { |f| f << input } true rescue Exception false end def self.git_commit_changes begin `git add config/initializers/timber.rb` rescue Exception end `git commit -am 'Install the timber logger'` true rescue Exception false end def self.has_git? begin `which git` != "" rescue Exception false end end def self.can_open? begin `which #{open_command}` != "" rescue Exception false end end # Attemps to open a URL in the user's default browser across # the popular operating systems. def self.open(link) `#{open_command} #{link}` true rescue Exception false end private def self.open_command if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ "start" elsif RbConfig::CONFIG['host_os'] =~ /darwin/ "open" elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/ "xdg-open" end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems