From 5de7a65f4721a0731aaed8d76c892cf8ccd75f8c Mon Sep 17 00:00:00 2001 From: Martyn Loughran Date: Thu, 12 Apr 2012 17:53:02 +0100 Subject: [PATCH] Add command line option to print version --- bin/git-cleanup | 4 ++++ git-cleanup.gemspec | 3 ++- lib/git-cleanup.rb | 1 + lib/git-cleanup/version.rb | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 lib/git-cleanup/version.rb diff --git a/bin/git-cleanup b/bin/git-cleanup index 45c109a..4e293c8 100755 --- a/bin/git-cleanup +++ b/bin/git-cleanup @@ -15,6 +15,10 @@ opts = OptionParser.new do |opts| opts.on("-s", "--skip-unmerged", "Unmerge branches will be skipped") do |u| conf[:skip_unmerged] = true end + opts.on("-v", "--version", "Shows version") do + puts GitCleanup::VERSION + exit + end opts.on("-h", "--help", "Shows this help") do puts opts exit diff --git a/git-cleanup.gemspec b/git-cleanup.gemspec index 9d110c7..742a4e3 100644 --- a/git-cleanup.gemspec +++ b/git-cleanup.gemspec @@ -1,9 +1,10 @@ # -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) +require "git-cleanup/version" Gem::Specification.new do |s| s.name = "git-cleanup" - s.version = "0.1.3" + s.version = GitCleanup::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Martyn Loughran"] s.email = ["me@mloughran.com"] diff --git a/lib/git-cleanup.rb b/lib/git-cleanup.rb index a1397fe..50b4653 100644 --- a/lib/git-cleanup.rb +++ b/lib/git-cleanup.rb @@ -94,3 +94,4 @@ def self.prune(repo) require 'git-cleanup/branch' require 'git-cleanup/helper' +require 'git-cleanup/version' diff --git a/lib/git-cleanup/version.rb b/lib/git-cleanup/version.rb new file mode 100644 index 0000000..d72257b --- /dev/null +++ b/lib/git-cleanup/version.rb @@ -0,0 +1,3 @@ +class GitCleanup + VERSION = "0.1.3" +end