repos_report 2.0.1 → 2.0.2

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
  SHA1:
3
- metadata.gz: 9a9c5e23400f34721aaefa55ddb4e4c9c9b41b4e
4
- data.tar.gz: 99d972d4e83e326f64c3875d999dd09c3a85384c
3
+ metadata.gz: d129f122271f340349a4a78749ac82baf33f271b
4
+ data.tar.gz: 70537a1d76d6e11e36c1079625631da9e1b1974a
5
5
  SHA512:
6
- metadata.gz: aacb75a45bf29e8ab81537f47c33a2f3055d54ac2985a200c0aaa21ac9486032e7ea2788519746736d90695d4ab6793bb183e46491fe26072ad559aa1cdb9fb7
7
- data.tar.gz: 3c97a70c435494a32b8be44eb6e6fcb7b6b7861853286dc40f64b043aaf8ae64f110b992e2685da54c5f8576e5ea55cda85a27fe986dc00704fe7d22be3a0895
6
+ metadata.gz: e152954230055922dc2d899b5f273ce04706e0b92613c9da7a8d2027c89bfebf0fc7e4fa058677afe45b6b7bd79a120e0c13241725a664ecb7cecb9a13cba869
7
+ data.tar.gz: 1b7aa9f5c59788ef9d24822927eb756e0ff754f5d8f7a22351b3975478cde228cca3be81f1d5b9bceb3efdc1da3a910580b08e23923790e19b059fbda93c25a8
@@ -4,50 +4,35 @@ module RepoFinder
4
4
  class << self
5
5
 
6
6
  def repos_in_or_below(directory)
7
- if all_child_folders_have_repos(directory) # Base case
8
- repos_in(directory)
9
-
10
- else
11
- repos = repos_in(directory)
12
-
13
- folders_without_repos_in(directory).each do |folder|
14
- repos += repos_in_or_below(folder)
15
- end
16
-
17
- repos
18
- end
19
- end
20
-
21
- def repos_in(directory)
22
- return [] if folders_in(directory).empty?
23
-
24
- folders_with_repos_in(directory).map { |d| Repo.new(d) }
7
+ repos_in(directory) + repos_in_subdirectories_of(directory)
25
8
  end
26
9
 
27
10
 
28
11
 
29
12
  private
30
13
 
31
- def folders_without_repos_in(directory)
32
- directories = folders_in(directory)
33
-
34
- directories.reject { |d| contains_repo?(d) }
14
+ def repos_in(directory)
15
+ folders_with_repos_in(directory).map { |d| Repo.new(d) }
35
16
  end
36
17
 
37
18
  def folders_with_repos_in(directory)
38
- directories = folders_in(directory)
19
+ directories = subdirectories_in(directory)
39
20
  directories.select { |d| contains_repo?(d) }
40
21
  end
41
22
 
42
- def all_child_folders_have_repos(directory)
43
- folders_with_repos_in(directory).sort == folders_in(directory).sort
23
+ def repos_in_subdirectories_of(directory)
24
+ subdirectories = subdirectories_in(directory)
25
+
26
+ subdirectories.reduce([]) do |repos, subdirectory|
27
+ repos += repos_in_or_below(subdirectory)
28
+ end
44
29
  end
45
30
 
46
31
  def contains_repo?(directory_path)
47
32
  Dir.glob("#{directory_path}/.git").any?
48
33
  end
49
34
 
50
- def folders_in(directory)
35
+ def subdirectories_in(directory)
51
36
  Dir.glob("#{directory}/*")
52
37
  end
53
38
  end
@@ -1,3 +1,3 @@
1
1
  module ReposReport
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repos_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - neurodynamic