Class: GameDig::Helper
- Inherits:
-
Object
- Object
- GameDig::Helper
- Defined in:
- lib/game_dig/helper.rb
Class Method Summary collapse
-
.cli_installed? ⇒ Boolean
Check if gamedig cli is installed globally.
-
.which(cmd) ⇒ Object
—————————————————————————————————-.
Class Method Details
.cli_installed? ⇒ Boolean
Check if gamedig cli is installed globally
11 12 13 |
# File 'lib/game_dig/helper.rb', line 11 def self.cli_installed?() !!(which 'gamedig') end |
.which(cmd) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/game_dig/helper.rb', line 17 def self.which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable?(exe) && !File.directory?(exe) end end nil end |