Sha256: 6e1f0af51bff42388522ad16c1549f01e9b308f3f3f28dcf219d26b0f825fb34

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 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.length

Version data entries

2 entries across 2 versions & 1 rubygems

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