probatio 1.1.1 → 1.2.0

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: 88b53a81c4bec331c6b85e24b65fc358b6ba97940a0bd143ff16949013d121a5
4
- data.tar.gz: 57a1cc597def53023f2802a1a493a035fcfda2ee25b8074a7f430fa4e73857b8
3
+ metadata.gz: 44efe96384518157bb668fc7ef2969240f04250ebeb861aa27f5a59e6bf9d368
4
+ data.tar.gz: abc011024ad1ae3518cf4882d450f8b38b86f40465ad7b8cec00d35fd23a8a76
5
5
  SHA512:
6
- metadata.gz: 51322b38ee2f79751edf9548aa952eee86d78adf8b474f7fecac986d0801a706f6572472abf2f3b6d37b855540359ab901653bed1112c2bd135bf910f576ecbb
7
- data.tar.gz: dcfc3956914f0511584021556aa031d2d73f52a9aacfff4ebcec9f3be6aa8860c73db8e9a6ab102d2212f657ed2c7b99ee3bf7b5850599feb50589395be02f4a
6
+ metadata.gz: 48349c94e1b191132d9285570e4f6f92642c9ce2014e3fc95a13f83d4281a734f48e95a52029b9de2d37eed8119db1f42c13f8b15a1ec3b58347fbd4c6da875d
7
+ data.tar.gz: b1a04070f74486d7201bdea7836b1bd66eae9c981c1bbd0bbcf4da9fc572015c0ef176783943fea9e397bfe3551ee93d1aeb13ec00e8d02f9a63c563544d56cb
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## proba 1.2.0 released 2025-05-19
6
+
7
+ * Introduce Probatio::Context#beep
8
+ * Introduce --beeps {n || 1}
9
+ * Allow for list.rb as 'list'
10
+
11
+
5
12
  ## proba 1.1.1 released 2025-05-08
6
13
 
7
14
  * Fix .probatio-output.rb string/number alignment
data/exe/proba CHANGED
@@ -8,14 +8,29 @@ require 'probatio'
8
8
 
9
9
  args = ARGV.dup
10
10
 
11
- def rework_switch(a)
12
-
13
- case a
14
- when '-n', '--name' then '--name'
15
- when '-e', '--exclude' then '--exclude'
16
- when '-s', '--seed' then '--seed'
17
- when '-d', '--debug' then '--debug'
18
- else nil
11
+ def rework_switch(switches, a, args)
12
+
13
+ arr, k, v =
14
+ case a
15
+ when '-n', '--name'
16
+ [ true, '--name', args.shift ]
17
+ when '-e', '--exclude'
18
+ [ true, '--exclude', args.shift ]
19
+ when '-s', '--seed'
20
+ [ true, '--seed', args.shift ]
21
+ when '-d', '--debug'
22
+ [ true, '--debug', args.shift ]
23
+ when '-b', '--beep', '--beeps'
24
+ [ false, '--beep', (args[0] || '').match?(/^\d+$/) ? args.shift.to_i : 1 ]
25
+ else
26
+ [ false, a, true ]
27
+ end
28
+
29
+ if arr == true
30
+ (switches[k] ||= []) << v
31
+ elsif arr == false
32
+ switches[k] = v
33
+ # else return
19
34
  end
20
35
  end
21
36
 
@@ -31,14 +46,10 @@ dirs, files, lists, strings, environments, integers = [], [], [], [], [], []
31
46
  while a = args.shift
32
47
 
33
48
  if a.match?(/^(-[a-z]|--[a-z0-9][-a-z0-9]+)$/i)
34
- if k = rework_switch(a)
35
- (switches[k] ||= []) << args.shift
36
- else
37
- switches[a] = true
38
- end
49
+ rework_switch(switches, a, args)
39
50
  elsif File.directory?(a) && a != '.'
40
51
  dirs << a
41
- elsif File.file?(a) && (a.match?(/(\.txt|_list\.rb)$/))
52
+ elsif File.file?(a) && (a == 'list.rb' || a.match?(/(\.txt|_list\.rb)$/))
42
53
  lists << a
43
54
  elsif File.file?(a.split(':').first)
44
55
  files << a
@@ -89,6 +100,7 @@ if switches['-h'] || switches['--help']
89
100
  -d, --debug smr 's' for start opts, 'm' for messages, 'r' for $DEBUG
