Sha256: 41ec34b6a1b78d4640527f489faeb56a7234ab4320321f24e9b8cfa3f759533b
Contents?: true
Size: 558 Bytes
Versions: 135
Compression:
Stored size: 558 Bytes
Contents
module TerminalCommands def self.open_file_or_link(file_or_link, options = {}) command = if macosx? "open" elsif linux? "xdg-open" end `#{command} #{file_or_link}` end def self.os Gem::Platform.local.os end def self.macosx? os == macosx end def self.linux? os == linux end def self.can_open? (TerminalCommands.macosx? && `which open`.present?) || (TerminalCommands.linux? && `which xdg-open`.present?) end def self.macosx "darwin" end def self.linux "linux" end end
Version data entries
135 entries across 135 versions & 1 rubygems