test_bench-run 2.1.2.4 → 2.1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 942112061007855a63dbdf4bab41ab7acc6333a855caa78ef9b3c04dc065ba5f
4
- data.tar.gz: d2feeca873eb87f6412ee4efbae351e0ab0b7ab92c89a5f43a92159e78e3b6fe
3
+ metadata.gz: 886ccd10a8206a1503cfb3f9018271e038461cee0c2d955fd1f1e696412bcec1
4
+ data.tar.gz: 9b28071beec6073be9ef19b25dc3cde98734894063800f5fe36b684cd9d8d5c7
5
5
  SHA512:
6
- metadata.gz: e22a39a9ced792e8ae30fdb69a76b4f30ffd05863f3103433a260a68196b8059b6559e01c592b2e15b99b149420699e4a2064dcb087cb674da7a233ef52975eb
7
- data.tar.gz: c0bfb7db3777e12483e48a8d48ea12549bd833df8a5abc266e827bd507e4e945db60590a65d641a1fabc99f0b054efa83efa62b3e13255baeec913cb0a46dc48
6
+ metadata.gz: 9cb9defc6577f8678b299048f9e036da741a829c517ba968651603fd86a6a7e61d0f6691e8283221eab079804b73411231d786efff8a9de7961ff37db15694be
7
+ data.tar.gz: 91a82e888e4c4d11ab39da54f6947db9dfbc79011e815ab29d7aa6c4eddc3db4095b04e94ab65a10a5e58c4ecdadde4d4e39ca023fdb0616312a2d6c0e402abd
@@ -9,10 +9,8 @@ module TestBench
9
9
  ::File.join(parent_directory, name)
10
10
  end
11
11
 
12
- def self.random(parent_directory: nil)
13
- name = Name.random
14
-
15
- example(name, parent_directory:)
12
+ def self.random
13
+ Random.example
16
14
  end
17
15
 
18
16
  def self.name
@@ -27,21 +25,39 @@ module TestBench
27
25
  File::Create.root_directory
28
26
  end
29
27
 
28
+ module Pattern
29
+ def self.example
30
+ 'some-directory*'
31
+ end
32
+ end
33
+
34
+ module Random
35
+ def self.example(basename: nil, parent_directory: nil)
36
+ name = Name::Random.example(basename)
37
+
38
+ Directory.example(name, parent_directory:)
39
+ end
40
+ end
41
+
30
42
  module Name
31
43
  def self.example
32
44
  "some-directory"
33
45
  end
34
46
 
35
- def self.random
36
- suffix = Random.string
47
+ module Random
48
+ def self.example(basename=nil)
49
+ basename ||= Name.example
50
+
51
+ suffix = Controls::Random.string
37
52
 
38
- "#{example}-#{suffix}"
53
+ "#{basename}-#{suffix}"
54
+ end
39
55
  end
40
56
  end
41
57
 
42
58
  module Create
43
- def self.call(parent_directory: nil)
44
- directory = Directory.random(parent_directory:)
59
+ def self.call(basename: nil, parent_directory: nil)
60
+ directory = Random.example(basename:, parent_directory:)
45
61
 
46
62
  ::Dir.mkdir(directory)
47
63
 
@@ -4,12 +4,16 @@ module TestBench
4
4
  module File
5
5
  module Pattern
6
6
  def self.example
7
- Any.example
7
+ File.example
8
8
  end
9
9
 
10
- module Any
10
+ def self.other_example
11
+ '*.rb'
12
+ end
13
+
14
+ module File
11
15
  def self.example
12
- '*'
16
+ 'some_file*.rb'
13
17
  end
14
18
  end
15
19
 
@@ -3,38 +3,38 @@ module TestBench
3
3
  class GetFiles
4
4
  FileError = Class.new(RuntimeError)
5
5
 
6
- def exclude_file_pattern
7
- @exclude_file_pattern ||= Defaults.exclude_file_pattern
6
+ attr_reader :exclude_patterns
7
+
8
+ def initialize(exclude_patterns)
9
+ @exclude_patterns = exclude_patterns
8
10
  end
9
- attr_writer :exclude_file_pattern
10
11
 
11
- def self.build(exclude_file_pattern: nil)
12
- instance = new
12
+ def self.build(exclude: nil)
13
+ exclude_patterns = exclude
14
+ exclude_patterns ||= Defaults.exclude_patterns
13
15
 
14
- if not exclude_file_pattern.nil?
15
- instance.exclude_file_pattern = exclude_file_pattern
16
+ if exclude_patterns.instance_of?(String)
17
+ exclude_patterns = exclude_patterns.split(',')
16
18
  end
17
19
 
18
- instance
20
+ new(exclude_patterns)
19
21
  end
20
22
 
21
- def self.call(path, *paths, exclude_file_pattern: nil, &block)
22
- instance = build(exclude_file_pattern:)
23
+ def self.call(path, *paths, exclude: nil, &block)
24
+ instance = build(exclude:)
23
25
  instance.(path, *paths, &block)
