Sha256: ccc06b6f24ca4d3fe8bd8bc00fc9e4bf0b32176b2384a68531352257b79357e4

Contents?: true

Size: 819 Bytes

Versions: 102

Compression:

Stored size: 819 Bytes

Contents

# encoding: utf-8

require 'utils/command_wrapper'
require 'resources/command'

module Inspec::Resources
  class Bash < Cmd
    name 'bash'
    supports platform: 'unix'
    desc 'Run a command or script in BASH.'
    example "
      describe bash('ls -al /') do
        its('stdout') { should match /bin/ }
        its('stderr') { should eq '' }
        its('exit_status') { should eq 0 }
      end

      # Specify the path of the executable:
      bash('...', path: '/bin/bash')

      # Specify arguments (defaults to -c)
      bash('...', args: '-x -c')
    "

    def initialize(command, options = {})
      @raw_command = command
      options[:shell] = 'bash' if options.is_a?(Hash)
      super(CommandWrapper.wrap(command, options))
    end

    def to_s
      "Bash command #{@raw_command}"
    end
  end
end

Version data entries

102 entries across 102 versions & 2 rubygems

Version Path
inspec-core-3.7.1 lib/resources/bash.rb
inspec-3.7.1 lib/resources/bash.rb
inspec-core-3.6.6 lib/resources/bash.rb
inspec-3.6.6 lib/resources/bash.rb
inspec-core-3.6.4 lib/resources/bash.rb
inspec-3.6.4 lib/resources/bash.rb
inspec-core-2.3.28 lib/resources/bash.rb
inspec-2.3.28 lib/resources/bash.rb
inspec-core-3.6.2 lib/resources/bash.rb
inspec-3.6.2 lib/resources/bash.rb
inspec-core-3.5.0 lib/resources/bash.rb
inspec-3.5.0 lib/resources/bash.rb
inspec-core-3.4.1 lib/resources/bash.rb
inspec-3.4.1 lib/resources/bash.rb
inspec-core-3.3.14 lib/resources/bash.rb
inspec-3.3.14 lib/resources/bash.rb
inspec-core-3.2.6 lib/resources/bash.rb
inspec-3.2.6 lib/resources/bash.rb
inspec-core-3.1.3 lib/resources/bash.rb
inspec-3.1.3 lib/resources/bash.rb