Sha256: 99c500bc4b90e5baf118c4f3adf58c08c0499e3ce47feb0687645deaf0dcf485

Contents?: true

Size: 581 Bytes

Versions: 19

Compression:

Stored size: 581 Bytes

Contents

require 'awesome_spawn'

module LinuxAdmin
  module Common
    include Logging

    BIN_DIRS = %w(/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin)

    def self.cmd(name)
      BIN_DIRS.collect { |dir| "#{dir}/#{name}" }.detect { |cmd| File.exist?(cmd) }
    end

    def self.cmd?(name)
      !cmd(name).nil?
    end

    def self.run(cmd, options = {})
      AwesomeSpawn.logger ||= logger
      AwesomeSpawn.run(cmd, options)
    end

    def self.run!(cmd, options = {})
      AwesomeSpawn.logger ||= logger
      AwesomeSpawn.run!(cmd, options)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
linux_admin-2.0.2 lib/linux_admin/common.rb
linux_admin-2.0.1 lib/linux_admin/common.rb
linux_admin-2.0.0 lib/linux_admin/common.rb
linux_admin-1.2.4 lib/linux_admin/common.rb
linux_admin-1.2.3 lib/linux_admin/common.rb
linux_admin-1.2.2 lib/linux_admin/common.rb
linux_admin-1.2.1 lib/linux_admin/common.rb
linux_admin-1.0.1 lib/linux_admin/common.rb
linux_admin-1.2.0 lib/linux_admin/common.rb
linux_admin-1.1.0 lib/linux_admin/common.rb
linux_admin-1.0.0 lib/linux_admin/common.rb
linux_admin-0.20.2 lib/linux_admin/common.rb
linux_admin-0.20.1 lib/linux_admin/common.rb
linux_admin-0.20.0 lib/linux_admin/common.rb
linux_admin-0.19.0 lib/linux_admin/common.rb
linux_admin-0.18.0 lib/linux_admin/common.rb
linux_admin-0.17.0 lib/linux_admin/common.rb
linux_admin-0.16.0 lib/linux_admin/common.rb
linux_admin-0.15.0 lib/linux_admin/common.rb