test_launcher 2.28.0 → 2.30.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: d701813c0d24be54c1c0f223458a92aeeabde95cb3e16f5566e109c974c65d9b
4
- data.tar.gz: 23d5de708bc2c0149a84717b3f7aa32bc21337de5caf43d2eb58247e0953bbd6
3
+ metadata.gz: 813cdd417bccd3e420f36f70491d01959deacdc0f59532c7abdb5e62f12085eb
4
+ data.tar.gz: 070fbb6294755946f6d9bb937d8904813c907497cc8c1ed11dca3baad853872d
5
5
  SHA512:
6
- metadata.gz: b0d5ffa22d663d1cef852209b0be15e4c56d449723d1a70d9728b6156116cac589dbacae882eb149c867f053357d8b238f29e0a79be3f2abffa125d81f2f3ef8
7
- data.tar.gz: cf11dce1e04306f1e9e81f9378450ea6956df294136dcb8b7b948da142c986feb7044559e51101b5e04b24913adaef4f1ae203fde9a913a57a18ae45963eed4a
6
+ metadata.gz: e352b3353ca3fccd58c6d89f43ed363db9cfbe44ad5c5e5994da5e8b7c05869309b7f085dcb1e352bb3eaae39d65651fd0e3a629a0f9ab94e8922507ebb1626b
7
+ data.tar.gz: 221069f9132f0939442cc529ace808999db17f3edf7dc159ad94e2183d884894a7389138e5f8e096a4fef393071241b956267e3f32bb24bf0828ef2fc46271f2
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module TestLauncher
2
4
  module Frameworks
3
5
  module Implementation
@@ -28,21 +30,20 @@ module TestLauncher
28
30
  end
29
31
 
30
32
  def app_root
31
- if exploded_path.select { |dir| dir == test_root_dir_name }.size > 1
32
- candidates = exploded_path
33
-
34
- while !candidates.empty?
35
- if candidates.last == test_root_dir_name
36
- root_path = File.join("/", candidates[0..-2])
37
- return root_path if Dir.entries(root_path).any? {|e| e.match /Gemfile|gemspec|mix.exs|config.ru/} # TODO: extract this
38
- end
39
-
40
- candidates.pop
33
+ test_dir_parent = nil
34
+
35
+ Pathname.new(file).parent.ascend do |path|
36
+ if test_dir_parent.nil? && path.basename.to_s == test_root_dir_name
37
+ test_dir_parent = path.parent.to_s
38
+ next
39
+ elsif test_dir_parent.nil?
40
+ next
41
+ elsif path.entries.any? { |e| e.to_s.match /Gemfile|gemspec|mix.exs|config.ru/ }
42
+ return path.to_s
41
43
  end
42
44
  end
43
45
 
44
- path = exploded_path[0...exploded_path.index(test_root_dir_name)]
45
- File.join("/", path)
46
+ test_dir_parent || Pathname.new(file).parent.to_s
46
47
  end
47
48
 
48
49
  def test_root
@@ -14,7 +14,15 @@ module TestLauncher
14
14
  end
15
15
 
16
16
  def ls_files(pattern)
17
- shell.run("git ls-files '*#{pattern}*'")
17
+ # files in the repo and unstaged files in the status
18
+ shell.run("git ls-files '*#{pattern}*'") +
19
+ shell
20
+ .run("git status --porcelain=v2")
21
+ .map { |l|
22
+ type, path = l.split(" ")
23
+ path if type == "?" && path.match(%r{.*#{pattern}.*})
24
+ }
25
+ .compact
18
26
  end
19
27
 
20
28
  def grep(regex, file_pattern)
@@ -1,3 +1,3 @@
1
1
  module TestLauncher
2
- VERSION = "2.28.0"
2
+ VERSION = "2.30.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.28.0
4
+ version: 2.30.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: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2023-08-10 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.1.4
96
+ rubygems_version: 3.3.22
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Easily run tests