Sha256: 73f2ba31c08e995695979913edc091172c6d58bfb308ef9d4cd7dd1988bdc155

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))

require 'incr'
require 'gli'

include GLI::App

program_desc('Tasteful utility to increment the version number and create a corresponding git tag.')
version(Incr::VERSION)

flag([:d, :version_file_dir], default_value: '.', desc: 'Directory where to search for version file')
flag([:t, :tag_name_pattern], default_value: 'v%s', desc: 'Pattern for the tag name')

switch(:commit, default_value: true, desc: 'Commit changes')
switch(:tag, default_value: true, desc: 'Create a git tag')

pre do |global, command, options, args|
  if args.length != 1 || !['major', 'minor', 'patch'].any? {|segment| args.include?(segment)}
    warn('expecting a single argument: major, minor or patch.')
    return false
  end
  true
end

# NPM Support
desc('Increment the version of your NPM package.')
command :npm do |cmd|
  cmd.action do |global_options, options, args|
    npm = Incr::Command::Npm.new(args, global_options)
    npm.execute
  end
end

# Elixir Support
desc('Increment the version of your Mix package.')
command :mix do |cmd|
  cmd.action do |global_options, options, args|
    mix = Incr::Command::Mix.new(args, global_options)
    mix.execute
  end
end

exit(run(ARGV))

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
incr-1.0.0 bin/incr