Sha256: 582f1e7c6b39d8ed5004696693108ca756b7bc0472c322d4fd49f6343a58baa9
Contents?: true
Size: 1.03 KB
Versions: 21
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true # Is this Bolt::Pobs::Module? module Bolt class Module CONTENT_NAME_REGEX = /\A[a-z][a-z0-9_]*(::[a-z][a-z0-9_]*)*\z/.freeze MODULE_NAME_REGEX = /\A[a-z][a-z0-9_]*\z/.freeze def self.discover(modulepath) modulepath.each_with_object({}) do |path, mods| next unless File.exist?(path) && File.directory?(path) Dir.children(path) .map { |dir| File.join(path, dir) } .select { |dir| File.directory?(dir) } .each do |dir| module_name = File.basename(dir) if module_name =~ MODULE_NAME_REGEX # Puppet will load some objects from shadowed modules but this won't mods[module_name] ||= Bolt::Module.new(module_name, dir) end end end end attr_reader :name, :path def initialize(name, path) @name = name @path = path end def plugin_data_file File.join(path, 'bolt_plugin.json') end def plugin? File.exist?(plugin_data_file) end end end
Version data entries
21 entries across 21 versions & 1 rubygems