baf 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/baf.rb +1 -1
- data/lib/baf/cli.rb +11 -8
- data/lib/baf/env.rb +3 -3
- data/lib/baf/option.rb +8 -8
- data/lib/baf/testing/cucumber/steps/output_wait.rb +1 -1
- data/lib/baf/version.rb +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9311e4cba4d27aee336f9983d97efd78d8296b5672ec1dccc3337056b66ba620
|
4
|
+
data.tar.gz: a9ba3e9ab48e78e71173faaa63eece4addadcc9573e28ea6d3b19adbe6fc41c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aeeb1da2a0f359a5a537580ab13384b3cba5501a6c00722c0f025760eb4c31c951ddf0616410138520bd2457972386dd1bf9bd976259aa271d6365187a0d6e7
|
7
|
+
data.tar.gz: 74267eaf156de24338b988e46960565cb1eefc6dc5b241ccb1dba4db022ed6bd313f5932d944833ab010f858b314daeb3145318e01a8a6b52925e730f753f1af
|
data/lib/baf.rb
CHANGED
data/lib/baf/cli.rb
CHANGED
@@ -10,7 +10,7 @@ module Baf
|
|
10
10
|
class CLI
|
11
11
|
ArgumentError = Class.new ::Baf::ArgumentError
|
12
12
|
|
13
|
-
EX_USAGE
|
13
|
+
EX_USAGE = 64
|
14
14
|
EX_SOFTWARE = 70
|
15
15
|
|
16
16
|
class << self
|
@@ -43,15 +43,17 @@ module Baf
|
|
43
43
|
parent = Object.const_get parent_name
|
44
44
|
parent.const_defined?(:Env) ? parent.const_get(:Env) : Env
|
45
45
|
end
|
46
|
+
|
47
|
+
def ruby2_keywords *; end unless Module.respond_to? :ruby2_keywords, true
|
46
48
|
end
|
47
49
|
|
48
50
|
attr_reader :arguments, :env, :parser
|
49
51
|
|
50
52
|
def initialize env, arguments, **opts
|
51
|
-
@env
|
52
|
-
@arguments
|
53
|
-
@parser
|
54
|
-
@registrant = opts
|
53
|
+
@env = env
|
54
|
+
@arguments = arguments
|
55
|
+
@parser = opts.fetch(:parser) { OptionParser.new }
|
56
|
+
@registrant = opts.fetch(:registrant) { OptionsRegistrant.new }
|
55
57
|
|
56
58
|
registrant.register(env, parser) { setup }
|
57
59
|
end
|
@@ -63,6 +65,7 @@ module Baf
|
|
63
65
|
registrant.banner = arg
|
64
66
|
end
|
65
67
|
|
68
|
+
ruby2_keywords \
|
66
69
|
def flag *args
|
67
70
|
registrant.flag *args
|
68
71
|
end
|
@@ -80,15 +83,15 @@ module Baf
|
|
80
83
|
tail: true
|
81
84
|
end
|
82
85
|
|
83
|
-
def option *args
|
84
|
-
args = [*args,
|
86
|
+
def option *args, &block
|
87
|
+
args = [*args, block] if block_given?
|
85
88
|
registrant.option *args
|
86
89
|
end
|
87
90
|
|
88
91
|
def parse_arguments!
|
89
92
|
parser.parse! arguments
|
90
93
|
rescue OptionParser::InvalidOption
|
91
|
-
|
94
|
+
fail ArgumentError, parser
|
92
95
|
end
|
93
96
|
|
94
97
|
def usage!
|
data/lib/baf/env.rb
CHANGED
@@ -7,9 +7,9 @@ module Baf
|
|
7
7
|
def_delegators :@output, :print, :puts
|
8
8
|
def_delegator :@output_error, :puts, :puts_error
|
9
9
|
|
10
|
-
def initialize input: $
|
11
|
-
@input
|
12
|
-
@output
|
10
|
+
def initialize input: $stdin, output: $stdout, output_error: $stderr
|
11
|
+
@input = input
|
12
|
+
@output = output
|
13
13
|
@output_error = output_error
|
14
14
|
end
|
15
15
|
|
data/lib/baf/option.rb
CHANGED
@@ -41,20 +41,20 @@ module Baf
|
|
41
41
|
|
42
42
|
def build_attrs short, long, arg_or_desc = nil, desc_or_block = nil, block = nil
|
43
43
|
{
|
44
|
-
short:
|
45
|
-
long:
|
46
|
-
desc:
|
44
|
+
short: short,
|
45
|
+
long: long,
|
46
|
+
desc: arg_or_desc
|
47
47
|
}.merge case desc_or_block
|
48
48
|
when Proc
|
49
49
|
{
|
50
|
-
desc:
|
51
|
-
block:
|
50
|
+
desc: arg_or_desc,
|
51
|
+
block: desc_or_block
|
52
52
|
}
|
53
53
|
when String
|
54
54
|
{
|
55
|
-
arg:
|
56
|
-
desc:
|
57
|
-
block:
|
55
|
+
arg: arg_or_desc,
|
56
|
+
desc: desc_or_block,
|
57
|
+
block: block
|
58
58
|
}
|
59
59
|
else
|
60
60
|
{}
|
data/lib/baf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: baf-testing
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
description: Basic Application Framework
|
42
42
|
email: tj@a13.fr
|
43
43
|
executables: []
|
@@ -60,7 +60,7 @@ homepage: https://rubygems.org/gems/baf
|
|
60
60
|
licenses:
|
61
61
|
- BSD-3-Clause
|
62
62
|
metadata: {}
|
63
|
-
post_install_message:
|
63
|
+
post_install_message:
|
64
64
|
rdoc_options: []
|
65
65
|
require_paths:
|
66
66
|
- lib
|
@@ -75,9 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
|
79
|
-
|
80
|
-
signing_key:
|
78
|
+
rubygems_version: 3.1.4
|
79
|
+
signing_key:
|
81
80
|
specification_version: 4
|
82
81
|
summary: Basic Application Framework
|
83
82
|
test_files: []
|