cri 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS.md +5 -1
- data/lib/cri.rb +1 -1
- data/lib/cri/command.rb +3 -2
- data/test/test_command.rb +8 -0
- metadata +3 -16
data/NEWS.md
CHANGED
data/lib/cri.rb
CHANGED
data/lib/cri/command.rb
CHANGED
@@ -88,10 +88,11 @@ module Cri
|
|
88
88
|
# @param [String, nil] The string containing the command’s definition
|
89
89
|
#
|
90
90
|
# @return [Cri::Command] The newly defined command
|
91
|
-
def self.define(string=nil, &block)
|
91
|
+
def self.define(string=nil, filename=nil, &block)
|
92
92
|
dsl = Cri::CommandDSL.new
|
93
93
|
if string
|
94
|
-
|
94
|
+
args = filename ? [ string, filename ] : [ string ]
|
95
|
+
dsl.instance_eval(*args)
|
95
96
|
elsif [ -1, 0 ].include? block.arity
|
96
97
|
dsl.instance_eval(&block)
|
97
98
|
else
|
data/test/test_command.rb
CHANGED
@@ -295,4 +295,12 @@ class Cri::CommandTestCase < Cri::TestCase
|
|
295
295
|
assert_equal 'baresub', cmd.subcommands.to_a[0].name
|
296
296
|
end
|
297
297
|
|
298
|
+
def test_backtrace_includes_filename
|
299
|
+
error = assert_raises RuntimeError do
|
300
|
+
Cri::Command.define('raise "boom"', 'mycommand.rb')
|
301
|
+
end
|
302
|
+
|
303
|
+
assert_match /mycommand.rb/, error.backtrace.join("\n")
|
304
|
+
end
|
305
|
+
|
298
306
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 13
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 2.0.1
|
5
|
+
version: 2.0.2
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Denis Defreyne
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-07-
|
19
|
-
default_executable:
|
13
|
+
date: 2011-07-17 00:00:00 Z
|
20
14
|
dependencies: []
|
21
15
|
|
22
16
|
description: Cri allows building easy-to-use commandline interfaces with support for subcommands.
|
@@ -53,7 +47,6 @@ files:
|
|
53
47
|
- test/test_option_parser.rb
|
54
48
|
- cri.gemspec
|
55
49
|
- .gemtest
|
56
|
-
has_rdoc: true
|
57
50
|
homepage: http://stoneship.org/software/cri/
|
58
51
|
licenses: []
|
59
52
|
|
@@ -68,23 +61,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
61
|
requirements:
|
69
62
|
- - ">="
|
70
63
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
|
-
- 0
|
74
64
|
version: "0"
|
75
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
66
|
none: false
|
77
67
|
requirements:
|
78
68
|
- - ">="
|
79
69
|
- !ruby/object:Gem::Version
|
80
|
-
hash: 3
|
81
|
-
segments:
|
82
|
-
- 0
|
83
70
|
version: "0"
|
84
71
|
requirements: []
|
85
72
|
|
86
73
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.8.5
|
88
75
|
signing_key:
|
89
76
|
specification_version: 3
|
90
77
|
summary: a library for building easy-to-use commandline tools
|