Skip to content

Commit 94b2d74

Browse files
committed
--version argument added.
1 parent d70a433 commit 94b2d74

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ install:
1717
script:
1818
- make test
1919
- cd
20-
- which -a mpcat
20+
- which -a mpcat
21+
- mpcat --version

bin/mpcat

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require 'optparse'
77
require 'yaml'
88
require 'pp'
99
require 'msgpack'
10+
require 'mpcat'
1011

1112

1213
options = {
@@ -25,6 +26,12 @@ opts = OptionParser.new do |o|
2526
options[:yaml] = false
2627
end
2728

29+
o.on_tail('--version', 'Show version.') do
30+
puts "mpcat #{MPCat::VERSION}"
31+
puts MPCat::HOMEPAGE
32+
exit
33+
end
34+
2835
o.on_tail('-h', '--help', 'Show this message.') do
2936
puts o
3037
puts

lib/mpcat.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
require 'mpcat/version'

lib/mpcat/version.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
module MPCat
3+
VERSION = '1.1.0-dev.1'
4+
DATE = '2015-12-21'
5+
HOMEPAGE = 'https://github.com/TheFox/mpcat'
6+
end

mpcat.gemspec

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
# coding: UTF-8
22

3+
lib = File.expand_path('../lib', __FILE__)
4+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5+
6+
require 'mpcat/version'
7+
38
Gem::Specification.new do |spec|
49
spec.name = 'mpcat'
5-
spec.version = '1.0.1-dev'
6-
spec.date = '2015-12-21'
10+
spec.version = MPCat::VERSION
11+
spec.date = MPCat::DATE
712
spec.author = 'Christian Mayer'
813
spec.email = '[email protected]'
914

1015
spec.summary = %q{MessagePack Cat}
1116
spec.description = %q{Pretty print for MessagePack files.}
12-
spec.homepage = 'https://github.com/TheFox/mpcat'
17+
spec.homepage = MPCat::HOMEPAGE
1318
spec.license = 'GPL-3.0'
1419

1520
spec.files = `git ls-files -z`.split("\x0").reject{ |f| f.match(%r{^(test|spec|features)/}) }
1621
spec.bindir = 'bin'
1722
spec.executables = ['mpcat']
23+
spec.require_paths = ['lib']
1824
spec.required_ruby_version = '>=1.9.0'
1925

2026
spec.add_dependency 'msgpack', '~>0.7'

0 commit comments

Comments
 (0)