Module: Ra10ke::Validate

Included in:
RakeTask
Defined in:
lib/ra10ke/validate.rb

Defined Under Namespace

Classes: Validation

Constant Summary collapse

GOOD_EMOJI =
ENV['GOOD_EMOJI'] || '👍'
BAD_EMOJI =
ENV['BAD_EMOJI'] || '😨'

Instance Method Summary collapse

Instance Method Details

#define_task_validateObject

Validate the git urls and refs



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ra10ke/validate.rb', line 15

def define_task_validate(*)
  desc 'Validate the git urls and branches, refs, or tags'
  task :validate do
    gitvalididation = Ra10ke::Validate::Validation.new(get_puppetfile.puppetfile_path)
    exit_code = 0
    if gitvalididation.bad_mods?
      exit_code = 1
      message = BAD_EMOJI + '  Not all modules in the Puppetfile are valid. '.red + BAD_EMOJI
    else
      message = GOOD_EMOJI + '  Puppetfile looks good. '.green + GOOD_EMOJI
    end
    tp gitvalididation.sorted_mods, :name, { url: { width: 50 } }, :ref, :status
    abort(message) if exit_code.positive?
    puts message
  end
end