Sha256: 72475bcd8ecebe1f2eb52ec3ac72d56ffbd070ecb379a1fe7db23c75b7a53bf5

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

command :pending do
  desc 'Displays commits pending'

  option '--from [REF]', 'Version to start from (default: latest version)' do |value, options|
    options[:from] = value
  end

  option '--to [REF]', 'Commit to end at (default: HEAD)' do |value, options|
    options[:to] = value
  end

  option '--pre [PREFIX]', 'Create a pre-release version' do |value, options|
    options[:pre] = value || true
  end

  action do |context|
    require 'schmersion/repo'
    require 'schmersion/helpers'

    repo = Schmersion::Repo.new(FileUtils.pwd)
    current_version, next_version = repo.pending_version(
      from: context.options[:from],
      to: context.options[:to],
      version_options: {
        pre: context.options[:pre],
        breaking_change_not_major: repo.config.version_options[:breaking_change_not_major]
      }
    )

    puts
    if current_version
      puts 'The current published version is:'
      puts
      puts "    #{current_version.to_s.cyan}"
      puts
      puts 'The next version will be:'
    else
      puts 'The first version will be:'
    end
    puts
    puts "    #{next_version.version.to_s.green}"
    puts
    puts 'The following commits will be included:'
    puts
    Schmersion::Helpers.print_commit_list(next_version.commits, prefix: '    ')
    puts
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
schmersion-1.1.3 cli/pending.rb
schmersion-1.1.2 cli/pending.rb
schmersion-1.1.0 cli/pending.rb