Sha256: e67bd5be255a507ba771d1711194a4f008953a3d65e3d5f76f2b69facb5f42f8

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

#! /bin/env ruby

files = `git --no-pager diff --name-only HEAD HEAD~1`.split("\n")
classes = []

files.each do |file|
  # if the changed file is a manifest
  if file =~ /\.pp$/
    segments = file.split('/')
    # Capitalize the segments so that they work as a reference
    segments = segments.map { |seg| seg.capitalize }
    # Get the name of the module
    mod = segments[segments.index('Manifests') - 1]
    # Delete everything up to & including manifests
    segments = segments - segments[0..segments.index('Manifests')]
    # Get the final section
    final = segments.last.chomp('.pp')
    # Delete it
    segments.delete(segments.last)
    # Get anything taht is left
    intermediary = segments
    classes << [mod,intermediary,final].flatten.join('::')
  end
end

puts classes if classes.length > 0

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onceover-4.0.0 spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb
onceover-3.22.0 spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb