source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/serialization/extension.rb
Ruby
apache-2.0
7,843
main
3,833
# frozen_string_literal: true module Puppet::Pops module Serialization module Extension # 0x00 - 0x0F are reserved for low-level serialization / tabulation extensions # Tabulation internal to the low level protocol reader/writer INNER_TABULATION = 0x00 # Tabulation managed by the serializer / deserializer ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/serialization/to_data_converter.rb
Ruby
apache-2.0
7,843
main
11,358
# frozen_string_literal: true module Puppet::Pops module Serialization # Class that can process an arbitrary object into a value that is assignable to `Data`. # # @api public class ToDataConverter include Evaluator::Runtime3Support # Convert the given _value_ according to the given _options_ and retur...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_uri_type.rb
Ruby
apache-2.0
7,843
main
5,720
# frozen_string_literal: true module Puppet::Pops module Types class PURIType < PAnyType # Tell evaluator that an members of instances of this type can be invoked using dot notation include TypeWithMembers SCHEME = 'scheme' USERINFO = 'userinfo' HOST = 'host' PORT = 'port' PATH = 'path' QUERY = 'query...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_runtime_type.rb
Ruby
apache-2.0
7,843
main
3,580
# frozen_string_literal: true module Puppet::Pops module Types # @api public class PRuntimeType < PAnyType TYPE_NAME_OR_PATTERN = PVariantType.new([PStringType::NON_EMPTY, PTupleType.new([PRegexpType::DEFAULT, PStringType::NON_EMPTY])]) def self.register_ptype(loader, ir) create_ptype(loader, ir, 'AnyType', ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_sem_ver_range_type.rb
Ruby
apache-2.0
7,843
main
6,370
# frozen_string_literal: true module Puppet::Pops module Types # An unparameterized type that represents all VersionRange instances # # @api public class PSemVerRangeType < PAnyType def self.register_ptype(loader, ir) create_ptype(loader, ir, 'AnyType') end # Check if a version is included in a version rang...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_mismatch_describer.rb
Ruby
apache-2.0
7,843
main
37,102
# frozen_string_literal: true module Puppet::Pops module Types # @api private class TypePathElement attr_reader :key def initialize(key) @key = key end def hash key.hash end def ==(o) self.class == o.class && key == o.key end def eql?(o) self == o end...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/implementation_registry.rb
Ruby
apache-2.0
7,843
main
6,063
# frozen_string_literal: true module Puppet::Pops module Types # The {ImplementationRegistry} maps names types in the Puppet Type System to names of corresponding implementation # modules/classes. Each mapping is unique and bidirectional so that for any given type name there is only one # implementation and vice...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_init_type.rb
Ruby
apache-2.0
7,843
main
7,308
# frozen_string_literal: true module Puppet::Pops module Types # @api public class PInitType < PTypeWithContainedType def self.register_ptype(loader, ir) create_ptype(loader, ir, 'AnyType', 'type' => { KEY_TYPE => POptionalType.new(PTypeType::DEFAULT), KEY_V...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/annotatable.rb
Ruby
apache-2.0
7,843
main
865
# frozen_string_literal: true module Puppet::Pops module Types KEY_ANNOTATIONS = 'annotations' # Behaviour common to all Pcore annotatable classes # # @api public module Annotatable TYPE_ANNOTATIONS = PHashType.new(PTypeType.new(PTypeReferenceType.new('Annotation')), PHashType::DEFAULT) # @return [{PTypeType => ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_object_type.rb
Ruby
apache-2.0
7,843
main
41,030
# frozen_string_literal: true require_relative 'ruby_generator' require_relative 'type_with_members' module Puppet::Pops module Types KEY_ATTRIBUTES = 'attributes' KEY_CHECKS = 'checks' KEY_CONSTANTS = 'constants' KEY_EQUALITY = 'equality' KEY_EQUALITY_INCLUDE_TYPE = 'equality_include_type' KEY_FINAL = 'final' KEY_FU...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_calculator.rb
Ruby
apache-2.0
7,843
main
24,955
# frozen_string_literal: true require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Types # The TypeCalculator can answer questions about puppet types. # # The Puppet type system is primarily based on sub-classing. When asking the type calculator to infer types from Ruby in g...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/recursion_guard.rb
Ruby
apache-2.0
7,843
main
4,294
# frozen_string_literal: true module Puppet::Pops module Types # Keeps track of self recursion of conceptual 'this' and 'that' instances using two separate maps and # a state. The class is used when tracking self recursion in two objects ('this' and 'that') simultaneously. # A typical example of when this is needed is...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_object_type_extension.rb
Ruby
apache-2.0
7,843
main
6,901
# frozen_string_literal: true module Puppet::Pops module Types # Base class for Parameterized Object implementations. The wrapper impersonates the base # object and extends it with methods to filter assignable types and instances based on parameter # values. # # @api public class PObjectTypeExtension < PAnyType incl...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/iterable.rb
Ruby
apache-2.0
7,843
main
11,398
# frozen_string_literal: true module Puppet::Pops::Types # Implemented by classes that can produce an iterator to iterate over their contents module IteratorProducer def iterator raise ArgumentError, 'iterator() is not implemented' end end # The runtime Iterable type for an Iterable module Ite...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/types.rb
Ruby
apache-2.0
7,843
main
104,070
# frozen_string_literal: true require_relative 'iterable' require_relative 'recursion_guard' require_relative 'type_acceptor' require_relative 'type_asserter' require_relative 'type_assertion_error' require_relative 'type_conversion_error' require_relative 'type_formatter' require_relative 'type_calculator' require_re...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_meta_type.rb
Ruby
apache-2.0
7,843
main
2,769
# frozen_string_literal: true # @abstract base class for PObjectType and other types that implements lazy evaluation of content # @api private module Puppet::Pops module Types KEY_NAME = 'name' KEY_TYPE = 'type' KEY_VALUE = 'value' class PMetaType < PAnyType include Annotatable attr_reader :loader def self.re...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_acceptor.rb
Ruby
apache-2.0
7,843
main
771
# frozen_string_literal: true module Puppet::Pops module Types # Implements a standard visitor patter for the Puppet Type system. # # An instance of this module is passed as an argument to the {PAnyType#accept} # method of a Type instance. That type will then use the {TypeAcceptor#visit} callback # on the acceptor an...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_timespan_type.rb
Ruby
apache-2.0
7,843
main
6,003
# frozen_string_literal: true module Puppet::Pops module Types class PAbstractTimeDataType < PScalarType # @param from [AbstractTime] lower bound for this type. Nil or :default means unbounded # @param to [AbstractTime] upper bound for this type. Nil or :default means unbounded def initialize(from, to = ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_asserter.rb
Ruby
apache-2.0
7,843
main
2,160
# frozen_string_literal: true # Utility module for type assertion # module Puppet::Pops::Types module TypeAsserter # Asserts that a type_to_check is assignable to required_type and raises # a {Puppet::ParseError} if that's not the case # # @param subject [String,Array] String to be prepended to the exception m...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_formatter.rb
Ruby
apache-2.0
7,843
main
19,155
# frozen_string_literal: true require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Types # String # ------ # Creates a string representation of a type. # # @api public # class TypeFormatter extend Puppet::Concurrent::ThreadLocalSingleton # Produces a String representati...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_timestamp_type.rb
Ruby
apache-2.0
7,843
main
1,913
# frozen_string_literal: true module Puppet::Pops module Types class PTimestampType < PAbstractTimeDataType def self.register_ptype(loader, ir) create_ptype(loader, ir, 'ScalarType', 'from' => { KEY_TYPE => POptionalType.new(PTimestampType::DEFAULT), KEY_VALUE => nil }, ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_parser.rb
Ruby
apache-2.0
7,843
main
22,957
# frozen_string_literal: true require_relative '../../../puppet/concurrent/thread_local_singleton' # This class provides parsing of Type Specification from a string into the Type # Model that is produced by the TypeFactory. # # The Type Specifications that are parsed are the same as the stringified forms # of types p...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_set_reference.rb
Ruby
apache-2.0
7,843
main
1,749
# frozen_string_literal: true module Puppet::Pops module Types class TypeSetReference include Annotatable attr_reader :name_authority attr_reader :name attr_reader :version_range attr_reader :type_set def initialize(owner, init_hash) @owner = owner @name_authority = (init_hash[KEY_NAME_AUTHORITY]...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_sensitive_type.rb
Ruby
apache-2.0
7,843
main
1,556
# frozen_string_literal: true module Puppet::Pops module Types # A Puppet Language type that wraps sensitive information. The sensitive type is parameterized by # the wrapped value type. # # # @api public class PSensitiveType < PTypeWithContainedType class Sensitive def initialize(value) @value = value ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/string_converter.rb
Ruby
apache-2.0
7,843
main
39,151
# frozen_string_literal: true require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Types # Converts Puppet runtime objects to String under the control of a Format. # Use from Puppet Language is via the function `new`. # # @api private # class StringConverter # @api private...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/tree_iterators.rb
Ruby
apache-2.0
7,843
main
7,245
# frozen_string_literal: true module Puppet::Pops::Types module Iterable class TreeIterator include Iterable DEFAULT_CONTAINERS = TypeFactory.variant( PArrayType::DEFAULT, PHashType::DEFAULT, PObjectType::DEFAULT ) # Creates a TreeIterator that by default treats all Array, Hash and Object instanc...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_assertion_error.rb
Ruby
apache-2.0
7,843
main
797
# frozen_string_literal: true module Puppet::Pops::Types # Raised when an assertion of actual type against an expected type fails. # class TypeAssertionError < Puppet::Error # Returns the expected type # @return [PAnyType] expected type attr_reader :expected_type # Returns the actual type # ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_with_members.rb
Ruby
apache-2.0
7,843
main
1,268
# frozen_string_literal: true module Puppet::Pops module Types # Interface implemented by a type that has InvocableMembers module TypeWithMembers # @return [InvocableMember,nil] An invocable member if it exists, or `nil` def [](member_name) raise NotImplementedError, "'#{self.class.name}' should implement #[]"...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_type_set_type.rb
Ruby
apache-2.0
7,843
main
14,384
# frozen_string_literal: true module Puppet::Pops module Types KEY_NAME_AUTHORITY = 'name_authority' KEY_TYPES = 'types' KEY_ALIAS = 'alias' KEY_VERSION = 'version' KEY_VERSION_RANGE = 'version_range' KEY_REFERENCES = 'references' class PTypeSetType < PMetaType # A Loader that makes the types known to the TypeSet v...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/ruby_generator.rb
Ruby
apache-2.0
7,843
main
16,238
# frozen_string_literal: true module Puppet::Pops module Types # @api private class RubyGenerator < TypeFormatter RUBY_RESERVED_WORDS = { 'alias' => '_alias', 'begin' => '_begin', 'break' => '_break', 'def' => '_def', 'do' => '_do', 'end' => '_end', 'ensure' => '_ensure', 'for' => '_f...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/ruby_method.rb
Ruby
apache-2.0
7,843
main
1,084
# frozen_string_literal: true module Puppet::Pops module Types class RubyMethod < Annotation # Register the Annotation type. This is the type that all custom Annotations will inherit from. def self.register_ptype(loader, ir) @type = Pcore.create_object_type(loader, ir, self, 'RubyMethod', 'Annotation',...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/class_loader.rb
Ruby
apache-2.0
7,843
main
4,616
# frozen_string_literal: true module Puppet::Pops module Types # The ClassLoader provides a Class instance given a class name or a meta-type. # If the class is not already loaded, it is loaded using the Puppet Autoloader. # This means it can load a class from a gem, or from puppet modules. # class ClassLoader @autol...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/puppet_object.rb
Ruby
apache-2.0
7,843
main
964
# frozen_string_literal: true module Puppet::Pops module Types # Marker module for implementations that are mapped to Object types # @api public module PuppetObject # Returns the Puppet Type for this instance. The implementing class must # add the {#_pcore_type} as a class method. # # @return [PObjectType] the...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_binary_type.rb
Ruby
apache-2.0
7,843
main
7,626
# frozen_string_literal: true require 'base64' module Puppet::Pops module Types # A Puppet Language Type that represents binary data content (a sequence of 8-bit bytes). # Instances of this data type can be created from `String` and `Array[Integer[0,255]]` # values. Also see the `binary_file` function for reading bina...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/type_factory.rb
Ruby
apache-2.0
7,843
main
18,259
# frozen_string_literal: true module Puppet::Pops module Types # Helper module that makes creation of type objects simpler. # @api public # module TypeFactory @type_calculator = TypeCalculator.singleton # Clears caches - used when testing def self.clear # these types are cached and needs to be nulled as the...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/annotation.rb
Ruby
apache-2.0
7,843
main
2,740
# frozen_string_literal: true module Puppet::Pops module Types # Pcore variant of the Adaptable::Adapter. Uses a Pcore Object type instead of a Class class Annotation < Adaptable::Adapter include Types::PuppetObject CLEAR = 'clear' # Register the Annotation type. This is the type that all custom Anno...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/types/p_sem_ver_type.rb
Ruby
apache-2.0
7,843
main
4,633
# frozen_string_literal: true module Puppet::Pops module Types # A Puppet Language Type that exposes the {{SemanticPuppet::Version}} and {{SemanticPuppet::VersionRange}}. # The version type is parameterized with version ranges. # # @api public class PSemVerType < PScalarType def self.register_ptype(loader, ir) c...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/loader_paths.rb
Ruby
apache-2.0
7,843
main
11,601
# frozen_string_literal: true # LoaderPaths # === # The central loader knowledge about paths, what they represent and how to instantiate from them. # Contains helpers (*smart paths*) to deal with lazy resolution of paths. # # TODO: Currently only supports loading of functions (2 kinds) # module Puppet::Pops module Loa...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/gem_support.rb
Ruby
apache-2.0
7,843
main
2,105
# frozen_string_literal: true # GemSupport offers methods to find a gem's location by name or gem://gemname URI. # # TODO: The Puppet 3x, uses Puppet::Util::RubyGems to do this, and obtain paths, and avoids using ::Gems # when ::Bundler is in effect. A quick check what happens on Ruby 1.8.7 and Ruby 1.9.3 with current...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/dependency_loader.rb
Ruby
apache-2.0
7,843
main
3,431
# frozen_string_literal: true # =DependencyLoader # This loader provides visibility into a set of other loaders. It is used as a child of a ModuleLoader (or other # loader) to make its direct dependencies visible for loading from contexts that have access to this dependency loader. # Access is typically given to logic...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/generic_plan_instantiator.rb
Ruby
apache-2.0
7,843
main
1,089
# frozen_string_literal: true module Puppet::Pops module Loader # The GenericPlanInstantiator dispatches to either PuppetPlanInstantiator or a # yaml_plan_instantiator injected through the Puppet context, depending on # the type of the plan. # class GenericPlanInstantiator def self.create(loader, typed_name, source_...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/type_definition_instantiator.rb
Ruby
apache-2.0
7,843
main
4,067
# frozen_string_literal: true # The TypeDefinitionInstantiator instantiates a type alias or a type definition # module Puppet::Pops module Loader class TypeDefinitionInstantiator def self.create(loader, typed_name, source_ref, pp_code_string) # parse and validate parser = Parser::EvaluatingParser.new() m...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/task_instantiator.rb
Ruby
apache-2.0
7,843
main
1,834
# frozen_string_literal: true # The TypeDefinitionInstantiator instantiates a type alias or a type definition # require_relative '../../../puppet/module/task' module Puppet::Pops module Loader class TaskInstantiator def self.create(loader, typed_name, source_refs) name = typed_name.name basename = typed_name...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/typed_name.rb
Ruby
apache-2.0
7,843
main
1,366
# frozen_string_literal: true module Puppet::Pops module Loader # A namespace/name/type combination that can be used as a compound hash key # # @api public class TypedName attr_reader :hash attr_reader :type attr_reader :name_authority attr_reader :name attr_reader :name_parts attr_reader :compound_name ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb
Ruby
apache-2.0
7,843
main
3,857
# frozen_string_literal: true module Puppet::Pops module Loader # The PuppetResourceTypeImplInstantiator instantiates a Puppet::Pops::ResourceTypeImpl object. # given a Puppet Programming language source that when called evaluates the Puppet logic it contains. # class PuppetResourceTypeImplInstantiator # Produces an...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/ruby_function_instantiator.rb
Ruby
apache-2.0
7,843
main
2,790
# frozen_string_literal: true # The RubyFunctionInstantiator instantiates a Puppet::Functions::Function given the ruby source # that calls Puppet::Functions.create_function. # class Puppet::Pops::Loader::RubyFunctionInstantiator # Produces an instance of the Function class with the given typed_name, or fails with an...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/static_loader.rb
Ruby
apache-2.0
7,843
main
3,238
# frozen_string_literal: true # Static Loader contains constants, basic data types and other types required for the system # to boot. # module Puppet::Pops module Loader class StaticLoader < Loader BUILTIN_TYPE_NAMES = %w[ Component Exec File Filebucket Group Node Notify Package R...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/puppet_plan_instantiator.rb
Ruby
apache-2.0
7,843
main
4,821
# frozen_string_literal: true module Puppet::Pops module Loader # The PuppetPlanInstantiator instantiates a Puppet::Functions::PuppetFunction given a Puppet Programming language # source that when called evaluates the Puppet logic it contains. # class PuppetPlanInstantiator # Produces an instance of the Function cla...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/predefined_loader.rb
Ruby
apache-2.0
7,843
main
724
# frozen_string_literal: true module Puppet::Pops::Loader # A PredefinedLoader is a loader that is manually populated with loaded elements # before being used. It never loads anything on its own. # class PredefinedLoader < BaseLoader def find(typed_name) nil end def to_s "(PredefinedLoader '#{loader_nam...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/loader.rb
Ruby
apache-2.0
7,843
main
8,376
# frozen_string_literal: true # Loader # === # A Loader is responsible for loading "entities" ("instantiable and executable objects in the puppet language" which # are type, hostclass, definition, function, and bindings. # # The main method for users of a Loader is the `load` or `load_typed methods`, which returns a p...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/module_loaders.rb
Ruby
apache-2.0
7,843
main
22,834
# frozen_string_literal: true module Puppet::Pops module Loader # =ModuleLoaders # A ModuleLoader loads items from a single module. # The ModuleLoaders (ruby) module contains various such loaders. There is currently one concrete # implementation, ModuleLoaders::FileBased that loads content from the file system. # Othe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/uri_helper.rb
Ruby
apache-2.0
7,843
main
770
# frozen_string_literal: true module Puppet::Pops::Loader::UriHelper # Raises an exception if specified gem can not be located # def path_for_uri(uri, subdir = 'lib') case uri.scheme when "gem" begin spec = Gem::Specification.find_by_name(uri.hostname) # if path given append that, e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/ruby_data_type_instantiator.rb
Ruby
apache-2.0
7,843
main
2,317
# frozen_string_literal: true # The RubyTypeInstantiator instantiates a data type from the ruby source # that calls Puppet::DataTypes.create_type. # class Puppet::Pops::Loader::RubyDataTypeInstantiator # Produces an instance of class derived from PAnyType class with the given typed_name, or fails with an error if th...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/puppet_function_instantiator.rb
Ruby
apache-2.0
7,843
main
4,450
# frozen_string_literal: true module Puppet::Pops module Loader # The PuppetFunctionInstantiator instantiates a Puppet::Functions::PuppetFunction given a Puppet Programming language # source that when called evaluates the Puppet logic it contains. # class PuppetFunctionInstantiator # Produces an instance of the Func...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/runtime3_type_loader.rb
Ruby
apache-2.0
7,843
main
3,521
# frozen_string_literal: true module Puppet::Pops module Loader # Runtime3TypeLoader # === # Loads a resource type using the 3.x type loader # # @api private class Runtime3TypeLoader < BaseLoader attr_reader :resource_3x_loader def initialize(parent_loader, loaders, environment, resource_3x_loader) super(pare...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/simple_environment_loader.rb
Ruby
apache-2.0
7,843
main
620
# frozen_string_literal: true # SimpleEnvironmentLoader # === # This loader does not load anything and it is populated by the bootstrapping logic that loads # the site.pp or equivalent for an environment. It does not restrict the names of what it may contain, # and what is loaded here overrides any child loaders (modu...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/base_loader.rb
Ruby
apache-2.0
7,843
main
5,094
# frozen_string_literal: true module Puppet::Pops module Loader # BaseLoader # === # An abstract implementation of Loader # # A derived class should implement `find(typed_name)` and set entries, and possible handle "miss caching". # # @api private # class BaseLoader < Loader # The parent loader attr_reader :parent...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb
Ruby
apache-2.0
7,843
main
6,031
# frozen_string_literal: true # The RubyLegacyFunctionInstantiator instantiates a Puppet::Functions::Function given the ruby source # that calls Puppet::Functions.create_function. # require 'ripper' class Puppet::Pops::Loader::RubyLegacyFunctionInstantiator UNKNOWN = '<unknown>' # Produces an instance of the Func...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/scheduler/splay_job.rb
Ruby
apache-2.0
7,843
main
1,054
# frozen_string_literal: true module Puppet::Scheduler class SplayJob < Job attr_reader :splay, :splay_limit def initialize(run_interval, splay_limit, &block) @splay, @splay_limit = calculate_splay(splay_limit) super(run_interval, &block) end def interval_to_next_from(time) if las...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/scheduler/timer.rb
Ruby
apache-2.0
7,843
main
204
# frozen_string_literal: true module Puppet::Scheduler class Timer def wait_for(seconds) if seconds > 0 sleep(seconds) end end def now Time.now end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/scheduler/scheduler.rb
Ruby
apache-2.0
7,843
main
1,072
# frozen_string_literal: true module Puppet::Scheduler class Scheduler def initialize(timer = Puppet::Scheduler::Timer.new) @timer = timer end def run_loop(jobs) mark_start_times(jobs, @timer.now) until enabled(jobs).empty? @timer.wait_for(min_interval_to_next_run_from(jobs, @t...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/scheduler/job.rb
Ruby
apache-2.0
7,843
main
911
# frozen_string_literal: true module Puppet::Scheduler class Job attr_reader :run_interval attr_accessor :last_run attr_accessor :start_time def initialize(run_interval, &block) self.run_interval = run_interval @last_run = nil @run_proc = block @enabled = true end de...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/feature.rb
Ruby
apache-2.0
7,843
main
420
# frozen_string_literal: true require_relative '../../puppet/confine' class Puppet::Confine::Feature < Puppet::Confine def self.summarize(confines) confines.collect(&:values).flatten.uniq.find_all { |value| !confines[0].pass?(value) } end # Is the named feature available? def pass?(value) Puppet.feat...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/boolean.rb
Ruby
apache-2.0
7,843
main
1,688
# frozen_string_literal: true require_relative '../../puppet/confine' # Common module for the Boolean confines. It currently # contains just enough code to implement PUP-9336. class Puppet::Confine module Boolean # Returns the passing value for the Boolean confine. def passing_value raise NotImplement...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/true.rb
Ruby
apache-2.0
7,843
main
528
# frozen_string_literal: true require_relative '../../puppet/confine/boolean' class Puppet::Confine::True < Puppet::Confine include Puppet::Confine::Boolean def passing_value true end def self.summarize(confines) confines.inject(0) { |count, confine| count + confine.summary } end def pass?(valu...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/false.rb
Ruby
apache-2.0
7,843
main
479
# frozen_string_literal: true require_relative '../../puppet/confine/boolean' class Puppet::Confine::False < Puppet::Confine include Puppet::Confine::Boolean def passing_value false end def self.summarize(confines) confines.inject(0) { |count, confine| count + confine.summary } end def pass?(va...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/any.rb
Ruby
apache-2.0
7,843
main
525
# frozen_string_literal: true class Puppet::Confine::Any < Puppet::Confine def self.summarize(confines) confines.inject(0) { |count, confine| count + confine.summary } end def pass?(value) !!value end def message(value) "0 confines (of #{value.length}) were true" end def summary result...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/variable.rb
Ruby
apache-2.0
7,843
main
1,706
# frozen_string_literal: true require_relative '../../puppet/confine' # Require a specific value for a variable, either a Puppet setting # or a Facter value. This class is a bit weird because the name # is set explicitly by the ConfineCollection class -- from this class, # it's not obvious how the name would ever ge...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/confine/exists.rb
Ruby
apache-2.0
7,843
main
517
# frozen_string_literal: true require_relative '../../puppet/confine' class Puppet::Confine::Exists < Puppet::Confine def self.summarize(confines) confines.inject([]) { |total, confine| total + confine.summary } end def pass?(value) value && (for_binary? ? which(value) : Puppet::FileSystem.exist?(value...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/parameter/value_collection.rb
Ruby
apache-2.0
7,843
main
7,499
# frozen_string_literal: true require_relative '../../puppet/parameter/value' # A collection of values and regular expressions, used for specifying allowed values # in a given parameter. # @note This class is considered part of the internal implementation of {Puppet::Parameter}, and # {Puppet::Property} and the fun...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/parameter/path.rb
Ruby
apache-2.0
7,843
main
2,252
# frozen_string_literal: true require_relative '../../puppet/parameter' # This specialized {Puppet::Parameter} handles validation and munging of paths. # By default, a single path is accepted, and by calling {accept_arrays} it is possible to # allow an array of paths. # class Puppet::Parameter::Path < Puppet::Paramet...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/parameter/boolean.rb
Ruby
apache-2.0
7,843
main
437
# frozen_string_literal: true require_relative '../../puppet/coercion' # This specialized {Puppet::Parameter} handles Boolean options, accepting lots # of strings and symbols for both truth and falsehood. # class Puppet::Parameter::Boolean < Puppet::Parameter def unsafe_munge(value) Puppet::Coercion.boolean(val...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/parameter/value.rb
Ruby
apache-2.0
7,843
main
2,398
# frozen_string_literal: true require_relative '../../puppet/parameter/value_collection' # Describes an acceptable value for a parameter or property. # An acceptable value is either specified as a literal value or a regular expression. # @note this class should be used via the api methods in {Puppet::Parameter} and {...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/parameter/package_options.rb
Ruby
apache-2.0
7,843
main
867
# frozen_string_literal: true require_relative '../../puppet/parameter' # This specialized {Puppet::Parameter} handles munging of package options. # Package options are passed as an array of key value pairs. Special munging is # required as the keys and values needs to be quoted in a safe way. # class Puppet::Paramet...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/posix.rb
Ruby
apache-2.0
7,843
main
1,219
# frozen_string_literal: true class Puppet::FileSystem::Posix < Puppet::FileSystem::FileImpl def binread(path) path.binread end # Provide an encoding agnostic version of compare_stream # # The FileUtils implementation in Ruby 2.0+ was modified in a manner where # it cannot properly compare File and St...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/memory_impl.rb
Ruby
apache-2.0
7,843
main
1,913
# frozen_string_literal: true class Puppet::FileSystem::MemoryImpl def initialize(*files) @files = files + all_children_of(files) end def expand_path(path, dir_string = nil) File.expand_path(path, dir_string) end def exist?(path) path.exist? end def directory?(path) path.directory? e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/path_pattern.rb
Ruby
apache-2.0
7,843
main
2,329
# frozen_string_literal: true require 'pathname' require_relative '../../puppet/error' module Puppet::FileSystem class PathPattern class InvalidPattern < Puppet::Error; end DOTDOT = '..' ABSOLUTE_UNIX = %r{^/} ABSOLUTE_WINDOWS = /^[a-z]:/i CURRENT_DRIVE_RELATIVE_WINDOWS = /^\\/ def self.re...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/uniquefile.rb
Ruby
apache-2.0
7,843
main
4,322
# frozen_string_literal: true require 'English' require_relative '../../puppet/file_system' require 'delegate' require 'tmpdir' # A class that provides `Tempfile`-like capabilities, but does not attempt to # manage the deletion of the file for you. API is identical to the # normal `Tempfile` class. # # @api public c...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/file_impl.rb
Ruby
apache-2.0
7,843
main
4,115
# frozen_string_literal: true # Abstract implementation of the Puppet::FileSystem # class Puppet::FileSystem::FileImpl def pathname(path) path.is_a?(Pathname) ? path : Pathname.new(path) end def assert_path(path) return path if path.is_a?(Pathname) # Some paths are string, or in the case of Watched...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/jruby.rb
Ruby
apache-2.0
7,843
main
806
# frozen_string_literal: true require_relative '../../puppet/file_system/posix' class Puppet::FileSystem::JRuby < Puppet::FileSystem::Posix def unlink(*paths) File.unlink(*paths) rescue Errno::ENOENT # JRuby raises ENOENT if the path doesn't exist or the parent directory # doesn't allow execute/traver...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/windows.rb
Ruby
apache-2.0
7,843
main
7,122
# frozen_string_literal: true require_relative '../../puppet/file_system/posix' require_relative '../../puppet/util/windows' class Puppet::FileSystem::Windows < Puppet::FileSystem::Posix FULL_CONTROL = Puppet::Util::Windows::File::FILE_ALL_ACCESS FILE_READ = Puppet::Util::Windows::File::FILE_GENERIC_READ def o...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/file_system/memory_file.rb
Ruby
apache-2.0
7,843
main
1,866
# frozen_string_literal: true # An in-memory file abstraction. Commonly used with Puppet::FileSystem::File#overlay # @api private class Puppet::FileSystem::MemoryFile attr_reader :path, :children def self.a_missing_file(path) new(path, :exist? => false, :executable? => false) end def self.a_missing_direc...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/hiera/scope.rb
Ruby
apache-2.0
7,843
main
2,243
# frozen_string_literal: true require 'forwardable' class Hiera class Scope extend Forwardable CALLING_CLASS = 'calling_class' CALLING_CLASS_PATH = 'calling_class_path' CALLING_MODULE = 'calling_module' MODULE_NAME = 'module_name' CALLING_KEYS = [CALLING_CLASS, CALLING_CLASS_PATH, CALLING_M...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/hiera/puppet_function.rb
Ruby
apache-2.0
7,843
main
2,929
# frozen_string_literal: true require 'hiera_puppet' # Provides the base class for the puppet functions hiera, hiera_array, hiera_hash, and hiera_include. # The actual function definitions will call init_dispatch and override the merge_type and post_lookup methods. # # @see hiera_array.rb, hiera_include.rb under lib/...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/Gemfile
Ruby
apache-2.0
7,843
main
1,512
# Specifies a gem mirror; duplicated in acceptance setup # to ensure a similar environment on acceptance hosts. source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place, fake_version = nil) if place.is_a?(String) && place =~ /^((?:git[:@]|https:)[^#]*)#(.*)/ [fake_version, { :git => $1, :branch ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/Rakefile
Ruby
apache-2.0
7,843
main
4,634
require 'beaker-puppet' Beaker::DSL::Helpers::RakeHelpers.load_tasks namespace :ci do namespace :test do desc <<-EOS Run a limited but representative subset of acceptance tests against puppet-agent (AIO) packages. This task is intended to reduce testing time on a per-commit basis. $ SHA=<full sha> bundle exe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/teardown/common/099_Archive_Logs.rb
Ruby
apache-2.0
7,843
main
4,872
require 'date' def file_glob(host, path) result = on(host, "ls #{path}", :acceptable_exit_codes => [0, 2]) return [] if result.exit_code != 0 return result.stdout.strip.split("\n") end # This test is prefixed with zzz so it will hopefully run last. test_name 'Backup puppet logs and app data on all hosts' do t...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/pending/ticket_11860_exec_should_not_override_locale.rb
Ruby
apache-2.0
7,843
main
2,920
test_name "#11860: exec resources should not override system locale" ####################################################################################### # NOTE ####################################################################################### # # This test won't run properly ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/pending/ticket_5224_exec_should_unset_user_env_vars.rb
Ruby
apache-2.0
7,843
main
3,818
test_name "#5224: exec resources should unset user-related environment variables" ####################################################################################### # NOTE ####################################################################################### # # This test depend...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/pending/ticket_4151_defined_function_should_not_return_true_for_unrealized_virtual_resources.rb
Ruby
apache-2.0
7,843
main
772
test_name "#4151: defined function should not return true for unrealized virtual resources" # Jeff McCune <jeff@puppetlabs.com> # 2010-07-06 # # This script is expected to exit non-zero if ticket 4151 has not been # fixed. # # The expected behavior is for defined() to only return true if a virtual # resource has been ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/pending/ticket_4149_parseonly_should_not_fail.rb
Ruby
apache-2.0
7,843
main
897
test_name "#4149: parseonly should do the right thing" step "test with a manifest with syntax errors" manifest = 'class someclass { notify { "hello, world" } }' apply_manifest_on(agents, manifest, :parseonly => true, :acceptable_exit_codes => [1]) { stdout =~ /Could not parse for .*: Syntax error/ or fail_test("...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/pending/ticket_6928_puppet_master_parse_fails.rb
Ruby
apache-2.0
7,843
main
1,761
test_name "#6928: Puppet --parseonly should return deprication message" # Create good and bad formatted manifests step "Master: create valid, invalid formatted manifests" create_remote_file(master, '/tmp/good.pp', %w{notify{good:}} ) create_remote_file(master, '/tmp/bad.pp', 'notify{bad:') step "Master: use --parseon...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/pending/ticket_5027_warn_on_dynamic_scope.rb
Ruby
apache-2.0
7,843
main
779
test_name "#5027: Issue warnings when using dynamic scope" step "Apply dynamic scoping manifest on agents" apply_manifest_on agents, %q{ $foo = 'foo_value' class a { $bar = 'bar_value' include b } class b inherits c { notify { $baz: } # should not generate a warning -- inherited from class...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/config/aio/options.rb
Ruby
apache-2.0
7,843
main
448
{ :type => 'aio', 'is_puppetserver' => true, 'use-service' => true, # use service scripts to start/stop stuff 'puppetservice' => 'puppetserver', 'puppetserver-confdir' => '/etc/puppetlabs/puppetserver/conf.d', 'puppetserver-config' =...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/config/git/options.rb
Ruby
apache-2.0
7,843
main
436
{ :type => 'git', :install => [ 'puppet', ], 'is_puppetserver' => false, 'use-service' => true, # use service scripts to start/stop stuff 'puppetservice' => 'puppetserver', 'puppetserver-confdir' => '/etc/puppetlab...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/lib/puppet/acceptance/common_utils.rb
Ruby
apache-2.0
7,843
main
1,821
module Puppet module Acceptance module BeakerUtils # TODO: This should be added to Beaker def assert_matching_arrays(expected, actual, message = "") assert_equal(expected.sort, actual.sort, message) end end module PackageUtils def package_present(host, package, version = n...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/lib/puppet/acceptance/i18n_utils.rb
Ruby
apache-2.0
7,843
main
1,631
module Puppet module Acceptance module I18nUtils # try to enable the locale's for a given language on the agent and return the preferred language name # # @param agent [string] the agent to check the locale configuration on # @param language [string] the language attempt to configure if n...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/lib/puppet/acceptance/puppet_type_test_tools.rb
Ruby
apache-2.0
7,843
main
4,119
require 'puppet/acceptance/environment_utils' module Puppet module Acceptance module PuppetTypeTestTools include Puppet::Acceptance::EnvironmentUtils # for now, just for #random_string # FIXME: yardocs # TODO: create resource class which contains its manifest chunk, and assertions # ca...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/lib/puppet/acceptance/module_utils.rb
Ruby
apache-2.0
7,843
main
11,324
module Puppet module Acceptance module ModuleUtils # Return an array of module paths for a given host. # # Example return value: # # [ # "/etc/puppetlabs/code/environments/production/modules", # "/etc/puppetlabs/code/modules", # "/opt/puppet/share/puppet/modu...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
acceptance/lib/puppet/acceptance/static_catalog_utils.rb
Ruby
apache-2.0
7,843
main
1,887
module Puppet module Acceptance module StaticCatalogUtils # Adds code-id-command and code-content-command scripts # to the server and updates puppetserver.conf. This is # necessary for testing static catalogs. # @param master [String] the host running puppetserver. # @param scriptdi...