Module: KnifeCssh
- Defined in:
- lib/knife-cssh.rb,
lib/chef/knife/cssh-summon.rb
Defined Under Namespace
Classes: CsshSummon
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.find_command(*cmds) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/chef/knife/cssh-summon.rb', line 20 def self.find_command(*cmds) cmd = self.which *cmds return cmd if not cmd.nil? nil end |
.which(*cmds) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/chef/knife/cssh-summon.rb', line 5 def self.which(*cmds) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] cmds.each do |cmd| 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 end return nil end |