Sha256: 1155ac949db0a53ae4c42bf73ad748e9a427f6bc0879e9838a1c424a642192fc
Contents?: true
Size: 702 Bytes
Versions: 4
Compression:
Stored size: 702 Bytes
Contents
require 'fileutils' class Helpers def self.get_module_name module_name = nil Dir["manifests/*.pp"].entries.each do |manifest| module_name = get_module_name_from_file(manifest) break unless module_name.nil? end module_name end def self.get_module_name_from_file(file) p = Puppet::Parser::Lexer.new module_name = nil p.string = File.read(file) tokens = p.fullscan i = tokens.index { |token| [:CLASS, :DEFINE].include? token.first } unless i.nil? module_name = tokens[i + 1].last[:value].split('::').first end module_name end def self.is_module_dir?(dir) Dir[File.join(dir,"*")].entries.include? "manifests" end end
Version data entries
4 entries across 4 versions & 1 rubygems