check_please 0.2.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Gemfile.lock +1 -1
- data/README.md +318 -47
- data/Rakefile +46 -3
- data/bin/gh-md-toc +350 -0
- data/{bin → exe}/check_please +1 -1
- data/lib/check_please.rb +116 -14
- data/lib/check_please/cli.rb +4 -37
- data/lib/check_please/cli/parser.rb +24 -19
- data/lib/check_please/cli/runner.rb +3 -3
- data/lib/check_please/comparison.rb +108 -38
- data/lib/check_please/diff.rb +5 -13
- data/lib/check_please/diffs.rb +13 -8
- data/lib/check_please/error.rb +24 -0
- data/lib/check_please/flag.rb +88 -0
- data/lib/check_please/flags.rb +46 -0
- data/lib/check_please/path.rb +151 -6
- data/lib/check_please/path_segment.rb +88 -0
- data/lib/check_please/printers.rb +8 -7
- data/lib/check_please/printers/table_print.rb +12 -4
- data/lib/check_please/refinements.rb +16 -0
- data/lib/check_please/reification.rb +50 -0
- data/lib/check_please/version.rb +1 -1
- data/usage_examples.rb +24 -2
- metadata +11 -5
- data/lib/check_please/cli/flag.rb +0 -40
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_please
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Livingston-Gray
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: table_print
|
@@ -56,7 +56,8 @@ description: Check for differences between two JSON strings (or Ruby data struct
|
|
56
56
|
parsed from them)
|
57
57
|
email:
|
58
58
|
- geeksam@gmail.com
|
59
|
-
executables:
|
59
|
+
executables:
|
60
|
+
- check_please
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -69,24 +70,29 @@ files:
|
|
69
70
|
- LICENSE.txt
|
70
71
|
- README.md
|
71
72
|
- Rakefile
|
72
|
-
- bin/check_please
|
73
73
|
- bin/console
|
74
|
+
- bin/gh-md-toc
|
74
75
|
- bin/setup
|
75
76
|
- check_please.gemspec
|
77
|
+
- exe/check_please
|
76
78
|
- lib/check_please.rb
|
77
79
|
- lib/check_please/cli.rb
|
78
|
-
- lib/check_please/cli/flag.rb
|
79
80
|
- lib/check_please/cli/parser.rb
|
80
81
|
- lib/check_please/cli/runner.rb
|
81
82
|
- lib/check_please/comparison.rb
|
82
83
|
- lib/check_please/diff.rb
|
83
84
|
- lib/check_please/diffs.rb
|
84
85
|
- lib/check_please/error.rb
|
86
|
+
- lib/check_please/flag.rb
|
87
|
+
- lib/check_please/flags.rb
|
85
88
|
- lib/check_please/path.rb
|
89
|
+
- lib/check_please/path_segment.rb
|
86
90
|
- lib/check_please/printers.rb
|
87
91
|
- lib/check_please/printers/base.rb
|
88
92
|
- lib/check_please/printers/json.rb
|
89
93
|
- lib/check_please/printers/table_print.rb
|
94
|
+
- lib/check_please/refinements.rb
|
95
|
+
- lib/check_please/reification.rb
|
90
96
|
- lib/check_please/version.rb
|
91
97
|
- usage_examples.rb
|
92
98
|
homepage: https://github.com/RealGeeks/check_please
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module CheckPlease
|
2
|
-
module CLI
|
3
|
-
|
4
|
-
class Flag
|
5
|
-
ATTR_NAMES = %i[ short long desc key block ]
|
6
|
-
attr_accessor(*ATTR_NAMES)
|
7
|
-
|
8
|
-
def initialize(*args)
|
9
|
-
self.short = args.shift if args.any?
|
10
|
-
self.long = args.shift if args.any?
|
11
|
-
|
12
|
-
yield self if block_given?
|
13
|
-
|
14
|
-
missing = ATTR_NAMES.select { |e| self.send(e).nil? }
|
15
|
-
missing -= %i[ short ] # short is optional!
|
16
|
-
if missing.any?
|
17
|
-
raise ArgumentError, "Missing attributes: #{missing.join(', ')}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def visit_option_parser(parser, options)
|
22
|
-
parser.on(short, long, desc) do |value|
|
23
|
-
block.call options, value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def set_key(key, message = nil, &b)
|
28
|
-
raise ArgumentError if message && b
|
29
|
-
raise ArgumentError if !message && !b
|
30
|
-
|
31
|
-
self.key = key
|
32
|
-
self.block = ->(options, value) {
|
33
|
-
b ||= message.to_sym.to_proc
|
34
|
-
options[key] = b.call(value)
|
35
|
-
}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|