90
101
  -x, --example Outputs an example test file
91
102
  -X, --plugin-example Outputs an example plugin file
103
+ -b, --beeps {n || 1} Beeps n time before exit
92
104
  --mangle Turns the given _spec.rb files into proba _test.rb
93
105
 
94
106
  Dirs:
@@ -168,6 +180,8 @@ opts[:print] = true if switches['-p'] || switches['--print']
168
180
  opts[:dirs] = dirs if dirs.any?
169
181
  opts[:files] = files.any? ? files : []
170
182
 
183
+ opts[:beeps] = switches['--beep']
184
+
171
185
  def read_list(a, item)
172
186
 
173
187
  case item
@@ -210,7 +224,7 @@ integers.each do |i|
210
224
  end
211
225
  lists.each do |li|
212
226
  opts[:files].concat(
213
- li.end_with?('_list.rb') ? read_list([], Kernel.eval(File.read(li))) :
227
+ li.end_with?('.rb') ? read_list([], Kernel.eval(File.read(li))) :
214
228
  read_list([], File.readlines(li)))
215
229
  end
216
230
  #
@@ -0,0 +1,22 @@
1
+
2
+ #
3
+ # probatio/helpers.rb
4
+
5
+ module Probatio::Helpers
6
+
7
+ def beep(count=1)
8
+
9
+ Probatio.beep(count || 0)
10
+ end
11
+ end
12
+
13
+ class Probatio::Section
14
+
15
+ include Probatio::Helpers
16
+ end
17
+
18
+ class Probatio::Context
19
+
20
+ include Probatio::Helpers
21
+ end
22
+
@@ -235,6 +235,29 @@ class Probatio::ProbaOutputter
235
235
  end
236
236
  end
237
237
 
238
+ module Probatio
239
+
240
+ # For easy override...
241
+ #
242
+ def self._beep
243
+
244
+ STDOUT.print("\a")
245
+ end
246
+
247
+ def self.beep(count=1)
248
+
249
+ count.times { Probatio._beep; sleep 0.5 }
250
+ end
251
+ end
252
+
253
+ class Probatio::Beeper
254
+
255
+ def on_exit(ev)
256
+
257
+ Probatio.beep(ev.opts[:beeps])
258
+ end
259
+ end
260
+
238
261
  class Probatio::Exitter
239
262
 
240
263
  def on_exit(ev)
@@ -249,5 +272,6 @@ Probatio.plug(Probatio::Chronometer.new)
249
272
  Probatio.plug(Probatio::DotReporter.new)
250
273
  Probatio.plug(Probatio::VanillaSummarizer.new)
251
274
  Probatio.plug(Probatio::ProbaOutputter.new)
275
+ Probatio.plug(Probatio::Beeper.new)
252
276
  Probatio.plug(Probatio::Exitter.new)
253
277
 
data/lib/probatio.rb CHANGED
@@ -15,7 +15,7 @@ require 'probatio/more'
15
15
 
16
16
  module Probatio
17
17
 
18
- VERSION = '1.1.1'
18
+ VERSION = '1.2.0'
19
19
 
20
20
  class << self
21
21
 
@@ -752,6 +752,10 @@ module Probatio
752
752
  require 'probatio/waiters'
753
753
  #
754
754
  # where wait_* methods are defined...
755
+
756
+ require 'probatio/helpers'
757
+ #
758
+ # where beep and friends are defined...
755
759
  end
756
760
 
757
761
  class AssertionError < StandardError
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: probatio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-08 00:00:00.000000000 Z
11
+ date: 2025-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorato
@@ -42,6 +42,7 @@ files:
42
42
  - lib/probatio/debug.rb
43
43
  - lib/probatio/examples/a_plugin.rb
44
44
  - lib/probatio/examples/a_test.rb
45
+ - lib/probatio/helpers.rb
45
46
  - lib/probatio/mangle.rb
46
47
  - lib/probatio/more.rb
47
48
  - lib/probatio/plug.rb
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0'
75
76
  requirements: []
76
- rubygems_version: 3.5.16
77
+ rubygems_version: 3.5.22
77
78
  signing_key:
78
79
  specification_version: 4
79
80
  summary: test tools for floraison and flor