def validate_module_dir(dir)
      # first check to see if manifests directory even exists when path is nil
      if dir.nil?
        dir = '.'
      elsif dir.instance_of?(Array)
        puts 'Retrospec - an array of module paths is not supported at this time'.fatal
        raise Retrospec::Puppet::InvalidModulePathError
      end
      dir = File.expand_path(dir)
      manifest_dir = File.join(dir, 'manifests')
      if !File.exist?(manifest_dir)
        puts "No manifest directory in #{manifest_dir}, cannot validate this is a module".fatal
        raise Retrospec::Puppet::NoManifestDirError
      else
        files = Dir.glob("#{manifest_dir}/**/*.pp")
        warn "No puppet manifest files found at #{manifest_dir}".warning if files.length < 1
        # validate the manifest files, because if one files doesn't work it affects everything
        files.each do |file|
          begin
            parser.parse_file(file)
          rescue Puppet::ParseError
            puts "Manifest file: #{file} has parser errors, please fix and re-check using\n puppet parser validate #{file}".fatal
            raise Retrospec::Puppet::ParserError
          rescue SystemExit => e
            puts "Manifest file: #{file} has parser errors, please fix and re-check using\n puppet parser validate #{file}".fatal
            raise Retrospec::Puppet::ParserError
          end
        end
      end
      dir
    end
def validate_module_dir(dir)
      # first check to see if manifests directory even exists when path is nil
      if dir.nil?
        dir = '.'
      elsif dir.instance_of?(Array)
        puts 'Retrospec - an array of module paths is not supported at this time'.fatal
        raise Retrospec::Puppet::InvalidModulePathError
      end
      dir = File.expand_path(dir)
      manifest_dir = File.join(dir, 'manifests')
      if !File.exist?(manifest_dir)
        puts "No manifest directory in #{manifest_dir}, cannot validate this is a module".fatal
        raise Retrospec::Puppet::NoManifestDirError
      else
        files = Dir.glob("#{manifest_dir}/**/*.pp")
        warn "No puppet manifest files found at #{manifest_dir}".warning if files.length < 1
        # validate the manifest files, because if one files doesn't work it affects everything
        files.each do |file|
          begin
            parser.parse_file(file)
          rescue Puppet::ParseError
            puts "Manifest file: #{file} has parser errors, please fix and re-check using\n puppet parser validate #{file}".fatal
            raise Retrospec::Puppet::ParserError
          rescue SystemExit => e
            puts "Manifest file: #{file} has parser errors, please fix and re-check using\n puppet parser validate #{file}".fatal
            raise Retrospec::Puppet::ParserError
          end
        end
      end
      dir
    end
processes a directory and expands to its full path, assumes './'
 returns the validated dir