Sha256: bc148e4093c09e3428f85ba82f8ca72e551fdc36c80108d47fe01bb9d19ea750

Contents?: true

Size: 787 Bytes

Versions: 6

Compression:

Stored size: 787 Bytes

Contents

module Serverspec
  module Type
    class Command < Base
      def return_stdout?(content)
        if content.instance_of?(Regexp)
          stdout =~ content
        else
          stdout.strip == content
        end
      end

      def return_stderr?(content)
        if content.instance_of?(Regexp)
          stderr =~ content
        else
          stderr.strip == content
        end
      end

      def return_exit_status?(status)
        exit_status == status
      end

      def stdout
        command_result.stdout
      end

      def stderr
        command_result.stderr
      end

      def exit_status
        command_result.exit_status.to_i
      end

      private

      def command_result()
	@command_result ||= @runner.run_command(@name)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta8 lib/serverspec/type/command.rb
serverspec-2.0.0.beta7 lib/serverspec/type/command.rb
serverspec-2.0.0.beta6 lib/serverspec/type/command.rb
serverspec-2.0.0.beta5 lib/serverspec/type/command.rb
serverspec-2.0.0.beta4 lib/serverspec/type/command.rb
serverspec-2.0.0.beta3 lib/serverspec/type/command.rb