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/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/bundle.rb
Ruby
apache-2.0
231
main
1,528
module PDK module CLI @bundle_cmd = @base_cmd.define_command do name 'bundle' usage 'bundle [bundler_options]' summary 'Command pass-through to bundler' description <<~EOF For advanced users, pdk bundle runs arbitrary commands in the bundler environment that pdk manages. Ca...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/remove/config.rb
Ruby
apache-2.0
231
main
4,007
module PDK module CLI module Remove module Config def self.run(opts, args) item_name = args.count.positive? ? args[0] : nil item_value = args.count > 1 ? args[1].strip : nil item_value = nil if !item_value.nil? && item_value.empty? force = opts[:force] || fal...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util/update_manager_printer.rb
Ruby
apache-2.0
231
main
2,985
require 'pdk' module PDK module CLI module Util module UpdateManagerPrinter # Prints the summary for a PDK::Module::UpdateManager Object # @param update_manager [PDK::Module::UpdateManager] The object to print a summary of # @param options [Hash{Object => Object}] A list of options ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util/option_normalizer.rb
Ruby
apache-2.0
231
main
1,804
require 'pdk' module PDK module CLI module Util class OptionNormalizer def self.comma_separated_list_to_array(list, _options = {}) raise 'Error: expected comma separated list' unless OptionValidator.comma_separated_list?(list) list.split(',').compact end # Pars...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util/interview.rb
Ruby
apache-2.0
231
main
2,395
require 'tty/prompt' require 'pdk' module PDK module CLI module Util class Interview < TTY::Prompt::AnswersCollector READER = defined?(TTY::Reader) ? TTY::Reader : TTY::Prompt::Reader # Override the initialize method because the original one # doesn't work with Ruby 3. # ru...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util/command_redirector.rb
Ruby
apache-2.0
231
main
863
require 'pdk' require 'tty/prompt' module PDK module CLI module Util class CommandRedirector < TTY::Prompt::AnswersCollector attr_accessor :command # Override the initialize method because the original one # doesn't work with Ruby 3. # rubocop:disable Lint/MissingSuper ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util/option_validator.rb
Ruby
apache-2.0
231
main
3,010
require 'pdk' module PDK module CLI module Util class OptionValidator def self.comma_separated_list?(list, _options = {}) /^[\w-]+(?:,[\w-]+)+$/.match?(list) end # @return [Boolean] true if the fact name is valid def self.valid_fact_name?(name) name.leng...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util/spinner.rb
Ruby
apache-2.0
231
main
285
require 'tty-spinner' # Replace the built-in tty check in tty-spinner with our own implementation # that allows us to mock the behaviour during acceptance tests. module TTY class Spinner def tty? require 'pdk/cli/util' PDK::CLI::Util.interactive? end end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/release/prep.rb
Ruby
apache-2.0
231
main
1,488
require 'pdk/cli/release' module PDK module CLI @release_prep_cmd = @release_cmd.define_command do name 'prep' usage 'prep [options]' summary '(Experimental) Performs all the pre-release checks to ensure module is ready to be released' flag nil, :force, 'Prepare the module...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/release/publish.rb
Ruby
apache-2.0
231
main
1,764
require 'pdk/cli/release' module PDK module CLI @release_publish_cmd = @release_cmd.define_command do name 'publish' usage 'publish [options] <tarball>' summary '(Experimental) Publishes the module <tarball> to the Forge.' flag nil, :force, 'Publish the module automaticall...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/exec/command.rb
Ruby
apache-2.0
231
main
9,852
require 'pdk' module PDK module CLI module Exec class Command attr_reader :argv, :context attr_accessor :timeout, :environment attr_writer :exec_group # The spinner for this command. # This should only be used for testing # # @return [TTY::Spinner, n...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/exec/interactive_command.rb
Ruby
apache-2.0
231
main
3,084
require 'pdk' module PDK module CLI module Exec class InteractiveCommand < Command # rubocop :disable Lint/MissingSuper def initialize(*argv) @argv = argv # Default to running things in the system context. @context = :system # Extra environment vars...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/function.rb
Ruby
apache-2.0
231
main
937
module PDK module CLI @new_function_cmd = @new_cmd.define_command do name 'function' usage 'function [options] <name>' summary 'Create a new function named <name> using given options' option :t, :type, 'The function type, (native or v4)', argument: :required, default: 'native' run d...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/provider.rb
Ruby
apache-2.0
231
main
858
module PDK module CLI @new_provider_cmd = @new_cmd.define_command do name 'provider' usage 'provider [options] <name>' summary '[experimental] Create a new ruby provider named <name> using given options' run do |opts, args, _cmd| PDK::CLI::Util.ensure_in_module! provider_...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/task.rb
Ruby
apache-2.0
231
main
1,009
module PDK module CLI @new_task_cmd = @new_cmd.define_command do name 'task' usage 'task [options] <name>' summary 'Create a new task named <name> using given options' option nil, :description, 'A short description of the purpose of the task', argument: :required run do |opts, args...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/module.rb
Ruby
apache-2.0
231
main
1,988
module PDK module CLI @new_module_cmd = @new_cmd.define_command do name 'module' usage 'module [options] [module_name] [target_dir]' summary 'Create a new module named [module_name] using given options' PDK::CLI.template_url_option(self) PDK::CLI.template_ref_option(self) PDK:...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/defined_type.rb
Ruby
apache-2.0
231
main
1,019
module PDK module CLI @new_define_cmd = @new_cmd.define_command do name 'defined_type' usage 'defined_type [options] <name>' summary 'Create a new defined type named <name> using given options' run do |opts, args, _cmd| PDK::CLI::Util.ensure_in_module!( message: 'Defined...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/fact.rb
Ruby
apache-2.0
231
main
789
module PDK module CLI @new_fact_cmd = @new_cmd.define_command do name 'fact' usage 'fact [options] <name>' summary 'Create a new custom fact named <name> using given options' run do |opts, args, _cmd| PDK::CLI::Util.ensure_in_module! fact_name = args[0] if fact_n...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/class.rb
Ruby
apache-2.0
231
main
947
module PDK module CLI @new_class_cmd = @new_cmd.define_command do name 'class' usage 'class [options] <class_name>' summary 'Create a new class named <class_name> using given options' run do |opts, args, _cmd| require 'pdk/generate/puppet_class' PDK::CLI::Util.ensure_in_m...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/test.rb
Ruby
apache-2.0
231
main
1,968
module PDK module CLI @new_define_cmd = @new_cmd.define_command do name 'test' usage 'test [options] <name>' summary 'Create a new test for the object named <name>' flag :u, :unit, 'Create a new unit test.' PDK::CLI.puppet_version_options(self) PDK::CLI.puppet_dev_option(self) ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new/transport.rb
Ruby
apache-2.0
231
main
872
module PDK module CLI @new_transport_cmd = @new_cmd.define_command do name 'transport' usage 'transport [options] <name>' summary '[experimental] Create a new ruby transport named <name> using given options' run do |opts, args, _cmd| PDK::CLI::Util.ensure_in_module! trans...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/get/config.rb
Ruby
apache-2.0
231
main
1,081
module PDK module CLI @get_config_cmd = @get_cmd.define_command do name 'config' usage 'config [name]' summary 'Retrieve the configuration for <name>. If not specified, retrieve all configuration settings' run do |_opts, args, _cmd| item_name = args[0] resolved_config = PD...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/test/unit.rb
Ruby
apache-2.0
231
main
3,202
module PDK module CLI @test_unit_cmd = @test_cmd.define_command do name 'unit' usage 'unit [options]' summary 'Run unit tests.' PDK::CLI.puppet_version_options(self) PDK::CLI.puppet_dev_option(self) flag nil, :list, 'List all available unit test files.' flag nil, :parall...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/set/config.rb
Ruby
apache-2.0
231
main
4,936
module PDK module CLI module Set module Config ALLOWED_TYPE_NAMES = ['array', 'boolean', 'number', 'string'].freeze # :nocov: def self.pretty_allowed_names ALLOWED_TYPE_NAMES.map { |name| "'#{name}'" }.join(', ') end # :nocov: def self.transform_va...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/json_schema_namespace.rb
Ruby
apache-2.0
231
main
4,920
require 'pdk' # Due to https://github.com/ruby-json-schema/json-schema/issues/439 # Windows file paths "appear" as uri's with no host and a schema of drive letter # Also it is not possible to craft a URI with a Windows path due to the URI object # always prepending the path with forward slash (`/`) so Windows paths en...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/yaml_with_schema.rb
Ruby
apache-2.0
231
main
1,759
require 'pdk' module PDK class Config # Parses a YAML document with a JSON schema. # # @see PDK::Config::Namespace.parse_file class YAMLWithSchema < JSONSchemaNamespace def parse_file(filename) raise unless block_given? data = load_data(filename) data = '' if data.nil? ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/json_with_schema.rb
Ruby
apache-2.0
231
main
1,428
require 'pdk' module PDK class Config class JSONWithSchema < JSONSchemaNamespace # Parses a JSON document with a schema. # # @see PDK::Config::Namespace.parse_file def parse_file(filename) raise unless block_given? data = load_data(filename) data = '{}' if data.ni...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/json.rb
Ruby
apache-2.0
231
main
804
require 'pdk' module PDK class Config class JSON < Namespace # Parses a JSON document. # # @see PDK::Config::Namespace.parse_file def parse_file(filename) raise unless block_given? data = load_data(filename) return if data.nil? || data.empty? require 'jso...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/ini_file.rb
Ruby
apache-2.0
231
main
5,154
require 'pdk' module PDK class Config # Represents a configuration file using the INI file format class IniFile < Namespace # Ini Files have very strict valdiation rules which are set in the IniFileSetting class # @see PDK::Config::Namespace.default_setting_class def default_setting_class ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/json_schema_setting.rb
Ruby
apache-2.0
231
main
1,885
require 'pdk' module PDK class Config class JSONSchemaSetting < PDK::Config::Setting # Initialises the PDK::Config::JSONSchemaSetting object. # # @see PDK::Config::Setting.initialize def initialize(_name, namespace, _initial_value) raise 'The JSONSchemaSetting object can only be c...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/setting.rb
Ruby
apache-2.0
231
main
4,853
require 'pdk' module PDK class Config # A class for describing the setting of a {PDK::Config} setting. # # Generally, this is never instantiated manually, but is instead # instantiated by passing a block to {PDK::Config::Namespace#setting}. # # @example # # PDK::Config::Namespace.new(...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/validator.rb
Ruby
apache-2.0
231
main
946
module PDK class Config # A collection of predefined validators for use with {PDK::Config::Value}. # # @example # value :enabled do # validate PDK::Config::Validator.boolean # end module Validator # @return [Hash{Symbol => [Proc,String]}] a {PDK::Config::Value} # vali...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/yaml.rb
Ruby
apache-2.0
231
main
1,286
require 'pdk' module PDK class Config # Parses a YAML document. # # @see PDK::Config::Namespace.parse_file class YAML < Namespace def parse_file(filename) raise unless block_given? data = load_data(filename) return if data.nil? || data.empty? require 'yaml' ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/ini_file_setting.rb
Ruby
apache-2.0
231
main
1,437
require 'pdk' module PDK class Config class IniFileSetting < PDK::Config::Setting # Initialises the PDK::Config::JSONSchemaSetting object. # # @see PDK::Config::Setting.initialize def initialize(_name, namespace, initial_value = nil) raise 'The IniFileSetting object can only be cr...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config/namespace.rb
Ruby
apache-2.0
231
main
14,723
require 'pdk' module PDK class Config class Namespace # @param value [String] the new name of this namespace. attr_writer :name # @return [String] the path to the file associated with the contents of # this namespace. attr_reader :file # @return [self] the parent namespace...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/tests/unit.rb
Ruby
apache-2.0
231
main
9,512
require 'pdk' module PDK module Test class Unit def self.cmd(tests, opts = {}) rake_args = opts[:parallel] ? 'parallel_spec_standalone' : 'spec_standalone' rake_args += "[#{tests}]" unless tests.nil? || tests.empty? rake_args end def self.rake_bin require 'pdk/u...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/module/update.rb
Ruby
apache-2.0
231
main
4,256
require 'pdk' module PDK module Module class Update < Convert GIT_DESCRIBE_PATTERN = /\A(?<base>.+?)-(?<additional_commits>\d+)-g(?<sha>.+)\Z/ def run template_uri.uri_fragment = new_template_version stage_changes! PDK.logger.debug format('This module is already up to date ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/module/convert.rb
Ruby
apache-2.0
231
main
9,625
require 'pdk' module PDK module Module class Convert def self.invoke(module_dir, options) new(module_dir, options).run end attr_reader :module_dir, :options def initialize(module_dir, options = {}) @module_dir = module_dir @options = options end def ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/module/release.rb
Ruby
apache-2.0
231
main
8,981
require 'pdk' require 'uri' require 'puppet/modulebuilder' module PDK module Module class Release def self.invoke(module_path, options = {}) new(module_path, options).run end attr_reader :options, :module_path def initialize(module_path, options = {}) @options = options ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/module/metadata.rb
Ruby
apache-2.0
231
main
6,646
require 'pdk' module PDK module Module class Metadata attr_accessor :data OPERATING_SYSTEMS = { 'RedHat based Linux' => [ { 'operatingsystem' => 'CentOS', 'operatingsystemrelease' => ['7', '8', '9'] }, { 'operatingsystem' => '...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/module/update_manager.rb
Ruby
apache-2.0
231
main
8,180
require 'pdk' module PDK module Module class UpdateManager # Initialises a blank UpdateManager object, which is used to store and # process file additions/removals/modifications. def initialize require 'set' @modified_files = Set.new @added_files = Set.new @remo...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/invokable_validator.rb
Ruby
apache-2.0
231
main
9,696
require 'pdk' module PDK module Validate # A base class for file based validators. # This class provides base methods and helpers to help determine the file targets to validate against. # Acutal validator implementation should inherit from other child abstract classes e.g. ExternalCommandValdiator # ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/external_command_validator.rb
Ruby
apache-2.0
231
main
8,089
require 'pdk' module PDK module Validate # An abstract validator that runs external commands within a Ruby Bundled environment # e.g. `puppet-lint`, or `puppet validate` # # At a a minimum child classes should implment the `name`, `cmd`, `pattern` and `parse_output` methods # # An example con...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/validator_group.rb
Ruby
apache-2.0
231
main
2,907
require 'pdk' module PDK module Validate # The base class which should be used by meta-validators, that is, this group executes other validators # # At a minimum, the `name` and `validators` methods should be overridden in the child class # # An example concrete implementation could look like: ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/internal_ruby_validator.rb
Ruby
apache-2.0
231
main
2,946
require 'pdk' module PDK module Validate # An abstract validator that runs ruby code internal to the PDK e.g. JSON and YAML validation, on a single file. # The validator code must run within the PDK Ruby environment as opposed to the bundled Ruby environment for a module. # # At a a minimum child cla...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/validator.rb
Ruby
apache-2.0
231
main
3,532
require 'pdk' module PDK module Validate # The base Validator class which all other validators should inherit from. # Acutal validator implementation should inherit from other child abstract classes e.g. ValidatorGroup or ExternalCommandValdiator # @abstract class Validator # A hash of options ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/ruby/ruby_validator_group.rb
Ruby
apache-2.0
231
main
282
require 'pdk' module PDK module Validate module Ruby class RubyValidatorGroup < ValidatorGroup def name 'ruby' end def validators [ RubyRubocopValidator ].freeze end end end end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/ruby/ruby_rubocop_validator.rb
Ruby
apache-2.0
231
main
2,044
require 'pdk' module PDK module Validate module Ruby class RubyRubocopValidator < ExternalCommandValidator def allow_empty_targets? true end def name 'rubocop' end def cmd 'rubocop' end def pattern if context...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/tasks/tasks_name_validator.rb
Ruby
apache-2.0
231
main
1,175
require 'pdk' module PDK module Validate module Tasks class TasksNameValidator < InternalRubyValidator INVALID_TASK_MSG = 'Invalid task name. Task names must start with a lowercase letter and can only contain lowercase letters, numbers, and underscores.'.freeze def name 'task-nam...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb
Ruby
apache-2.0
231
main
2,468
require 'pdk' module PDK module Validate module Tasks class TasksMetadataLintValidator < InternalRubyValidator def name 'task-metadata-lint' end def pattern contextual_pattern('tasks/*.json') end def spinner_text format('Checking task ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/tasks/tasks_validator_group.rb
Ruby
apache-2.0
231
main
323
require 'pdk' module PDK module Validate module Tasks class TasksValidatorGroup < ValidatorGroup def name 'tasks' end def validators [ TasksNameValidator, TasksMetadataLintValidator ].freeze end end end end e...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/yaml/yaml_syntax_validator.rb
Ruby
apache-2.0
231
main
2,577
require 'pdk' module PDK module Validate module YAML class YAMLSyntaxValidator < InternalRubyValidator YAML_ALLOWLISTED_CLASSES = [Symbol].freeze def ignore_dotfiles false end def name 'yaml-syntax' end def pattern [ ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/yaml/yaml_validator_group.rb
Ruby
apache-2.0
231
main
281
require 'pdk' module PDK module Validate module YAML class YAMLValidatorGroup < ValidatorGroup def name 'yaml' end def validators [ YAMLSyntaxValidator ].freeze end end end end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/puppet/puppet_lint_validator.rb
Ruby
apache-2.0
231
main
2,030
require 'pdk' module PDK module Validate module Puppet class PuppetLintValidator < ExternalCommandValidator def name 'puppet-lint' end def cmd 'puppet-lint' end def pattern contextual_pattern('**/*.pp') end def spinner...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/puppet/puppet_validator_group.rb
Ruby
apache-2.0
231
main
393
require 'pdk' module PDK module Validate module Puppet class PuppetValidatorGroup < ValidatorGroup def name 'puppet' end def validators [ PuppetSyntaxValidator, PuppetPlanSyntaxValidator, PuppetLintValidator, Puppe...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/puppet/puppet_plan_syntax_validator.rb
Ruby
apache-2.0
231
main
1,156
require 'pdk' module PDK module Validate module Puppet class PuppetPlanSyntaxValidator < PuppetSyntaxValidator def name 'puppet-plan-syntax' end def pattern contextual_pattern('plans/**/*.pp') end def pattern_ignore; end def spinner_tex...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/puppet/puppet_syntax_validator.rb
Ruby
apache-2.0
231
main
4,459
require 'pdk' module PDK module Validate module Puppet class PuppetSyntaxValidator < ExternalCommandValidator # In Puppet >= 5.3.4, the error context formatting was changed to facilitate localization ERROR_CONTEXT = /(?:file:\s(?<file>.+?)|line:\s(?<line>.+?)|column:\s(?<column>.+?))/ ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/puppet/puppet_epp_validator.rb
Ruby
apache-2.0
231
main
4,357
require 'pdk' module PDK module Validate module Puppet class PuppetEPPValidator < ExternalCommandValidator # In Puppet >= 5.3.4, the error context formatting was changed to facilitate localization ERROR_CONTEXT = /(?:file:\s(?<file>.+?)|line:\s(?<line>.+?)|column:\s(?<column>.+?))/ ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/metadata/metadata_syntax_validator.rb
Ruby
apache-2.0
231
main
1,657
require 'pdk' module PDK module Validate module Metadata class MetadataSyntaxValidator < InternalRubyValidator def name 'metadata-syntax' end def pattern contextual_pattern(['metadata.json', 'tasks/*.json']) end def spinner_text format...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/metadata/metadata_json_lint_validator.rb
Ruby
apache-2.0
231
main
2,623
require 'pdk' module PDK module Validate module Metadata class MetadataJSONLintValidator < ExternalCommandValidator # Validate each metadata file separately, as metadata-json-lint does not # support multiple targets. def invoke_style :per_target end def na...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/metadata/metadata_validator_group.rb
Ruby
apache-2.0
231
main
336
require 'pdk' module PDK module Validate module Metadata class MetadataValidatorGroup < ValidatorGroup def name 'metadata' end def validators [ MetadataSyntaxValidator, MetadataJSONLintValidator ].freeze end end ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/control_repo/control_repo_validator_group.rb
Ruby
apache-2.0
231
main
402
require 'pdk' module PDK module Validate module ControlRepo class ControlRepoValidatorGroup < ValidatorGroup def name 'control-repo' end def valid_in_context? context.is_a?(PDK::Context::ControlRepo) end def validators [ En...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate/control_repo/environment_conf_validator.rb
Ruby
apache-2.0
231
main
2,900
require 'pdk' module PDK module Validate module ControlRepo class EnvironmentConfValidator < InternalRubyValidator ALLOWED_SETTINGS = ['modulepath', 'manifest', 'config_version', 'environment_timeout'].freeze def name 'environment-conf' end def valid_in_context? ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/report/event.rb
Ruby
apache-2.0
231
main
12,140
require 'pdk' module PDK class Report class Event # @return [String] The path to the file that the event is in reference # to. attr_reader :file # @return [Integer] The line number in the file that the event is in # reference to. attr_reader :line # @return [Intege...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
rakelib/command_spec.rake
Ruby
apache-2.0
231
main
5,147
task :command_spec do require 'json' puts JSON.pretty_generate(describe_base_command) end task :generate_powershell do root_dir = File.expand_path(File.join(__dir__, '..')) ext_dir = File.join(root_dir, 'ext') output_dir = File.join(root_dir, 'output', 'PowerShell') if Dir.exist?(output_dir) puts "Cl...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
rakelib/test_pdk_as_library.rake
Ruby
apache-2.0
231
main
283
require 'English' task :test_pdk_as_library do spec_dir = File.expand_path(File.join(__dir__, '..', 'spec')) Dir[File.join(spec_dir, 'unit', '**', '*_spec.rb')].each do |spec_file| system("bundle exec rspec #{spec_file}") raise unless $CHILD_STATUS.success? end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
ext/rubocop.rb
Ruby
apache-2.0
231
main
26,179
module RuboCop module Cop module PDK class FileFilePredicate < Base MSG = 'Use PDK::Util::Filesystem.file? instead of File.file?'.freeze def_node_matcher :file_file_predicate?, '(send (const nil? :File) :file? ...)' def_node_matcher :allow_file?, <<-MATCHER...
github
tenderlove/hana
https://github.com/tenderlove/hana
Rakefile
Ruby
mit
231
master
495
# -*- ruby -*- require 'rubygems' begin require 'hoe' rescue LoadError Gem.install 'hoe' retry end Hoe.plugins.delete :rubyforge Hoe.plugin :minitest Hoe.plugin :gemspec # `gem install hoe-gemspec` Hoe.plugin :git # `gem install hoe-git` Hoe.spec 'hana' do developer('Aaron Patterson', 'aaron@tenderlovema...
github
tenderlove/hana
https://github.com/tenderlove/hana
test/helper.rb
Ruby
mit
231
master
2,492
require 'minitest/autorun' require 'hana' require 'json' module Hana class TestCase < Minitest::Test TESTDIR = File.dirname File.expand_path __FILE__ def self.read_test_json_file file Module.new { tests = JSON.load File.read file tests.each_with_index do |test, i| next unless...
github
tenderlove/hana
https://github.com/tenderlove/hana
test/test_ietf.rb
Ruby
mit
231
master
504
require 'helper' module Hana class TestIETF < TestCase filename = File.join TESTDIR, 'json-patch-tests', 'tests.json' include read_test_json_file filename end class TestSpec < TestCase filename = File.join TESTDIR, 'json-patch-tests', 'spec_tests.json' include read_test_json_file filename s...
github
tenderlove/hana
https://github.com/tenderlove/hana
test/test_hana.rb
Ruby
mit
231
master
3,098
require 'helper' class TestHana < Hana::TestCase def test_no_eval patch = Hana::Patch.new [ { 'op' => 'eval', 'value' => '1' } ] assert_raises(Hana::Patch::Exception) do patch.apply('foo' => 'bar') end end def test_mutate_to_a_does_not_impact_original pointer = Hana::Pointer.new ...
github
tenderlove/hana
https://github.com/tenderlove/hana
lib/hana.rb
Ruby
mit
231
master
6,157
# frozen_string_literal: true module Hana VERSION = '1.3.7' class Pointer include Enumerable class Exception < StandardError end class FormatError < Exception end def initialize path @path = Pointer.parse path end def each(&block); @path.each(&block); end def eval ob...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
Rakefile
Ruby
apache-2.0
230
main
1,040
# frozen_string_literal: true require 'bundler' require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' PuppetLint.configuration.send('di...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
Gemfile
Ruby
apache-2.0
230
main
4,496
source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?} file_url_regex = %r{\Afile:\/\/(?<path>.*)} if place_or_version && (git_url = place_or_version.match(git_url_regex)) [fake_version, {...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
tasks/sql.rb
Ruby
apache-2.0
230
main
1,000
#!/opt/puppetlabs/puppet/bin/ruby # frozen_string_literal: true require 'json' require 'open3' require 'puppet' def get(sql, database, user, port, password, host) env_hash = {} env_hash['PGPASSWORD'] = password unless password.nil? cmd_string = ['psql', '-c', sql] cmd_string << "--dbname=#{database}" unless d...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/util/postgresql_validator.rb
Ruby
apache-2.0
230
main
1,631
# frozen_string_literal: true module Puppet::Util # postgresql_validator.rb class PostgresqlValidator attr_reader :resource def initialize(resource) @resource = resource end def build_psql_cmd cmd = [@resource[:psql_path], '--tuples-only', '--quiet', '--no-psqlrc'] args = { ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/functions/postgresql_escape.rb
Ruby
apache-2.0
230
main
513
# frozen_string_literal: true # @summary DEPRECATED. Use the namespaced function [`postgresql::postgresql_escape`](#postgresqlpostgresql_escape) instead. Puppet::Functions.create_function(:postgresql_escape) do dispatch :deprecation_gen do repeated_param 'Any', :args end def deprecation_gen(*args) call_...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/functions/postgresql_password.rb
Ruby
apache-2.0
230
main
525
# frozen_string_literal: true # @summary DEPRECATED. Use the namespaced function [`postgresql::postgresql_password`](#postgresqlpostgresql_password) instead. Puppet::Functions.create_function(:postgresql_password) do dispatch :deprecation_gen do repeated_param 'Any', :args end def deprecation_gen(*args) ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/functions/postgresql/prepend_sql_password.rb
Ruby
apache-2.0
230
main
422
# frozen_string_literal: true # @summary This function exists for usage of a role password that is a deferred function Puppet::Functions.create_function(:'postgresql::prepend_sql_password') do # @param password # The clear text `password` dispatch :default_impl do required_param 'String', :password ret...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/functions/postgresql/postgresql_password.rb
Ruby
apache-2.0
230
main
3,179
# frozen_string_literal: true require 'openssl' require 'base64' # @summary This function returns the postgresql password hash from the clear text username / password Puppet::Functions.create_function(:'postgresql::postgresql_password') do # @param username # The clear text `username` # @param password # ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/functions/postgresql/postgresql_acls_to_resources_hash.rb
Ruby
apache-2.0
230
main
1,975
# frozen_string_literal: true # @summary This internal function translates the ipv(4|6)acls format into a resource suitable for create_resources. # @api private Puppet::Functions.create_function(:'postgresql::postgresql_acls_to_resources_hash') do # @param acls # An array of strings that are pg_hba.conf rules. ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/functions/postgresql/postgresql_escape.rb
Ruby
apache-2.0
230
main
1,126
# frozen_string_literal: true require 'digest/md5' # @summary This function escapes a string using [Dollar Quoting](https://www.postgresql.org/docs/12/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING) using a randomly generated tag if required. Puppet::Functions.create_function(:'postgresql::postgresql_escape') do ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/type/postgresql_conf.rb
Ruby
apache-2.0
230
main
887
# frozen_string_literal: true Puppet::Type.newtype(:postgresql_conf) do @doc = 'This type allows puppet to manage postgresql.conf parameters.' ensurable newparam(:name) do desc 'A unique title for the resource.' newvalues(%r{^[\w.]+$}) end newparam(:key) do desc 'The Postgresql parameter to man...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/type/postgresql_conn_validator.rb
Ruby
apache-2.0
230
main
2,222
# frozen_string_literal: true Puppet::Type.newtype(:postgresql_conn_validator) do @doc = <<-EOS @summary Verify if a connection can be successfully established Verify that a connection can be successfully established between a node and the PostgreSQL server. Its primary use is as a pr...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/type/postgresql_replication_slot.rb
Ruby
apache-2.0
230
main
469
# frozen_string_literal: true Puppet::Type.newtype(:postgresql_replication_slot) do @doc = <<~EOS @summary Manages Postgresql replication slots. This type allows to create and destroy replication slots to register warm standby replication on a Postgresql primary server. EOS ensurable newpara...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/type/postgresql_psql.rb
Ruby
apache-2.0
230
main
5,202
# frozen_string_literal: true Puppet::Type.newtype(:postgresql_psql) do newparam(:name) do desc 'An arbitrary tag for your own reference; the name of the message.' isnamevar end newproperty(:command) do desc 'The SQL command to execute via psql.' defaultto { @resource[:name] } # If needing...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/provider/postgresql_conn_validator/ruby.rb
Ruby
apache-2.0
230
main
1,613
# frozen_string_literal: true $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', '..')) require 'puppet/util/postgresql_validator' # This file contains a provider for the resource type `postgresql_conn_validator`, # which validates the puppetdb connection by attempting an https connection. Puppet::Type...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/provider/postgresql_psql/ruby.rb
Ruby
apache-2.0
230
main
2,475
# frozen_string_literal: true Puppet::Type.type(:postgresql_psql).provide(:ruby) do desc 'Postgres psql provider' def run_unless_sql_command(sql) # for the 'unless' queries, we wrap the user's query in a 'SELECT COUNT', # which makes it easier to parse and process the output. run_sql_command("SELECT CO...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/provider/postgresql_conf/ruby.rb
Ruby
apache-2.0
230
main
5,859
# frozen_string_literal: true # This provider is used to manage postgresql.conf files # It uses ruby to parse the config file and # to add, remove or modify settings. # # The provider is able to parse postgresql.conf files with the following format: # key = value # comment Puppet::Type.type(:postgresql_conf).provide(...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
lib/puppet/provider/postgresql_replication_slot/ruby.rb
Ruby
apache-2.0
230
main
1,823
# frozen_string_literal: true Puppet::Type.type(:postgresql_replication_slot).provide(:ruby) do desc 'For confinement' commands psql: 'psql' def self.instances run_sql_command('SELECT * FROM pg_replication_slots;')[0].split("\n").select { |l| l.include?('|') }.map do |l| name, *_others = l.strip.split...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/spec_helper_local.rb
Ruby
apache-2.0
230
main
7,054
# frozen_string_literal: true RSpec.configure do |c| c.mock_with :rspec c.include PuppetlabsSpec::Files c.after :each do PuppetlabsSpec::Files.cleanup end end if ENV['COVERAGE'] == 'yes' require 'simplecov' require 'simplecov-console' require 'codecov' SimpleCov.formatters = [ SimpleCov::For...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/spec_helper_acceptance_local.rb
Ruby
apache-2.0
230
main
3,448
# frozen_string_literal: true require 'singleton' class LitmusHelper include Singleton include PuppetLitmus end class String def unindent gsub(%r{^#{scan(%r{^\s*}).min_by(&:length)}}, '') end end RSpec.configure do |c| c.before :suite do install_dependencies end end def export_locales(locale) ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/type_aliases/pg_hba_rules_spec.rb
Ruby
apache-2.0
230
main
1,307
# frozen_string_literal: true require 'spec_helper' describe 'Postgresql::Pg_hba_rules' do context 'base valid required data' do let :data do { foo: { description: 'pc', type: 'host', database: 'all', user: 'all', address: '127.0.0.1/32', ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/type_aliases/pg_hba_rule_type_spec.rb
Ruby
apache-2.0
230
main
793
# frozen_string_literal: true require 'spec_helper' describe 'Postgresql::Pg_hba_rule_type' do describe 'valid values' do [ 'local', 'host', 'hostssl', 'hostnossl', 'hostgssenc', 'hostnogssenc', ].each do |value| describe value.inspect do it { is_expected.to...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/type_aliases/pg_hba_rule_spec.rb
Ruby
apache-2.0
230
main
912
# frozen_string_literal: true require 'spec_helper' describe 'Postgresql::Pg_hba_rule' do context 'base valid required data' do let :data do { description: 'pc', type: 'host', database: 'all', user: 'all', address: '127.0.0.1/32', auth_method: 'md5', ...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/functions/postgresql_default_spec.rb
Ruby
apache-2.0
230
main
1,177
# frozen_string_literal: true require 'spec_helper' describe 'postgresql::default' do let(:facts) do { 'os' => { 'family' => 'Debian', 'name' => 'Debian', 'release' => { 'full' => '11.7', 'major' => '11', 'minor' => '7', } } } en...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/functions/postgresql_postgresql_acls_to_resources_hash_spec.rb
Ruby
apache-2.0
230
main
4,735
# frozen_string_literal: true require 'spec_helper' describe 'postgresql::postgresql_acls_to_resources_hash' do it { is_expected.not_to be_nil } context 'individual transform tests' do it do input = 'local all postgres ident' result = { 'postgr...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/acceptance/overridden_settings_spec.rb
Ruby
apache-2.0
230
main
1,529
# frozen_string_literal: true require 'spec_helper_acceptance' # These tests are designed to ensure that the module, when ran overrides, # sets up everything correctly and allows us to connect to Postgres. describe 'postgresql::server' do before(:all) do LitmusHelper.instance.run_shell("cd /tmp; su 'postgres' -...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/acceptance/db_spec.rb
Ruby
apache-2.0
230
main
1,821
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'postgresql::server::db' do before(:all) do LitmusHelper.instance.run_shell("cd /tmp; su 'postgres' -c 'pg_ctl stop -D /var/lib/pgsql/data/ -m fast'", acceptable_exit_codes: [0, 1]) unless os[:family].match?(%r{debian|ubuntu}) end it '...
github
puppetlabs/puppetlabs-postgresql
https://github.com/puppetlabs/puppetlabs-postgresql
spec/acceptance/db_deferred_spec.rb
Ruby
apache-2.0
230
main
881
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'postgresql::server::db:' do let(:user) { 'user_test' } let(:password) { 'deferred_password_test' } let(:database) { 'test_database' } let(:pp_one) do <<~MANIFEST $user = '#{user}' $password = '#{password}' $databas...