Module: Beaker::DSL::Cowsay

Defined in:
lib/beaker-cowsay/cowsay.rb,
lib/beaker-cowsay/version.rb

Defined Under Namespace

Modules: Version

Instance Method Summary collapse

Instance Method Details

#cowsay(host, quote) ⇒ Object

Runs cowsay command on a host


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/beaker-cowsay/cowsay.rb', line 6

def cowsay(host, quote)

  unless quote.is_a?(String)
    raise ArgumentError.new("The quote should be a string")
  end

  # Make cowsay command
  quote = 'cowsay ' + quote

  # Install cowsay and run the cowsay command
  on(host, quote) do |result|
    return result.stdout
  end
end

#install_cowsay_on(host) ⇒ Object

Installs cowsay on host unless it's is installed


22
23
24
# File 'lib/beaker-cowsay/cowsay.rb', line 22

def install_cowsay_on(host)
  install_package(host, 'cowsay') unless check_for_package(host, 'cowsay')
end