#!/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) pre do |global, command, options, args| if args.length != 1 || !['major', 'minor', 'patch'].any? {|segment| args.include?(segment)} STDERR.puts('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) 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) mix.execute end end exit(run(ARGV))