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
spec/acceptance/template_ref_spec.rb
Ruby
apache-2.0
231
main
1,736
require 'spec_helper_acceptance' describe 'Specifying a template-ref' do after(:all) do # We may or may not be in the foo module directory. If we are, go back one directory. # This can happen if you only run a subset of tests in this file. Dir.chdir('..') if Dir.pwd.end_with?('foo') FileUtils.rm_rf(...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/validate_metadata_spec.rb
Ruby
apache-2.0
231
main
5,025
require 'spec_helper_acceptance' describe 'pdk validate metadata', :module_command do let(:metadata_syntax_spinner) { /(?:c|C)hecking metadata syntax/i } let(:module_style_spinner) { /(?:c|C)hecking module metadata style/i } let(:task_style_spinner) { /(?:c|C)hecking task metadata style/i } def broken_metadat...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/validate_puppet_spec.rb
Ruby
apache-2.0
231
main
16,483
require 'spec_helper_acceptance' require 'fileutils' describe 'pdk validate puppet', :module_command do let(:epp_spinner_text) { /checking puppet EPP syntax/i } let(:syntax_spinner_text) { /checking puppet manifest syntax/i } let(:lint_spinner_text) { /checking puppet manifest style/i } include_context 'with ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/set_config_spec.rb
Ruby
apache-2.0
231
main
5,207
require 'spec_helper_acceptance' require 'tempfile' describe 'pdk set config' do include_context 'with a fake TTY' shared_examples 'a saved configuration file' do |new_content| it 'saves the setting' do # Force the command to run if not already subject.exit_status expect(File).to exist(ENV.f...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/bundle_spec.rb
Ruby
apache-2.0
231
main
3,123
require 'spec_helper_acceptance' class IO def expects(expected) combined_output = '' loop do rs, = wait_readable(10) next if rs.nil? next unless (r = rs[0]) data = r.sysread(1024) combined_output << data if expected.match?(combined_output) && !r.ready? yield co...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/build_spec.rb
Ruby
apache-2.0
231
main
3,333
require 'spec_helper_acceptance' describe 'pdk build', :module_command do context 'when run inside of a module' do include_context 'in a new module', 'build' metadata = { 'name' => 'testuser-build', 'version' => '0.1.0', 'author' => 'testuser', 'summary' => 'a test module', 'li...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/remove_config_spec.rb
Ruby
apache-2.0
231
main
4,089
require 'spec_helper_acceptance' require 'tempfile' describe 'pdk remove config' do include_context 'with a fake TTY' shared_examples 'a saved configuration file' do |new_content| it 'saves the setting' do # Force the command to run if not already subject.exit_status retry_on_error_matching(...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/new_fact_spec.rb
Ruby
apache-2.0
231
main
984
require 'spec_helper_acceptance' describe 'pdk new fact', :module_command do shared_examples 'it creates a fact' do |_options| context 'in a new module' do include_context 'in a new module', 'new_fact' context 'when creating the fact' do describe command('pdk new fact new_fact') do ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/have_junit_testcase.rb
Ruby
apache-2.0
231
main
1,933
require 'rexml/document' RSpec::Matchers.define :have_junit_testcase do match do |xml_text| document = REXML::Document.new(xml_text) return false if document.root.nil? testcases = document.elements.to_a("/testsuites/testsuite[@name=\"#{@testsuite_name}\"]/testcase") if @expected_attributes t...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/with_a_fake_answer_file.rb
Ruby
apache-2.0
231
main
539
RSpec.shared_context 'with a fake answer file' do |initial_content = nil| before(:all) do fake_answer_file = Tempfile.new('mock_answers.json') unless initial_content.nil? require 'json' fake_answer_file.binmode fake_answer_file.write(JSON.pretty_generate(initial_content)) end fake_an...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/it_requires_running_in_a_module.rb
Ruby
apache-2.0
231
main
572
require 'fileutils' RSpec.shared_examples('it requires running from inside a module', :module_command) do context 'when run outside of a module' do before(:all) do Dir.mkdir('empty_test_dir') Dir.chdir('empty_test_dir') end after(:all) do Dir.chdir('..') FileUtils.rm_rf('empty_te...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/contain_valid_junit_xml.rb
Ruby
apache-2.0
231
main
606
require 'rspec/xsd' module RSpec module XSD class Matcher attr_reader :errors end end end RSpec::Matchers.define :contain_valid_junit_xml do match do |text| xsd = File.join(RSpec.configuration.fixtures_path, 'JUnit.xsd') @matcher = RSpec::XSD::Matcher.new(xsd, nil) @matcher.matches?(te...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/have_xpath.rb
Ruby
apache-2.0
231
main
1,123
require 'rexml/document' RSpec::Matchers.define :have_xpath do |path| match do |xml_text| doc = REXML::Document.new(xml_text) nodes = doc.elements.to_a(path) if @expected_text nodes.select! do |node| values_match?(@expected_text, node.text) end end if @expected_attributes ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/in_a_new_module.rb
Ruby
apache-2.0
231
main
846
require 'open3' shared_context 'in a new module' do |name, options = {}| before(:all) do default_template = RSpec.configuration.template_dir default_template = "file:///#{default_template}" unless Gem.win_platform? template = options.fetch(:template, default_template) argv = [ 'pdk', 'new', 'mo...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
spec/acceptance/support/have_junit_testsuite.rb
Ruby
apache-2.0
231
main
1,362
require 'rexml/document' RSpec::Matchers.define :have_junit_testsuite do |testsuite_name| match do |xml_text| document = REXML::Document.new(xml_text) return false if document.root.nil? testsuites = document.elements.to_a("/testsuites/testsuite[@name=\"#{testsuite_name}\"]") if @expected_attribute...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/Rakefile
Ruby
apache-2.0
231
main
4,169
require 'json' require 'open-uri' require 'rspec/core/rake_task' require 'nokogiri' namespace :acceptance do task :hostgen do require 'beaker-hostgenerator' unless ENV.fetch('SHA', nil) || ENV.fetch('LOCAL_PKG', nil) abort "SHA or LOCAL_PKG must be set:\n " \ "SHA: git sha or tag of a pdk...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/Gemfile
Ruby
apache-2.0
231
main
501
source ENV.fetch('GEM_SOURCE', nil) || 'https://rubygems.org' gem 'beaker', '~> 4.39' gem 'beaker-abs', '~> 0.11.0' gem 'beaker-docker', '~> 2' gem 'beaker-hostgenerator', '~> 2.11.0' gem 'beaker-puppet', '= 1.29.0' gem 'beaker-rspec', '= 7.1.0' gem 'beaker-vmpooler', '= 1.4.0' gem 'nokogiri', '~> 1.13.6' gem 'rake' ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/spec_helper_package.rb
Ruby
apache-2.0
231
main
1,491
require 'beaker-rspec' require 'beaker-puppet' Dir['./spec/package/support/*.rb'].each { |f| require f } include SpecUtils # rubocop:disable Style/MixinUsage bin_path = SpecUtils.windows_node? ? 'bin$PATH' : 'bin:$PATH' set :path, "#{SpecUtils.install_dir}/#{bin_path}" # IMPORTANT: The following block should be upd...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/pdk_help_spec.rb
Ruby
apache-2.0
231
main
249
require 'spec_helper_package' describe 'C100022 - pdk --help' do describe command('pdk --help') do its(:exit_status) { is_expected.to eq(0) } its(:stdout) { is_expected.to match(/NAME.*USAGE.*DESCRIPTION.*COMMANDS.*OPTIONS/m) } end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/version_selection_spec.rb
Ruby
apache-2.0
231
main
1,439
require 'spec_helper_package' describe 'Test puppet & ruby version selection' do module_name = 'version_selection' test_cases = [ { envvar: 'PDK_PUPPET_VERSION', expected_puppet: PDK_VERSION[:latest][:major], expected_ruby: PDK_VERSION[:latest][:ruby] } ] before(:all) do command('pdk new module versio...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/unprivileged_user_spec.rb
Ruby
apache-2.0
231
main
1,925
require 'spec_helper_package' describe 'Running PDK as an unprivileged user' do module_name = 'unprivileged_user' before(:all) do hosts.each do |host| next if host.platform.include?('windows') host.user_present('testuser') case host.platform when /osx/ on(host, 'createhomedir...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/validate_a_new_module_spec.rb
Ruby
apache-2.0
231
main
2,038
require 'spec_helper_package' describe 'C100321 - Generate a module and validate it (i.e. ensure bundle install works)' do module_name = 'c100321_module' context 'when creating a new module' do describe command("pdk new module #{module_name} --skip-interview") do its(:exit_status) { is_expected.to eq(0)...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/pdk_configuration_spec.rb
Ruby
apache-2.0
231
main
3,421
require 'spec_helper_package' describe 'Using the PDK configuration commands' do def env_var(host, var_name) value = host.get_env_var(var_name) value.empty? ? nil : value[var_name.length + 1, value.length - var_name.length - 1] end def host_system_configdir(host) # This emulates the PDK::Util.system...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/add_gem_to_module_spec.rb
Ruby
apache-2.0
231
main
1,093
require 'spec_helper_package' describe 'C100545 - Generate a module, add a gem to it, and validate it' do module_name = 'c100545_module' describe command("pdk new module #{module_name} --skip-interview --skip-interview --template-url=https://github.com/puppetlabs/pdk-templates --template-ref=main") do its(:ex...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/airgapped_usage_spec.rb
Ruby
apache-2.0
231
main
2,352
require 'spec_helper_package' describe 'Basic usage in an air-gapped environment' do module_name = 'airgapped_module' context 'with rubygems.org access disabled' do before(:all) do shell("cp #{hosts_file} #{hosts_file}.bak") shell("echo \"127.0.0.1 rubygems.org\" >> #{hosts_file}") end af...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/unit_test_a_new_module_spec.rb
Ruby
apache-2.0
231
main
1,214
require 'spec_helper_package' describe 'Generate a module for unit testing' do module_name = 'unit_test_module' context 'when creating a new module and new class' do describe command("pdk new module #{module_name} --skip-interview") do its(:exit_status) { is_expected.to eq(0) } end describe com...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/update_module_spec.rb
Ruby
apache-2.0
231
main
2,423
require 'spec_helper_package' require 'open-uri' require 'json' modules = [ 'puppetlabs/puppetlabs-motd' ] describe 'Updating an existing module' do modules.each do |mod| context "when updating #{mod}" do metadata = JSON.parse(URI.open("https://raw.githubusercontent.com/#{mod}/main/metadata.json").read)...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/support/spec_utils.rb
Ruby
apache-2.0
231
main
1,507
module SpecUtils def install_dir(cygpath = false) if windows_node? if cygpath '/cygdrive/c/Program\ Files/Puppet\ Labs/DevelopmentKit' else 'C:/Program Files/Puppet Labs/DevelopmentKit' end else '/opt/puppetlabs/pdk' end end def home_dir(cygpath = false) if...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/support/serverspec_monkeypatch.rb
Ruby
apache-2.0
231
main
2,246
require 'beaker-rspec' module Serverspec module Type class Command def run command_result end end end end option_keys = Specinfra::Configuration.singleton_class.const_get(:VALID_OPTIONS_KEYS).dup option_keys << :cwd option_keys << :run_as Specinfra::Configuration.singleton_class.send(...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/spec/package/support/install_pdk.rb
Ruby
apache-2.0
231
main
2,370
module PackageHelpers extend Beaker::DSL::InstallUtils::FOSSUtils extend Beaker::DSL::InstallUtils::Puppet5 module_function def install_pdk_on(host) if local_package? install_local_pdk_package(host) return end case host.platform when /windows/ install_windows_pdk_package(hos...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/lib/testenv.rb
Ruby
apache-2.0
231
main
335
require 'spec_helper_package' RSpec.configure do |c| c.after(:suite) do puts "\nTarget host successfully provisioned with PDK:" puts "\n#{hosts.first.hostname}\n" end end describe 'validate PDK was successfully installed' do describe command('pdk --version') do its(:exit_status) { is_expected.to eq(...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
package-testing/lib/pdk/pdk_helper.rb
Ruby
apache-2.0
231
main
908
def install_dir(host) if host.platform.include?('windows') '/cygdrive/c/Program\ Files/Puppet\ Labs/DevelopmentKit' else '/opt/puppetlabs/pdk' end end def pdk_git_bin_dir(host) if host.platform.include?('windows') "#{install_dir(host)}/private/git/mingw64/bin" else "#{install_dir(host)}/priva...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk.rb
Ruby
apache-2.0
231
main
1,657
module PDK autoload :AnswerFile, 'pdk/answer_file' autoload :Bolt, 'pdk/bolt' autoload :Config, 'pdk/config' autoload :Context, 'pdk/context' autoload :ControlRepo, 'pdk/control_repo' autoload :Generate, 'pdk/generate' autoload :Logger, 'pdk/logger' autoload :Module, 'pdk/module' autoload :Report, 'pd...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/module.rb
Ruby
apache-2.0
231
main
743
module PDK module Module autoload :Build, 'pdk/module/build' autoload :Convert, 'pdk/module/convert' autoload :Metadata, 'pdk/module/metadata' autoload :Release, 'pdk/module/release' autoload :UpdateManager, 'pdk/module/update_manager' autoload :Update, 'pdk/module/update' DEFAULT_IGNORED...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/control_repo.rb
Ruby
apache-2.0
231
main
3,333
require 'pdk' module PDK module ControlRepo CONTROL_REPO_FILES = ['environment.conf', 'Puppetfile'].freeze DEFAULT_IGNORED = [ '/pkg/', '~*', '/coverage', # Strictly speaking this isn't default but if people have tricked older PDK into thinking that a # Control Repo is a module...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template.rb
Ruby
apache-2.0
231
main
1,944
require 'pdk' module PDK module Template autoload :Fetcher, 'pdk/template/fetcher' autoload :Renderer, 'pdk/template/renderer' autoload :TemplateDir, 'pdk/template/template_dir' MODULE_TEMPLATE_TYPE = :module_template # Creates a TemplateDir object with the path or URL to the template # and...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/report.rb
Ruby
apache-2.0
231
main
4,019
require 'pdk' module PDK class Report autoload :Event, 'pdk/report/event' # @return [Array<String>] the list of supported report formats. def self.formats @formats ||= ['junit', 'text'].freeze end # @return [Symbol] the method name of the default report format. def self.default_format...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/answer_file.rb
Ruby
apache-2.0
231
main
315
require 'pdk' module PDK class AnswerFile # Determine the default path to the answer file. # # @return [String] The path on disk to the default answer file. def self.default_answer_file_path PDK::Util::Filesystem.expand_path(File.join(PDK::Util.cachedir, 'answers.json')) end end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util.rb
Ruby
apache-2.0
231
main
9,351
require 'pdk' # PDK::Util::Windows can not be lazy loaded because it conditionally requires # other files on Windows only. This can probably be fixed up with a later # refactoring. require 'pdk/util/windows' autoload :Pathname, 'pathname' module PDK module Util autoload :Bundler, 'pdk/util/bundler' autoloa...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/config.rb
Ruby
apache-2.0
231
main
13,552
require 'pdk' module PDK class Config autoload :IniFile, 'pdk/config/ini_file' autoload :IniFileSetting, 'pdk/config/ini_file_setting' autoload :JSON, 'pdk/config/json' autoload :JSONSchemaNamespace, 'pdk/config/json_schema_namespace' autoload :JSONSchemaSetting, 'pdk/config/json_schema_setting' ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/logger.rb
Ruby
apache-2.0
231
main
1,059
require 'logger' require 'pdk' module PDK class Logger < ::Logger WRAP_COLUMN_LIMIT = 78 def initialize super($stderr) @sent_messages = {} # TODO: Decide on output format. self.formatter = proc do |severity, _datetime, _progname, msg| prefix = "pdk (#{severity}): " i...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/context.rb
Ruby
apache-2.0
231
main
4,164
require 'pdk' module PDK module Context autoload :None, 'pdk/context/none' autoload :Module, 'pdk/context/module' autoload :ControlRepo, 'pdk/context/control_repo' # Automatically determines the PDK Context given a path. Create will continue up the directory tree until it # finds a valid context...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/bolt.rb
Ruby
apache-2.0
231
main
704
require 'pdk' module PDK module Bolt # Returns true or false depending on if any of the common files and directories in # a Bolt Project are found in the specified directory. If a directory is not specified, # the current working directory is used. # # @see https://puppet.com/docs/bolt/latest/bol...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli.rb
Ruby
apache-2.0
231
main
5,240
require 'cri' require 'pdk' require 'pdk/cli/errors' module TTY autoload :Prompt, 'tty/prompt' class Prompt autoload :Test, 'tty/prompt/test' end end module Cri class Command class CriExitException def initialize(is_error:) @is_error = is_error end end end end module PDK ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/validate.rb
Ruby
apache-2.0
231
main
3,515
require 'pdk' module PDK module Validate autoload :ExternalCommandValidator, 'pdk/validate/external_command_validator' autoload :InternalRubyValidator, 'pdk/validate/internal_ruby_validator' autoload :InvokableValidator, 'pdk/validate/invokable_validator' autoload :Validator, 'pdk/validate/validator'...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate.rb
Ruby
apache-2.0
231
main
669
require 'pdk' module PDK module Generate autoload :DefinedType, 'pdk/generate/defined_type' autoload :Module, 'pdk/generate/module' autoload :Provider, 'pdk/generate/provider' autoload :PuppetClass, 'pdk/generate/puppet_class' autoload :PuppetObject, 'pdk/generate/puppet_object' autoload :Tas...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/puppet_object.rb
Ruby
apache-2.0
231
main
9,168
require 'pdk' module PDK module Generate class PuppetObject attr_reader :context, :object_name, :options # Initialises the PDK::Generate::PuppetObject object. # # In general, this object should never be instantiated directly. Instead, # one of the subclasses should be used e.g. PDK...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/puppet_class.rb
Ruby
apache-2.0
231
main
1,229
require 'pdk' module PDK module Generate class PuppetClass < PuppetObject PUPPET_STRINGS_TYPE = 'puppet_classes'.freeze def initialize(*_args) super object_name_parts = @object_name.split('::') @object_name = if object_name_parts.first == module_name ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/provider.rb
Ruby
apache-2.0
231
main
853
require 'pdk' module PDK module Generate class Provider < PuppetObject def friendly_name 'Resource API Provider'.freeze end def template_files files = { 'provider_spec.erb' => "#{File.join('spec', 'unit', 'puppet', 'provider', object_name, object_name)}_spec.rb", ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/function.rb
Ruby
apache-2.0
231
main
1,615
require 'pdk' module PDK module Generate class Function < PuppetObject def initialize(*_args) super object_name_parts = @object_name.split('::') @object_name = if object_name_parts.first == module_name object_name else ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/fact.rb
Ruby
apache-2.0
231
main
514
require 'pdk' module PDK module Generate class Fact < PuppetObject def friendly_name 'Custom Fact'.freeze end def template_files files = { 'fact_spec.erb' => "#{File.join('spec', 'unit', 'facter', object_name)}_spec.rb" } return files if spec_only? ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/module.rb
Ruby
apache-2.0
231
main
14,013
require 'pdk' module PDK module Generate class Module def self.validate_options(opts = {}) require 'pdk/cli/util/option_validator' unless PDK::CLI::Util::OptionValidator.valid_module_name?(opts[:module_name]) error_msg = format("'%{module_name}' is not a valid module name.\n" \ ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/defined_type.rb
Ruby
apache-2.0
231
main
1,257
require 'pdk' module PDK module Generate class DefinedType < PuppetObject PUPPET_STRINGS_TYPE = 'defined_types'.freeze def initialize(*_args) super object_name_parts = @object_name.split('::') @object_name = if object_name_parts.first == module_name ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/task.rb
Ruby
apache-2.0
231
main
1,838
require 'pdk' module PDK module Generate class Task < PuppetObject def friendly_name 'Task' end def template_files return {} if spec_only? { 'task.erb' => File.join('tasks', "#{task_name}.sh") } end def template_data { n...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/generate/transport.rb
Ruby
apache-2.0
231
main
1,192
require 'pdk' module PDK module Generate class Transport < PuppetObject def friendly_name 'Resource API Transport'.freeze end def template_files # NOTE: Due to how the V1 templates work, the names of the source template files may be mismatched to # their destination, e....
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/template_dir.rb
Ruby
apache-2.0
231
main
2,914
require 'pdk' require 'forwardable' module PDK module Template # A helper class representing an already fetched template on disk, with an appropriate renderer instance. # @see PDK::Template.with class TemplateDir # Creates an instance of TemplateDir object # @see TemplateDir.new def sel...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/fetcher.rb
Ruby
apache-2.0
231
main
3,698
require 'pdk' module PDK module Template module Fetcher autoload :Git, 'pdk/template/fetcher/git' autoload :Local, 'pdk/template/fetcher/local' # Returns a Template Fetcher implementation for the given Template URI # @param uri [PDK::Util::TemplateURI] The URI of the template to fetch ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/renderer.rb
Ruby
apache-2.0
231
main
5,377
require 'pdk' module PDK module Template module Renderer autoload :V1, 'pdk/template/renderer/v1' # Returns the most appropriate renderer for the given Template Directory and Context # # @param template_root [String] The path to where the template exists on disk # @param template_u...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/fetcher/git.rb
Ruby
apache-2.0
231
main
3,363
require 'pdk' module PDK module Template module Fetcher class Git < PDK::Template::Fetcher::AbstractFetcher # Whether the passed uri is fetchable by Git. # @see PDK::Template::Fetcher.instance # @return [Boolean] def self.fetchable?(uri, _options = {}) PDK::Util::G...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/fetcher/local.rb
Ruby
apache-2.0
231
main
695
require 'pdk' module PDK module Template module Fetcher class Local < PDK::Template::Fetcher::AbstractFetcher # Whether the passed uri is fetchable. This is a catch-all and all URIs # are considered on-disk already. # # @see PDK::Template::Fetcher.instance # @return ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/renderer/v1.rb
Ruby
apache-2.0
231
main
914
require 'pdk' module PDK module Template module Renderer module V1 autoload :LegacyTemplateDir, 'pdk/template/renderer/v1/legacy_template_dir' autoload :Renderer, 'pdk/template/renderer/v1/renderer' autoload :TemplateFile, 'pdk/template/renderer/v1/template_file' # Whether ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/renderer/v1/renderer.rb
Ruby
apache-2.0
231
main
5,698
require 'pdk' require 'pdk/template/renderer' module PDK module Template module Renderer module V1 class Renderer < PDK::Template::Renderer::AbstractRenderer # @see PDK::Template::Renderer::AbstractRenderer.render def render(template_type, _name, options = {}) render...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/renderer/v1/template_file.rb
Ruby
apache-2.0
231
main
3,154
require 'pdk' require 'ostruct' module PDK module Template module Renderer module V1 class TemplateFile < OpenStruct # Initialises the TemplateFile object with the path to the template file # and the data to be used when rendering the template. # # @param tem...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/template/renderer/v1/legacy_template_dir.rb
Ruby
apache-2.0
231
main
4,126
require 'pdk' module PDK module Template module Renderer module V1 # The old templating code in the PDK passed through a TemplateDir object. This class mimics the methods # of that old class so that existing custom templates will still function with the newer refactor templating code. ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/context/none.rb
Ruby
apache-2.0
231
main
500
require 'pdk' module PDK module Context # Represents a context which the PDK does not know. For example # an empty directory class None < PDK::Context::AbstractContext # :nocov: # @see PDK::Context::AbstractContext.display_name def display_name 'an unknown context' end ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/context/module.rb
Ruby
apache-2.0
231
main
784
require 'pdk' module PDK module Context # Represents a context for a Puppet Module class Module < PDK::Context::AbstractContext # @param module_root [String] The root path for the module. # @param context_path [String] The path where this context was created from e.g. Dir.pwd # @see PDK::Co...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/context/control_repo.rb
Ruby
apache-2.0
231
main
2,612
require 'pdk' module PDK module Context # Represents a context for a directory based Control Repository class ControlRepo < PDK::Context::AbstractContext # @param repo_root [String] The root path for the control repo. # @param context_path [String] The path where this context was created from e.g...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/filesystem.rb
Ruby
apache-2.0
231
main
3,714
require 'pdk' autoload :FileUtils, 'fileutils' module PDK module Util module Filesystem def write_file(path, content) raise ArgumentError, 'content must be a String' unless content.is_a?(String) raise ArgumentError, 'path must be a String or Pathname' unless path.is_a?(String) || path.respo...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/env.rb
Ruby
apache-2.0
231
main
1,038
require 'pdk' require 'forwardable' module PDK module Util class Env class WindowsEnv extend Forwardable # Note, these delegators may not have case insensitive keys def_delegators :env_hash, :fetch, :select, :reject def []=(key, value) PDK::Util::Windows::Process...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/puppet_strings.rb
Ruby
apache-2.0
231
main
4,679
require 'pdk' module PDK module Util module PuppetStrings class NoObjectError < StandardError; end class RunError < StandardError; end class NoGeneratorError < StandardError; end # Runs Puppet for the purposes of generating puppet-strings output. # # @param *args [String] add...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/bundler.rb
Ruby
apache-2.0
231
main
8,960
require 'pdk' module PDK module Util module Bundler # class BundleHelper; end def self.ensure_bundle!(gem_overrides = {}) bundle = BundleHelper.new # This will default ensure_bundle! to re-resolving everything to latest gem_overrides ||= { puppet: nil, hiera: nil, facter: ni...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/ruby_version.rb
Ruby
apache-2.0
231
main
6,173
require 'pdk' require 'forwardable' module PDK module Util class RubyVersion class << self extend Forwardable def_delegators :instance, :gem_path, :gem_paths_raw, :gem_home, :available_puppet_versions, :bin_path # TODO: resolve this # rubocop:disable Lint/DuplicateMethods ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/windows.rb
Ruby
apache-2.0
231
main
315
module PDK module Util module Windows WIN32_FALSE = 0 module File; end if Gem.win_platform? require 'pdk/util/windows/api_types' require 'pdk/util/windows/string' require 'pdk/util/windows/file' require 'pdk/util/windows/process' end end end end
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/changelog_generator.rb
Ruby
apache-2.0
231
main
6,111
require 'pdk' module PDK module Util module ChangelogGenerator # Taken from the version regex in https://forgeapi.puppet.com/schemas/module.json VERSION_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/template_uri.rb
Ruby
apache-2.0
231
main
11,148
require 'pdk' module PDK module Util class TemplateURI SCP_PATTERN = %r{\A(?!\w+://)(?:(?<user>.+?)@)?(?<host>[^:/]+):(?<path>.+)\z} PACKAGED_TEMPLATE_KEYWORD = 'pdk-default'.freeze DEPRECATED_TEMPLATE_URL = 'https://github.com/puppetlabs/pdk-module-template'.freeze PDK_TEMPLATE_URL = 'h...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/puppet_version.rb
Ruby
apache-2.0
231
main
8,559
require 'pdk' require 'json' require 'forwardable' module PDK module Util class PuppetVersion class << self extend Forwardable def_delegators :instance, :puppet_dev_env, :puppet_dev_path, :fetch_puppet_dev, :find_gem_for, :from_pe_version, :from_module_metadata, :latest_available ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/vendored_file.rb
Ruby
apache-2.0
231
main
2,463
require 'pdk' module PDK module Util class VendoredFile class DownloadError < StandardError; end attr_reader :file_name, :url def initialize(file_name, url) @file_name = file_name @url = url end def read require 'pdk/util' require 'pdk/util/filesys...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/json_finder.rb
Ruby
apache-2.0
231
main
2,472
module PDK module Util # Processes a given string, looking for JSON objects and parsing them. # # @example A string with a JSON object and some junk characters # PDK::Util::JSONFinder.new('foo{"bar":1}').objects # => [{ 'bar' => 1 }] # # @example A string with mulitple JSON objects ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/version.rb
Ruby
apache-2.0
231
main
1,071
require 'pdk' module PDK module Util module Version def self.version_string require 'pdk/version' "#{PDK::VERSION} #{pdk_ref}".strip.freeze end def self.pdk_ref ref = "#{pkg_sha} #{git_ref}".strip ref.empty? ? nil : "(#{ref})" end def self.pkg_sha ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/git.rb
Ruby
apache-2.0
231
main
6,066
require 'pdk' module PDK module Util class GitError < StandardError attr_reader :stdout, :stderr, :exit_code, :args def initialze(args, result) @args = args @stdout = result[:stdout] @stderr = result[:stderr] @exit_code = result[:exit_code] super(format('Git ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/windows/string.rb
Ruby
apache-2.0
231
main
708
require 'pdk/util/windows' module PDK module Util module Windows module String def wide_string(str) # if given a nil string, assume caller wants to pass a nil pointer to win32 return if str.nil? # ruby (< 2.1) does not respect multibyte terminators, so it is possible ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/windows/file.rb
Ruby
apache-2.0
231
main
1,259
require 'pdk/util/windows' module PDK module Util module Windows module File require 'ffi' extend FFI::Library extend PDK::Util::Windows::String def get_long_pathname(path) converted = '' FFI::Pointer.from_string_to_wide_string(path) do |path_ptr| ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/windows/api_types.rb
Ruby
apache-2.0
231
main
3,416
require 'ffi' require 'pdk/util/windows/string' module PDK module Util module Windows module APITypes module ::FFI module Library def attach_function_private(*args) attach_function(*args) private args[0] end end end ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/util/windows/process.rb
Ruby
apache-2.0
231
main
3,052
require 'pdk/util/windows' module PDK module Util module Windows module Process require 'ffi' extend PDK::Util::Windows::String extend FFI::Library def environment_hash env_ptr = GetEnvironmentStringsW() contains_unicode_replacement = lambda do |string|...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/get.rb
Ruby
apache-2.0
231
main
526
module PDK module CLI @get_cmd = @base_cmd.define_command do name 'get' usage 'get [subcommand] [options]' summary 'Retrieve information about the PDK or current project.' default_subcommand 'help' run do |_opts, args, _cmd| if args == ['help'] PDK::CLI.run(['get',...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/build.rb
Ruby
apache-2.0
231
main
3,354
module PDK module CLI @build_cmd = @base_cmd.define_command do name 'build' usage 'build [options]' summary 'Builds a package from the module that can be published to the Puppet Forge.' option nil, 'target-dir', 'The target directory where you want PDK to write the package.',...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/util.rb
Ruby
apache-2.0
231
main
11,355
require 'pdk' module PDK module CLI module Util autoload :CommandRedirector, 'pdk/cli/util/command_redirector' autoload :OptionNormalizer, 'pdk/cli/util/option_normalizer' autoload :OptionValidator, 'pdk/cli/util/option_validator' autoload :Interview, 'pdk/cli/util/interview' autolo...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/console.rb
Ruby
apache-2.0
231
main
5,917
module PDK module CLI @console_cmd = @base_cmd.define_command do name 'console' usage 'console [console_options]' summary '(Experimental) Start a session of the puppet debugger console.' default_subcommand 'help' description <<~EOF The pdk console runs a interactive session o...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/set.rb
Ruby
apache-2.0
231
main
531
module PDK module CLI @set_cmd = @base_cmd.define_command do name 'set' usage 'set [subcommand] [options]' summary 'Set or update information about the PDK or current project.' default_subcommand 'help' run do |_opts, args, _cmd| if args == ['help'] PDK::CLI.run(['...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/env.rb
Ruby
apache-2.0
231
main
1,879
module PDK module CLI @env_cmd = @base_cmd.define_command do name 'env' usage 'env' summary '(Experimental) Output environment variables for specific Puppet context' description <<~EOF [experimental] Aids in setting a CLI context for a specified version of Puppet by outputting expo...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/errors.rb
Ruby
apache-2.0
231
main
574
require 'pdk' module PDK module CLI class FatalError < StandardError attr_reader :exit_code def initialize(msg = 'An unexpected error has occurred. Try running the command again with --debug', opts = {}) @exit_code = opts.fetch(:exit_code, 1) super(msg) end end class E...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/new.rb
Ruby
apache-2.0
231
main
600
module PDK module CLI @new_cmd = @base_cmd.define_command do name 'new' usage 'new <thing> [options]' summary 'create a new module, etc.' description 'Creates a new <thing> using relevant options.' default_subcommand 'help' end @new_cmd.add_command Cri::Command.new_basic_hel...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/convert.rb
Ruby
apache-2.0
231
main
2,083
module PDK module CLI @convert_cmd = @base_cmd.define_command do name 'convert' usage 'convert [options]' summary 'Convert an existing module to be compatible with the PDK.' PDK::CLI.template_url_option(self) PDK::CLI.template_ref_option(self) PDK::CLI.skip_interview_option(se...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/update.rb
Ruby
apache-2.0
231
main
2,293
module PDK module CLI @update_cmd = @base_cmd.define_command do name 'update' usage 'update [options]' summary 'Update a module that has been created by or converted for use by PDK.' flag nil, :noop, 'Do not update the module, just output what would be done.' flag nil, :force, 'Upda...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/exec.rb
Ruby
apache-2.0
231
main
2,437
require 'pdk' module PDK module CLI module Exec autoload :Command, 'pdk/cli/exec/command' autoload :InteractiveCommand, 'pdk/cli/exec/interactive_command' def self.execute(*cmd) require 'pdk/cli/exec/command' Command.new(*cmd).execute! end def self.execute_with_en...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/release.rb
Ruby
apache-2.0
231
main
7,181
require 'pdk/cli/util' require 'pdk/validate' require 'pdk/util/bundler' require 'pdk/cli/util/interview' require 'pdk/util/changelog_generator' module PDK module CLI @release_cmd = @base_cmd.define_command do name 'release' usage 'release [options]' summary '(Experimental) Release a module to ...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/exec_group.rb
Ruby
apache-2.0
231
main
3,024
require 'pdk' module PDK module CLI class ExecGroup # Execution Group (ExecGroup) factory. # # @param message [String] A name or message for this group. Provided for backwards compatibility during refactor # # @param create_options [Hash] A hash options used during creation of the E...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/validate.rb
Ruby
apache-2.0
231
main
4,927
module PDK module CLI @validate_cmd = @base_cmd.define_command do name 'validate' usage 'validate [validators] [options] [targets]' summary 'Run static analysis tests.' description "Run metadata, YAML, Puppet, Ruby, or Tasks validation.\n\n" \ '[validators] is an optional...
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/test.rb
Ruby
apache-2.0
231
main
288
module PDK module CLI @test_cmd = @base_cmd.define_command do name 'test' usage 'test [subcommand] [options]' summary 'Run tests.' default_subcommand 'help' end @test_cmd.add_command Cri::Command.new_basic_help end end require 'pdk/cli/test/unit'
github
puppetlabs/pdk
https://github.com/puppetlabs/pdk
lib/pdk/cli/remove.rb
Ruby
apache-2.0
231
main
555
module PDK module CLI @remove_cmd = @base_cmd.define_command do name 'remove' usage 'remove [subcommand] [options]' summary 'Remove or delete information about the PDK or current project.' default_subcommand 'help' run do |_opts, args, _cmd| if args == ['help'] PDK...