Module: PDK

Defined in:
lib/pdk.rb,
lib/pdk/cli.rb,
lib/pdk/bolt.rb,
lib/pdk/util.rb,
lib/pdk/config.rb,
lib/pdk/logger.rb,
lib/pdk/module.rb,
lib/pdk/report.rb,
lib/pdk/cli/env.rb,
lib/pdk/cli/get.rb,
lib/pdk/cli/new.rb,
lib/pdk/cli/set.rb,
lib/pdk/context.rb,
lib/pdk/version.rb,
lib/pdk/cli/exec.rb,
lib/pdk/cli/test.rb,
lib/pdk/cli/util.rb,
lib/pdk/generate.rb,
lib/pdk/template.rb,
lib/pdk/util/env.rb,
lib/pdk/util/git.rb,
lib/pdk/validate.rb,
lib/pdk/cli/build.rb,
lib/pdk/cli/bundle.rb,
lib/pdk/cli/errors.rb,
lib/pdk/cli/remove.rb,
lib/pdk/cli/update.rb,
lib/pdk/tests/unit.rb,
lib/pdk/answer_file.rb,
lib/pdk/cli/console.rb,
lib/pdk/cli/convert.rb,
lib/pdk/cli/release.rb,
lib/pdk/config/json.rb,
lib/pdk/config/yaml.rb,
lib/pdk/cli/new/fact.rb,
lib/pdk/cli/new/task.rb,
lib/pdk/cli/new/test.rb,
lib/pdk/cli/validate.rb,
lib/pdk/context/none.rb,
lib/pdk/control_repo.rb,
lib/pdk/report/event.rb,
lib/pdk/util/bundler.rb,
lib/pdk/util/version.rb,
lib/pdk/util/windows.rb,
lib/pdk/cli/new/class.rb,
lib/pdk/cli/test/unit.rb,
lib/pdk/config/errors.rb,
lib/pdk/generate/fact.rb,
lib/pdk/generate/task.rb,
lib/pdk/module/update.rb,
lib/pdk/cli/exec_group.rb,
lib/pdk/cli/get/config.rb,
lib/pdk/cli/new/module.rb,
lib/pdk/cli/set/config.rb,
lib/pdk/config/setting.rb,
lib/pdk/context/module.rb,
lib/pdk/module/convert.rb,
lib/pdk/module/release.rb,
lib/pdk/config/ini_file.rb,
lib/pdk/generate/module.rb,
lib/pdk/module/metadata.rb,
lib/pdk/util/filesystem.rb,
lib/pdk/cli/exec/command.rb,
lib/pdk/cli/new/function.rb,
lib/pdk/cli/new/provider.rb,
lib/pdk/cli/release/prep.rb,
lib/pdk/config/namespace.rb,
lib/pdk/config/validator.rb,
lib/pdk/template/fetcher.rb,
lib/pdk/util/json_finder.rb,
lib/pdk/cli/new/transport.rb,
lib/pdk/cli/remove/config.rb,
lib/pdk/generate/function.rb,
lib/pdk/generate/provider.rb,
lib/pdk/template/renderer.rb,
lib/pdk/util/ruby_version.rb,
lib/pdk/util/template_uri.rb,
lib/pdk/util/windows/file.rb,
lib/pdk/cli/util/interview.rb,
lib/pdk/generate/transport.rb,
lib/pdk/util/vendored_file.rb,
lib/pdk/validate/validator.rb,
lib/pdk/cli/release/publish.rb,
lib/pdk/util/puppet_strings.rb,
lib/pdk/util/puppet_version.rb,
lib/pdk/util/windows/string.rb,
lib/pdk/cli/new/defined_type.rb,
lib/pdk/context/control_repo.rb,
lib/pdk/template/fetcher/git.rb,
lib/pdk/template/renderer/v1.rb,
lib/pdk/util/windows/process.rb,
lib/pdk/generate/defined_type.rb,
lib/pdk/generate/puppet_class.rb,
lib/pdk/module/update_manager.rb,
lib/pdk/template/template_dir.rb,
lib/pdk/generate/puppet_object.rb,
lib/pdk/template/fetcher/local.rb,
lib/pdk/util/windows/api_types.rb,
lib/pdk/config/ini_file_setting.rb,
lib/pdk/config/json_with_schema.rb,
lib/pdk/config/yaml_with_schema.rb,
lib/pdk/util/changelog_generator.rb,
lib/pdk/validate/validator_group.rb,
lib/pdk/cli/util/option_validator.rb,
lib/pdk/cli/util/option_normalizer.rb,
lib/pdk/config/json_schema_setting.rb,
lib/pdk/cli/util/command_redirector.rb,
lib/pdk/cli/exec/interactive_command.rb,
lib/pdk/config/json_schema_namespace.rb,
lib/pdk/validate/invokable_validator.rb,
lib/pdk/template/renderer/v1/renderer.rb,
lib/pdk/cli/util/update_manager_printer.rb,
lib/pdk/validate/internal_ruby_validator.rb,
lib/pdk/template/renderer/v1/template_file.rb,
lib/pdk/validate/ruby/ruby_validator_group.rb,
lib/pdk/validate/yaml/yaml_validator_group.rb,
lib/pdk/validate/external_command_validator.rb,
lib/pdk/validate/tasks/tasks_name_validator.rb,
lib/pdk/validate/yaml/yaml_syntax_validator.rb,
lib/pdk/validate/puppet/puppet_epp_validator.rb,
lib/pdk/validate/ruby/ruby_rubocop_validator.rb,
lib/pdk/validate/tasks/tasks_validator_group.rb,
lib/pdk/validate/puppet/puppet_lint_validator.rb,
lib/pdk/validate/puppet/puppet_validator_group.rb,
lib/pdk/validate/puppet/puppet_syntax_validator.rb,
lib/pdk/template/renderer/v1/legacy_template_dir.rb,
lib/pdk/validate/metadata/metadata_validator_group.rb,
lib/pdk/validate/metadata/metadata_syntax_validator.rb,
lib/pdk/validate/puppet/puppet_plan_syntax_validator.rb,
lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb,
lib/pdk/validate/metadata/metadata_json_lint_validator.rb,
lib/pdk/validate/control_repo/environment_conf_validator.rb,
lib/pdk/validate/control_repo/control_repo_validator_group.rb