24
26
  end
25
27
 
26
- def self.configure(receiver, exclude_file_pattern: nil, attr_name: nil)
28
+ def self.configure(receiver, exclude: nil, attr_name: nil)
27
29
  attr_name ||= :get_files
28
30
 
29
- instance = build(exclude_file_pattern:)
31
+ instance = build(exclude:)
30
32
  receiver.public_send(:"#{attr_name}=", instance)
31
33
  end
32
34
 
33
35
  def call(path, *paths, &block)
34
36
  paths = [path, *paths]
35
37
 
36
- exclude_file_pattern = ::File.join('*/', self.exclude_file_pattern)
37
-
38
38
  paths.each do |path|
39
39
  if ::File.extname(path).empty?
40
40
  pattern = ::File.join(path, '**/*.rb')
@@ -45,7 +45,13 @@ module TestBench
45
45
  assure_extant(path)
46
46
 
47
47
  Dir.glob(pattern).each do |file|
48
- if ::File.fnmatch?(exclude_file_pattern, file, ::File::FNM_EXTGLOB)
48
+ excluded = exclude_patterns.any? do |exclude_pattern|
49
+ exclude_pattern = ::File.join('*', exclude_pattern)
50
+
51
+ ::File.fnmatch?(exclude_pattern, file, ::File::FNM_EXTGLOB)
52
+ end
53
+
54
+ if excluded
49
55
  next
50
56
  end
51
57
 
@@ -61,7 +67,7 @@ module TestBench
61
67
  end
62
68
 
63
69
  module Defaults
64
- def self.exclude_file_pattern
70
+ def self.exclude_patterns
65
71
  ENV.fetch('TEST_BENCH_EXCLUDE_FILE_PATTERN', '*_init.rb')
66
72
  end
67
73
  end
@@ -37,7 +37,7 @@ module TestBench
37
37
  def self.build(exclude: nil)
38
38
  instance = new
39
39
 
40
- GetFiles.configure(instance, exclude_file_pattern: exclude)
40
+ GetFiles.configure(instance, exclude:)
41
41
 
42
42
  Executor::Serial.configure(instance)
43
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_bench-run
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2.4
4
+ version: 2.1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ladd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-27 00:00:00.000000000 Z
11
+ date:
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test_bench-fixture
@@ -44,10 +44,12 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - lib/test_bench/run.rb
48
- - lib/test_bench/run/controls.rb
47
+ - lib/test_bench
48
+ - lib/test_bench/run
49
+ - lib/test_bench/run/controls
49
50
  - lib/test_bench/run/controls/directory.rb
50
51
  - lib/test_bench/run/controls/event_data.rb
52
+ - lib/test_bench/run/controls/events
51
53
  - lib/test_bench/run/controls/events/event_data.rb
52
54
  - lib/test_bench/run/controls/events/file_crashed.rb
53
55
  - lib/test_bench/run/controls/events/file_finished.rb
@@ -57,25 +59,32 @@ files:
57
59
  - lib/test_bench/run/controls/events/started.rb
58
60
  - lib/test_bench/run/controls/exception.rb
59
61
  - lib/test_bench/run/controls/executor.rb
60
- - lib/test_bench/run/controls/file.rb
62
+ - lib/test_bench/run/controls/file
61
63
  - lib/test_bench/run/controls/file/create.rb
62
64
  - lib/test_bench/run/controls/file/pattern.rb
65
+ - lib/test_bench/run/controls/file.rb
63
66
  - lib/test_bench/run/controls/path.rb
64
67
  - lib/test_bench/run/controls/process_id.rb
65
68
  - lib/test_bench/run/controls/random.rb
66
69
  - lib/test_bench/run/controls/result.rb
67
70
  - lib/test_bench/run/controls/time.rb
71
+ - lib/test_bench/run/controls.rb
68
72
  - lib/test_bench/run/events.rb
69
- - lib/test_bench/run/executor.rb
73
+ - lib/test_bench/run/executor
70
74
  - lib/test_bench/run/executor/serial.rb
71
75
  - lib/test_bench/run/executor/substitute.rb
76
+ - lib/test_bench/run/executor.rb
72
77
  - lib/test_bench/run/file.rb
73
- - lib/test_bench/run/get_files.rb
78
+ - lib/test_bench/run/get_files
74
79
  - lib/test_bench/run/get_files/substitute.rb
80
+ - lib/test_bench/run/get_files.rb
81
+ - lib/test_bench/run/output
75
82
  - lib/test_bench/run/output/file.rb
76
- - lib/test_bench/run/output/summary.rb
83
+ - lib/test_bench/run/output/summary
77
84
  - lib/test_bench/run/output/summary/error.rb
85
+ - lib/test_bench/run/output/summary.rb
78
86
  - lib/test_bench/run/run.rb
87
+ - lib/test_bench/run.rb
79
88
  homepage: https://github.com/test-bench/test-bench-run
80
89
  licenses:
81
90
  - MIT