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 =
'5.23.0'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir = Dir.pwd) ⇒ Helpers

dir = top-level of project,



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

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



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

def self.check_required_commands(required_commands)
  require 'facter'

  invalid_commands = Array.new

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

  unless 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
end