class Changelog::CLI

Public Instance Methods

bundle_entries(version) click to toggle source
# File lib/changelog/cli.rb, line 34
def bundle_entries(version) 
    semver = Changelog::SemanticVersion::new(version)

    bundler = Changelog::Bundler.new(semver, options['changelog-file'], options['include-date'], options['no-commit'], options["dry-run"],  options["force"])
    bundler.execute
end
gen_entry(title="") click to toggle source
# File lib/changelog/cli.rb, line 20
def gen_entry(title="") 
    type = options.type || read_type
    
    generator = Changelog::Generator.new(title, type, options.author, options.issue, options["merge-request"], options.amend, options.force)
    generator.execute(options["dry-run"])
end

Private Instance Methods

assert_valid_type!(type) click to toggle source
# File lib/changelog/cli.rb, line 60
def assert_valid_type!(type)
    unless type
        raise Abort, "Invalid category index, please select an index between 1 and #{Changelog::Entry::TYPES.length}"
    end
end
read_type() click to toggle source
# File lib/changelog/cli.rb, line 43
def read_type
    read_type_message

    type = Changelog::Entry::TYPES[$stdin.getc.to_i - 1]
    assert_valid_type!(type)

    type.name
end
read_type_message() click to toggle source
# File lib/changelog/cli.rb, line 52
def read_type_message
    $stdout.puts "\n>> Please specify the index for the category of your change:"
    Changelog::Entry::TYPES.each_with_index do |type, index|
        $stdout.puts "#{index + 1}. #{type.description}"
    end
    $stdout.print "\n?> "
end