mercenary 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/History.markdown +6 -5
- data/lib/mercenary.rb +5 -8
- data/lib/mercenary/program.rb +8 -1
- data/lib/mercenary/version.rb +1 -1
- data/mercenary.gemspec +1 -1
- data/spec/option_spec.rb +3 -3
- data/spec/spec_helper.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f4dfe1178635732a9da7f3221db5cab85da88f
|
4
|
+
data.tar.gz: d1ddfc45773425b1a91016111189625a4a6f8bc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43845c7d35b7cae824bc238a5bdfa340bb15ed4dde3444ffb4dee893acb104e5e769694aed071b0cf74a1c5657b019d402c21a2b6857b5fc3a368cb8ba3803dd
|
7
|
+
data.tar.gz: d2398c2e216c6c5c2e286e3c254b0d7a65038bc6c4e50a6711b6fbb05fe8bbe3c9bd258b93e154a9ae496f2a11c3cec41cdfb528f7eec80894a2115baba93da4
|
data/.travis.yml
CHANGED
data/History.markdown
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
##
|
2
|
-
|
3
|
-
### Major Enhancements
|
4
|
-
|
5
|
-
### Minor Enhancements
|
1
|
+
## 0.3.5 / 2014-11-12
|
6
2
|
|
7
3
|
### Bug Fixes
|
8
4
|
|
5
|
+
* Capture `OptionsParser::InvalidOption` and show a nice error message (#38)
|
6
|
+
* Absolute paths for requires and autoloads (#39)
|
7
|
+
|
9
8
|
### Development Fixes
|
10
9
|
|
10
|
+
* Bump to RSpec 3 (#40)
|
11
|
+
|
11
12
|
## 0.3.4 / 2014-07-11
|
12
13
|
|
13
14
|
### Bug Fixes
|
data/lib/mercenary.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
|
4
|
-
require "mercenary/version"
|
1
|
+
require File.expand_path("../mercenary/version", __FILE__)
|
5
2
|
require "optparse"
|
6
3
|
require "logger"
|
7
4
|
|
8
5
|
module Mercenary
|
9
|
-
autoload :Command, "mercenary/command"
|
10
|
-
autoload :Option, "mercenary/option"
|
11
|
-
autoload :Presenter, "mercenary/presenter"
|
12
|
-
autoload :Program, "mercenary/program"
|
6
|
+
autoload :Command, File.expand_path("../mercenary/command", __FILE__)
|
7
|
+
autoload :Option, File.expand_path("../mercenary/option", __FILE__)
|
8
|
+
autoload :Presenter, File.expand_path("../mercenary/presenter", __FILE__)
|
9
|
+
autoload :Program, File.expand_path("../mercenary/program", __FILE__)
|
13
10
|
|
14
11
|
# Public: Instantiate a new program and execute.
|
15
12
|
#
|
data/lib/mercenary/program.rb
CHANGED
@@ -27,7 +27,14 @@ module Mercenary
|
|
27
27
|
cmd = super(argv, opts, @config)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
begin
|
31
|
+
@optparse.parse!(argv)
|
32
|
+
rescue OptionParser::InvalidOption => e
|
33
|
+
logger.error "Whoops, we can't understand your command."
|
34
|
+
logger.error "#{e.message}"
|
35
|
+
logger.error "Run your command again with the --help switch to see available options."
|
36
|
+
abort
|
37
|
+
end
|
31
38
|
|
32
39
|
logger.debug("Parsed config: #{@config.inspect}")
|
33
40
|
|
data/lib/mercenary/version.rb
CHANGED
data/mercenary.gemspec
CHANGED
data/spec/option_spec.rb
CHANGED
@@ -28,8 +28,8 @@ describe(Mercenary::Option) do
|
|
28
28
|
|
29
29
|
it "compares itself with other options well" do
|
30
30
|
new_option = described_class.new(config_key, ['-l', '--largo', description])
|
31
|
-
expect(option.eql?(new_option)).to
|
32
|
-
expect(option.hash.eql?(new_option.hash)).to
|
31
|
+
expect(option.eql?(new_option)).to be(true)
|
32
|
+
expect(option.hash.eql?(new_option.hash)).to be(true)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "has a custom #hash" do
|
@@ -72,7 +72,7 @@ describe(Mercenary::Option) do
|
|
72
72
|
let(:description) { nil }
|
73
73
|
|
74
74
|
it "knows there is no description" do
|
75
|
-
expect(option.description).to
|
75
|
+
expect(option.description).to be(nil)
|
76
76
|
end
|
77
77
|
|
78
78
|
it "knows both inputs are switches" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercenary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '3.0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '3.0'
|
56
56
|
description: Lightweight and flexible library for writing command-line apps in Ruby.
|
57
57
|
email:
|
58
58
|
- tom@mojombo.com
|