Sha256: f744814893876736318ac7aa4b097323b39593f4c77a5f7717732bbefee38fad

Contents?: true

Size: 787 Bytes

Versions: 22

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 ||= backend.run_command(@name)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
serverspec-1.16.0 lib/serverspec/type/command.rb
serverspec-1.15.0 lib/serverspec/type/command.rb
serverspec-1.14.0 lib/serverspec/type/command.rb
serverspec-1.13.0 lib/serverspec/type/command.rb
serverspec-1.12.0 lib/serverspec/type/command.rb
serverspec-1.11.0 lib/serverspec/type/command.rb
serverspec-1.10.0 lib/serverspec/type/command.rb
serverspec-1.9.1 lib/serverspec/type/command.rb
serverspec-1.9.0 lib/serverspec/type/command.rb
serverspec-1.8.0 lib/serverspec/type/command.rb
serverspec-1.7.1 lib/serverspec/type/command.rb
serverspec-1.7.0 lib/serverspec/type/command.rb
serverspec-1.6.0 lib/serverspec/type/command.rb
serverspec-1.5.0 lib/serverspec/type/command.rb
serverspec-2.0.0.beta2 lib/serverspec/type/command.rb
serverspec-1.4.2 lib/serverspec/type/command.rb
serverspec-2.0.0.beta1 lib/serverspec/type/command.rb
serverspec-1.4.1 lib/serverspec/type/command.rb
serverspec-1.4.0 lib/serverspec/type/command.rb
serverspec-1.3.0 lib/serverspec/type/command.rb