Sha256: 237847c687a0b4c83e9c7b7df3d69e1868aa83a7d1339cadefb83e2a618b1a0d

Contents?: true

Size: 2 KB

Versions: 1

Compression:

Stored size: 2 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'optparse'
require 'shellwords'

options = {}
OptionParser.new do |opts|
  opts.banner = <<-BANNER.gsub(/^    /, "")
    Bump your gem version.

    Usage:
        bump current              # show current version
        bump show-next INCREMENT  # show next (pre|patch|minor|major) version of your gem
        bump file                 # show version file path
        bump pre                  # increase prerelease version of your gem (1.0.0-X) [alpha, beta, rc, ]
        bump patch                # increase patch version of your gem (1.0.X)
        bump minor                # increase minor version of your gem (1.X.0)
        bump major                # increase major version of your gem (X.0.0)
        bump set 1.2.3            # set the version number to the given value

    Options:
  BANNER
  opts.on("--no-commit", "Do not make a commit.") { options[:commit] = false }
  opts.on("-m", "--commit-message MSG", String, "Append MSG to the commit message.") { |msg| options[:commit_message] = msg }
  opts.on("--no-bundle", "Do not bundle.") { options[:bundle] = false }
  opts.on("--tag", "Create git tag from version (only if commit is true).") { options[:tag] = true }
  opts.on("--tag-prefix TAG_PREFIX", "Prefix the tag with this string, ex. 'v'") { |tag_prefix| options[:tag_prefix] = tag_prefix }
  opts.on("--replace-in FILE", String, "Replace old version with the new version additionally in this file") { |f| (options[:replace_in] ||= []) << f }
  opts.on("--changelog", "Update CHANGELOG.md") { options[:changelog] = true }
  opts.on("-h", "--help", "Show this.") { puts opts; exit }
end.parse!

valid_argv = ["set", "show-next"].include?(ARGV.first) ? 2 : 1
abort "Usage instructions: bump --help" unless ARGV.size == valid_argv

options[:version] = ARGV[1] if ARGV[0] == "set"
options[:increment] = ARGV[1] if ARGV[0] == "show-next"

require File.dirname(__FILE__) + '/../lib/bump'
output, status = Bump::Bump.run(ARGV.first, options)
puts output
exit status

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bump-0.9.0 bin/bump