Defined Under Namespace

Modules: Bolt, CLI, Context, ControlRepo, Generate, Module, Template, Test, Util, Validate Classes: AnswerFile, Config, Logger, Report

Constant Summary collapse

VERSION =
'3.3.0'.freeze
TEMPLATE_REF =
'3.3.0'.freeze

Class Method Summary collapse

Class Method Details

.available_feature_flagsObject



47
48
49
# File 'lib/pdk.rb', line 47

def self.available_feature_flags
  @available_feature_flags ||= ['controlrepo'].freeze
end

.configObject



35
36
37
38
39
40
41
# File 'lib/pdk.rb', line 35

def self.config
  return @config unless @config.nil?

  options = {}
  options['user.module_defaults.path'] = PDK::Util::Env['PDK_ANSWER_FILE'] unless PDK::Util::Env['PDK_ANSWER_FILE'].nil?
  @config = PDK::Config.new(options)
end

.contextObject



43
44
45
# File 'lib/pdk.rb', line 43

def self.context
  @context ||= PDK::Context.create(Dir.pwd)
end

.feature_flag?(flagname) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
59
# File 'lib/pdk.rb', line 55

def self.feature_flag?(flagname)
  return false unless available_feature_flags.include?(flagname)

  requested_feature_flags.include?(flagname)
end

.loggerObject



31
32
33
# File 'lib/pdk.rb', line 31

def self.logger
  @logger ||= PDK::Logger.new
end

.requested_feature_flagsObject



51
52
53
# File 'lib/pdk.rb', line 51

def self.requested_feature_flags
  @requested_feature_flags ||= (PDK::Util::Env['PDK_FEATURE_FLAGS'] || '').split(',').map(&:strip)
end