Sha256: ebf5a31684ddfbc1a7fb089a6478d05cb1a1cb17fe1d5fa975b8cb065c00684d

Contents?: true

Size: 794 Bytes

Versions: 10

Compression:

Stored size: 794 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

10 entries across 10 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta18 lib/serverspec/type/command.rb
serverspec-2.0.0.beta17 lib/serverspec/type/command.rb
serverspec-2.0.0.beta16 lib/serverspec/type/command.rb
serverspec-2.0.0.beta15 lib/serverspec/type/command.rb
serverspec-2.0.0.beta14 lib/serverspec/type/command.rb
serverspec-2.0.0.beta13 lib/serverspec/type/command.rb
serverspec-2.0.0.beta12 lib/serverspec/type/command.rb
serverspec-2.0.0.beta11 lib/serverspec/type/command.rb
serverspec-2.0.0.beta10 lib/serverspec/type/command.rb
serverspec-2.0.0.beta9 lib/serverspec/type/command.rb