Sha256: a4c699bc0bd511afa140a43c8d9286fccbf89946ecdfabd087175aa8e70a4ca8
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'optparse' require 'tagging/app_version' require 'tagging/gem_version' module Tagging class CLI def self.run(options) if options[:push] puts Tagging::AppVersion.increment_and_push rescue exit 1 exit 0 elsif options[:version] puts Tagging::AppVersion.version rescue exit 1 exit 0 elsif options[:next_version] puts Tagging::AppVersion.increment_version rescue exit 1 exit 0 else puts "## [message] Run `tagging --help' for more options." end end def self.options_verify?(op) if op[:help] and ([op[:push], op[:version], op[:next_version]].compact.length > 1) warn("[fail] Can only push, version or next_version. Choose one.") exit(1) end end end end options = {} opt_parser = OptionParser.new do |opt| opt.banner = "Usage: tagging [OPTIONS]" opt.separator "" opt.separator "Options" opt.on("-p","--push","Increment version and push to tag") do |value| options[:push] = value end opt.on("-v","--version","Show current version into rails app path") do |value| options[:version] = value end opt.on("-n","--next_version","Show the next version") do |value| options[:next_version] = value end opt.on("-h","--help","help") do puts opt_parser exit end end opt_parser.parse! Tagging::CLI.run(options)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tagging-0.0.2 | bin/git-tagging |
tagging-0.0.3 | bin/git-tagging |