test_launcher 2.30.0 → 2.32.0

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: 813cdd417bccd3e420f36f70491d01959deacdc0f59532c7abdb5e62f12085eb
4
- data.tar.gz: 070fbb6294755946f6d9bb937d8904813c907497cc8c1ed11dca3baad853872d
3
+ metadata.gz: 962715015549cff34705018a6d3057c3dabfb155338ba0b7019123b139802b84
4
+ data.tar.gz: 791b6423710d2657db1bd0139a563a7169493f1fa963a4bef8b2143be2cb15cf
5
5
  SHA512:
6
- metadata.gz: e352b3353ca3fccd58c6d89f43ed363db9cfbe44ad5c5e5994da5e8b7c05869309b7f085dcb1e352bb3eaae39d65651fd0e3a629a0f9ab94e8922507ebb1626b
7
- data.tar.gz: 221069f9132f0939442cc529ace808999db17f3edf7dc159ad94e2183d884894a7389138e5f8e096a4fef393071241b956267e3f32bb24bf0828ef2fc46271f2
6
+ metadata.gz: 9fd4c0f4a323b412c686e06ad780f439a689c39bb0e7a78d03b8cf2c389a5b3357b50a328ca52bc2d25144e8c0006f882ce785189d42f74050c722e552018f86
7
+ data.tar.gz: bdf2d402d78cda8f4b9e3f40f26662c7fb530416c9be2b1d240c33251766efef1d4c2f847ac1de30c90548cbecf87490e1f27c96857bc3ed4d064d8dfbe00a72
@@ -67,7 +67,7 @@ VERSION: #{TestLauncher::VERSION}
67
67
  Frameworks::ExUnit,
68
68
  Frameworks::Mochajs,
69
69
  Frameworks::Generic,
70
- ].select {|f| f.active?}
70
+ ].select {|f| f.active?(searcher) }
71
71
  end
72
72
 
73
73
  Options.new(
@@ -4,9 +4,8 @@ require "test_launcher/base_error"
4
4
  module TestLauncher
5
5
  module Frameworks
6
6
  module ExUnit
7
- def self.active?
8
- # Do not do this outside of the shell.
9
- `git ls-files '*.exs'`.split("\n").any?
7
+ def self.active?(searcher)
8
+ searcher.ls_files("*.exs").any?
10
9
  end
11
10
 
12
11
  def self.test_case(*a, **o)
@@ -6,7 +6,7 @@ module TestLauncher
6
6
  NotSupportedError = Class.new(BaseError)
7
7
 
8
8
  module Generic
9
- def self.active?
9
+ def self.active?(...)
10
10
  true
11
11
  end
12
12
 
@@ -5,9 +5,8 @@ require "test_launcher/base_error"
5
5
  module TestLauncher
6
6
  module Frameworks
7
7
  module Minitest
8
- def self.active?
9
- # Do not do this outside of the shell.
10
- `git ls-files '*_test.rb'`.split("\n").any?
8
+ def self.active?(searcher)
9
+ searcher.ls_files("*_test.rb").any?
11
10
  end
12
11
 
13
12
  def self.test_case(*a, **o)
@@ -5,8 +5,10 @@ module TestLauncher
5
5
  module Frameworks
6
6
  module Mochajs
7
7
 
8
- def self.active?
9
- `git ls-files '*pec.js'`.split("\n").any?
8
+ def self.active?(searcher)
9
+ # just disable this cause it doesn't really work and it might
10
+ # help speed things up.
11
+ false
10
12
  end
11
13
 
12
14
  def self.test_case(*a, **o)
@@ -5,8 +5,8 @@ module TestLauncher
5
5
  module Frameworks
6
6
  module RSpec
7
7
 
8
- def self.active?
9
- `git ls-files '*_spec.rb'`.split("\n").any?
8
+ def self.active?(searcher)
9
+ searcher.ls_files("*_spec.rb").any?
10
10
  end
11
11
 
12
12
  def self.test_case(*a, **o)
@@ -1,4 +1,5 @@
1
1
  require "test_launcher/base_error"
2
+ require "shellwords"
2
3
 
3
4
  module TestLauncher
4
5
  module Search
@@ -16,15 +17,11 @@ module TestLauncher
16
17
  end
17
18
 
18
19
  def grep(regex, file_pattern)
19
- shell.run("ag '#{regex}' --file-search-regex '#{pattern_to_regex(file_pattern)}'")
20
+ shell.run("ag #{Shellwords.escape(regex)} --file-search-regex '#{pattern_to_regex(file_pattern)}'")
20
21
  end
21
22
 
22
23
  def root_path
23
- shell.run("git rev-parse --show-toplevel").first.tap do
24
- if $? != 0
25
- raise NotInRepoError, "test_launcher must be used in a git repository"
26
- end
27
- end
24
+ @result ||= (ENV['TEST_LAUNCHER__DIR'] || Dir.pwd)
28
25
  end
29
26
 
30
27
  def pattern_to_regex(pattern)
@@ -45,6 +45,10 @@ module TestLauncher
45
45
  Dir.chdir(root_path) # MOVE ME!
46
46
  end
47
47
 
48
+ def ls_files(pattern)
49
+ interface.ls_files(pattern)
50
+ end
51
+
48
52
  def find_files(pattern)
49
53
  relative_pattern = strip_system_path(pattern)
50
54
 
@@ -4,15 +4,11 @@ require 'test_launcher/search/git'
4
4
  module TestLauncher
5
5
  module Search
6
6
  def self.searcher(shell)
7
- # `which ag`
8
- # implementation =
9
- # if $?.success?
10
- # Search::Ag
11
- # else
12
- # Search::Git
13
- # end
14
-
15
- Search::Git.new(shell)
7
+ if ENV.key?('TEST_LAUNCHER__AG')
8
+ Search::Ag.new(shell)
9
+ else
10
+ Search::Git.new(shell)
11
+ end
16
12
  end
17
13
  end
18
14
  end
@@ -55,6 +55,10 @@ module TestLauncher
55
55
  %x{echo #{Shellwords.escape(msg)} >> #{log_path}}
56
56
  end
57
57
 
58
+ def shell_out!(...)
59
+ shell_out(...)
60
+ end
61
+
58
62
  def shell_out(command)
59
63
  logged_cmd = "set -o pipefail && #{command} 2>> #{log_path} | tee -a #{log_path}"
60
64
  %x{bash -c #{Shellwords.escape(logged_cmd)}}.chomp
@@ -1,3 +1,3 @@
1
1
  module TestLauncher
2
- VERSION = "2.30.0"
2
+ VERSION = "2.32.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.30.0
4
+ version: 2.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-10 00:00:00.000000000 Z
11
+ date: 2023-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.3.22
96
+ rubygems_version: 3.4.6
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Easily run tests