Top Level Namespace
Defined Under Namespace
Modules: Puppet, PuppetlabsSpec, PuppetlabsSpecHelper, RSpec Classes: SetupBeaker
Instance Method Summary collapse
- #create_gch_task(changelog_user = nil, changelog_project = nil, changelog_since_tag = nil, changelog_tag_pattern = 'v%s') ⇒ Object
- #param_value(subject, type, title, param) ⇒ Object
- #verify_contents(subject, title, expected_lines) ⇒ Object
Methods included from PuppetlabsSpecHelper::Tasks::FixtureHelpers
#auto_symlink, #clone_repo, #current_thread_count, #download_items, #download_module, #download_repository, #fixtures, #forge_modules, #git_remote_url, #include_repo?, #logger, #max_thread_limit, #module_name, #module_target_dir, #module_version, #module_working_directory, #remove_subdirectory, #repositories, #revision, #setup_symlink, #shallow_git_repo?, #source_dir, #symlinks, #update_repo, #valid_repo?, #validate_fixture_hash!, #windows?
Methods included from PuppetlabsSpecHelper::Tasks::BeakerHelpers
#beaker_node_sets, #repositories, #source_dir, #vagrant_ssh
Instance Method Details
#create_gch_task(changelog_user = nil, changelog_project = nil, changelog_since_tag = nil, changelog_tag_pattern = 'v%s') ⇒ Object
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/puppetlabs_spec_helper/rake_tasks.rb', line 348 def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_since_tag = nil, changelog_tag_pattern = 'v%s') if Bundler.rubygems.find_name('github_changelog_generator').any? # needed a place to hide these methods # rubocop:disable Lint/NestedMethodDefinition def result = JSON.parse(File.read('metadata.json'))['author'] raise 'unable to find the changelog_user in .sync.yml, or the author in metadata.json' if result.nil? puts "GitHubChangelogGenerator user:#{result}" result end def result = JSON.parse(File.read('metadata.json'))['name'] raise 'unable to find the changelog_project in .sync.yml or the name in metadata.json' if result.nil? puts "GitHubChangelogGenerator project:#{result}" result end def changelog_future_release return unless Rake.application.top_level_tasks.include? 'changelog' result = JSON.parse(File.read('metadata.json'))['version'] raise 'unable to find the future_release (version) in metadata.json' if result.nil? puts "GitHubChangelogGenerator future_release:#{result}" result end # rubocop:enable Lint/NestedMethodDefinition GitHubChangelogGenerator::RakeTask.new :changelog do |config| if ENV['CHANGELOG_GITHUB_TOKEN'].nil? raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" end config.user = changelog_user || config.project = changelog_project || config.since_tag = changelog_since_tag if changelog_since_tag config.future_release = changelog_tag_pattern % changelog_future_release.to_s config.exclude_labels = ['maintenance'] config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. " \ 'The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres ' \ 'to [Semantic Versioning](https://semver.org).' config.add_pr_wo_labels = true config.issues = false config.merge_prefix = '### UNCATEGORIZED PRS; GO LABEL THEM' config.configure_sections = { 'Changed' => { 'prefix' => '### Changed', 'labels' => ['backwards-incompatible'], }, 'Added' => { 'prefix' => '### Added', 'labels' => %w[feature enhancement], }, 'Fixed' => { 'prefix' => '### Fixed', 'labels' => ['bugfix'], }, } end else desc 'Generate a Changelog from GitHub' task :changelog do raise <<~MESSAGE The changelog tasks depends on unreleased features of the github_changelog_generator gem. Please manually add it to your .sync.yml for now, and run `pdk update`: --- Gemfile: optional: ':development': - gem: 'github_changelog_generator' git: 'https://github.com/skywinder/github-changelog-generator' ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')" MESSAGE end end end |
#param_value(subject, type, title, param) ⇒ Object
7 8 9 |
# File 'lib/puppetlabs_spec_helper/module_spec_helper.rb', line 7 def param_value(subject, type, title, param) subject.resource(type, title).send(:parameters)[param.to_sym] end |
#verify_contents(subject, title, expected_lines) ⇒ Object
11 12 13 14 |
# File 'lib/puppetlabs_spec_helper/module_spec_helper.rb', line 11 def verify_contents(subject, title, expected_lines) content = subject.resource('file', title).send(:parameters)[:content] expect(content.split("\n") & expected_lines).to match_array expected_lines.uniq end |