judges 0.0.21 → 0.0.23

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 428132cb0468f9c9e0fb7c3a51628cfb4f8b07a0ff26493cd476f10a8461ca02
4
- data.tar.gz: 158206dab846c53314f29ed607e5789ede80e2b18c778dca09bd65ce67adaf93
3
+ metadata.gz: 15c96f4af35d626de3ae2f9de6d510550b2307a014b0a76148219f8a04091907
4
+ data.tar.gz: 19e2b425671a4a711b1c0ebf62b1ad17c25d13c355aeef050a48c030b22a47a0
5
5
  SHA512:
6
- metadata.gz: c594b09ee2a9ea407344adf6e0a89f5e32f6ae2c4294810f89ac617dd9878cf3cee336ac2b3db934bfff1db68bf9b6a277d6a1b2d3afcf720fc34b58a12f73ab
7
- data.tar.gz: 298affb7b7f6882a98a52117bc7fb5270e6ed71616505891d4b71080e53131b55236fe54de2a465a91a302d4ef2b70f361630bc4536a46c1a5190d9e9442fca6
6
+ metadata.gz: fe53d0e31dcd30a125d8130fbb46ed1f13709a13f642c8e19db9ae74ef4aeb1485ea374ede9f1abe1f0f1308331fc98f507c532a97803a75b96c8fbf4a6f79b3
7
+ data.tar.gz: 36a8369665200eb177572803b555c4948ccfe1f96cc2ed695c9c104bcb8cf89ca11204224ddf2549ad5fa5f7ff7082069edd87e1aa94ac1acca7be22df54f1a7
data/bin/judges CHANGED
@@ -29,91 +29,95 @@ require 'factbase'
29
29
  Encoding.default_external = Encoding::UTF_8
30
30
  Encoding.default_internal = Encoding::UTF_8
31
31
 
32
- ver = '0.0.21'
32
+ class App
33
+ extend GLI::App
33
34
 
34
- include GLI::App
35
+ ver = '0.0.23'
35
36
 
36
- loog = Loog::REGULAR
37
+ loog = Loog::REGULAR
37
38
 
38
- program_desc('Automated executor of judges for a factbase')
39
+ program_desc('Automated executor of judges for a factbase')
39
40
 
40
- version(ver)
41
+ version(ver)
41
42
 
42
- synopsis_format(:full)
43
+ synopsis_format(:full)
43
44
 
44
- subcommand_option_handling(:normal)
45
+ subcommand_option_handling(:normal)
45
46
 
46
- desc 'Make it more verbose, logging as much as possible'
47
- switch([:v, :verbose])
47
+ desc 'Make it more verbose, logging as much as possible'
48
+ switch([:v, :verbose])
48
49
 
49
- pre do |global, command, options, args|
50
- if global[:verbose]
51
- loog = Loog::VERBOSE
50
+ pre do |global, command, options, args|
51
+ if global[:verbose]
52
+ loog = Loog::VERBOSE
53
+ end
54
+ loog.debug("judges #{ver}")
55
+ true
52
56
  end
53
- loog.debug("judges #{ver}")
54
- true
55
- end
56
57
 
57
- desc 'Update the factbase by passing all judges one by one'
58
- command :update do |c|
59
- c.desc 'Options to pass to every judge'
60
- c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
61
- c.desc 'Maximum number of update cycles to run'
62
- c.flag([:'max-cycles'], default_value: 8, type: Integer)
63
- c.action do |global, options, args|
64
- require_relative '../lib/judges/commands/update'
65
- Judges::Update.new(loog).run(options, args)
58
+ desc 'Update the factbase by passing all judges one by one'
59
+ command :update do |c|
60
+ c.desc 'Options to pass to every judge'
61
+ c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
62
+ c.desc 'Maximum number of update cycles to run'
63
+ c.flag([:'max-cycles'], default_value: 8, type: Integer)
64
+ c.desc 'Stay quiet even if some judges fail'
65
+ c.switch([:q, :quiet], default_value: false)
66
+ c.action do |global, options, args|
67
+ require_relative '../lib/judges/commands/update'
68
+ Judges::Update.new(loog).run(options, args)
69
+ end
66
70
  end
67
- end
68
71
 
69
- desc 'Join two factbases'
70
- command :print do |c|
71
- c.action do |global, options, args|
72
- require_relative '../lib/judges/commands/join'
73
- Judges::Join.new(loog).run(options, args)
72
+ desc 'Join two factbases'
73
+ command :print do |c|
74
+ c.action do |global, options, args|
75
+ require_relative '../lib/judges/commands/join'
76
+ Judges::Join.new(loog).run(options, args)
77
+ end
74
78
  end
75
- end
76
79
 
77
- desc 'Remove the facts that are too old'
78
- command :trim do |c|
79
- c.desc 'Remove facts that are older than X days'
80
- c.flag([:days], type: Integer, default_value: 90)
81
- c.action do |global, options, args|
82
- require_relative '../lib/judges/commands/trim'
83
- Judges::Trim.new(loog).run(options, args)
80
+ desc 'Remove the facts that are too old'
81
+ command :trim do |c|
82
+ c.desc 'Remove facts that are older than X days'
83
+ c.flag([:days], type: Integer, default_value: 90)
84
+ c.action do |global, options, args|
85
+ require_relative '../lib/judges/commands/trim'
86
+ Judges::Trim.new(loog).run(options, args)
87
+ end
84
88
  end
