Sha256: 615ef8d1b8d78189bd9dc886f833591142a70c1dd2276703238b993a76063cc3

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/error'
require 'systemu'

module Webgen
  module Utils

    # This module provides methods for easily working with external commands.
    module ExternalCommand

      # Raise an error if the given command is not available.
      #
      # This just checks if the exit status is zero.
      def self.ensure_available!(cmd, *args)
        status = systemu([cmd, *args], 'stdout' => '')
        raise Webgen::CommandNotFoundError.new(cmd) if status.exitstatus != 0
      end

    end

  end
end




Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 lib/webgen/utils/external_command.rb
webgen-1.0.0.beta2 lib/webgen/utils/external_command.rb
webgen-1.0.0.beta1 lib/webgen/utils/external_command.rb