Module: Hardhat::System

Extended by:
Hardhat
Defined in:
lib/hardhat/system.rb

Constant Summary

Constants included from Hardhat

PREFIX, VERSION

Class Method Summary collapse

Methods included from Hardhat

error, inform, warn

Class Method Details

.has?(command) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/hardhat/system.rb', line 4

def self.has?(command)
  [*command].map do |cmd|
    system "command -v #{cmd} > /dev/null 2>&1"
  end.all?
end

.prompt_sudo(string) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/hardhat/system.rb', line 10

def self.prompt_sudo(string)
  if system "sudo -k true"
    inform string
  else
    error "couldn't execute sudo"
    exit 1
  end
end