85
- end
86
89
 
87
- desc 'Print the factbase into a human-readable format (YAML, JSON, etc.)'
88
- command :print do |c|
89
- c.desc 'Output format (xml, json, or yaml)'
90
- c.flag([:format], default_value: 'yaml')
91
- c.desc 'Generate output name of the file automatically'
92
- c.switch([:auto], default_value: false)
93
- c.action do |global, options, args|
94
- require_relative '../lib/judges/commands/print'
95
- Judges::Print.new(loog).run(options, args)
90
+ desc 'Print the factbase into a human-readable format (YAML, JSON, etc.)'
91
+ command :print do |c|
92
+ c.desc 'Output format (xml, json, or yaml)'
93
+ c.flag([:format], default_value: 'yaml')
94
+ c.desc 'Generate output name of the file automatically'
95
+ c.switch([:auto], default_value: false)
96
+ c.action do |global, options, args|
97
+ require_relative '../lib/judges/commands/print'
98
+ Judges::Print.new(loog).run(options, args)
99
+ end
96
100
  end
97
- end
98
101
 
99
- desc 'Inspect the factbase and print all its possible meta-data'
100
- command :inspect do |c|
101
- c.action do |global, options, args|
102
- require_relative '../lib/judges/commands/inspect'
103
- Judges::Inspect.new(loog).run(options, args)
102
+ desc 'Inspect the factbase and print all its possible meta-data'
103
+ command :inspect do |c|
104
+ c.action do |global, options, args|
105
+ require_relative '../lib/judges/commands/inspect'
106
+ Judges::Inspect.new(loog).run(options, args)
107
+ end
104
108
  end
105
- end
106
109
 
107
- desc 'Run automated tests for all judges'
108
- command :test do |c|
109
- c.desc 'Name of the test pack to run'
110
- c.flag([:pack], multiple: true)
111
- c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
112
- c.switch([:quiet], default_value: false)
113
- c.action do |global, options, args|
114
- require_relative '../lib/judges/commands/test'
115
- Judges::Test.new(loog).run(options, args)
110
+ desc 'Run automated tests for all judges'
111
+ command :test do |c|
112
+ c.desc 'Name of the test pack to run'
113
+ c.flag([:pack], multiple: true)
114
+ c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
115
+ c.switch([:quiet], default_value: false)
116
+ c.action do |global, options, args|
117
+ require_relative '../lib/judges/commands/test'
118
+ Judges::Test.new(loog).run(options, args)
119
+ end
116
120
  end
117
121
  end
118
122
 
119
- exit run(ARGV)
123
+ exit App.run(ARGV)
data/features/cli.feature CHANGED
@@ -17,10 +17,10 @@ Feature: Simple Run
17
17
  n = $fb.insert
18
18
  n.kind = 'yes!'
19
19
  """
20
- Then I run bin/judges with "--verbose update -o foo=1 -o bar=2 --max-cycles 3 . simple.fb"
20
+ Then I run bin/judges with "--verbose update --quiet -o foo=1 -o bar=2 --max-cycles 3 . simple.fb"
21
21
  Then Stdout contains "foo → "
22
22
  Then Stdout contains "bar → "
23
- Then Stdout contains "1 judges processed"
23
+ Then Stdout contains "1 judge(s) processed"
24
24
  Then Stdout contains "Update finished in 3 cycles"
25
25
  And Exit code is zero
26
26
 
data/judges.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
27
  s.required_ruby_version = '>=3.2'
28
28
  s.name = 'judges'
29
- s.version = '0.0.21'
29
+ s.version = '0.0.23'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description = '
@@ -67,7 +67,7 @@ class Judges::Update
67
67
  errors = []
68
68
  diff = 0
69
69
  done = packs.each_with_index do |p, i|
70
- @loog.info("👍 Running #{p.name} (##{i}) at #{p.dir.to_rel}...")
70
+ @loog.info("👉 Running #{p.name} (##{i}) at #{p.dir.to_rel}...")
71
71
  before = fb.size
72
72
  begin
73
73
  p.run(fb, options)
@@ -76,11 +76,15 @@ class Judges::Update
76
76
  errors << p.script
77
77
  end
78
78
  after = fb.size
79
- @loog.info("Pack #{p.dir.to_rel} added #{after - before} facts") if after > before
79
+ @loog.info("👍 Pack #{p.dir.to_rel} added #{after - before} facts") if after > before
80
80
  diff += after - before
81
81
  end
82
- @loog.info("#{done} judges processed (#{errors.size} errors)")
83
- raise "Failed to update correctly (#{errors.size} errors)" unless errors.empty?
82
+ if errors.empty?
83
+ @loog.info("👍 #{done} judge(s) processed")
84
+ else
85
+ @loog.info("❌ #{done} judge(s) processed with #{errors.size} errors")
86
+ raise "Failed to update correctly (#{errors.size} errors)" unless opts['quiet']
87
+ end
84
88
  impex.export(fb)
85
89
  diff
86
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko