Sha256: f5563cbf444b43047c10136663bc1a801a2c278f55b17e88d23ffcbf8deb459f

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

# frozen_string_literal: true

require 'chef/knife'
require 'mixlib/shellout'

class Chef
  class Knife
    class Changelog < Knife
      banner 'knife changelog COOKBOOK [COOKBOOK ...]'

      deps do
        require 'knife/changelog/version'
        require 'knife/changelog/changelog'
        require 'knife/changelog/berksfile'
        require 'berkshelf'
        require 'policyfile'
      end

      option :linkify,
             short: '-l',
             long: '--linkify',
             description: 'add markdown links where relevant',
             boolean: true

      option :markdown,
             short: '-m',
             long: '--markdown',
             description: 'use markdown syntax',
             boolean: true

      option :ignore_changelog_file,
             long: '--ignore-changelog-file',
             description: 'Ignore changelog file presence, use git history instead',
             boolean: true

      option :allow_update_all,
             long: '--allow-update-all',
             description: 'If no cookbook given, check all Berksfile',
             boolean: true,
             default: true

      option :submodules,
             long: '--submodules SUBMODULE[,SUBMODULE]',
             description: 'Submoduless to check for changes as well (comma separated)'

      option :policyfile,
             long: '--policyfile PATH',
             description: 'Link to policyfile, defaults to "Policyfile.rb"',
             default: 'Policyfile.rb'

      option :update,
             long: '--update',
             description: 'Update Berksfile'

      def run
        Log.info config
        if config[:policyfile] && File.exist?(config[:policyfile])
          PolicyChangelog.new(@name_args, config[:policyfile]).generate_changelog
        else
          berksfile = Berkshelf::Berksfile.from_options({})
          puts KnifeChangelog::Changelog::Berksfile
            .new(berksfile, config)
            .run(@name_args)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knife-changelog-1.0.7 lib/chef/knife/changelog.rb