Class: Simp::Rake::Helpers

Inherits:
Object
  • Object
show all
Defined in:
lib/simp/rake/helpers.rb,
lib/simp/rake/helpers/version.rb,
lib/simp/rake/helpers/rpm_spec.rb

Defined Under Namespace

Modules: RPMSpec

Constant Summary collapse

VERSION =
'6.0.0'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir = Dir.pwd) ⇒ Helpers

dir = top-level of project,



11
12
13
14
15
16
17
# File 'lib/simp/rake/helpers.rb', line 11

def initialize(dir = Dir.pwd)
  Simp::Rake::Pkg.new(dir) do |t|
    t.clean_list << "#{t.base_dir}/spec/fixtures/hieradata/hiera.yaml"
  end

  Simp::Rake::Fixtures.new(dir)
end

Class Method Details

.check_required_commands(required_commands) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/simp/rake/helpers.rb', line 19

def self.check_required_commands(required_commands)
  require 'facter'

  invalid_commands = []

  Array(required_commands).each do |command|
    unless Array(command).find { |x| Facter::Core::Execution.which(x) }
      invalid_commands << Array(command).join(' or ')
    end
  end

  return if invalid_commands.empty?

  errmsg = <<-EOM
Error: The following required commands were not found on your system:

* #{invalid_commands.join("\n  * ")}

Please update your system and try again.
  EOM

  raise(errmsg)
end