source_finder 0.1.0 → 1.0.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 +4 -4
- data/lib/source_finder/source_file_globber.rb +21 -10
- data/lib/source_finder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e0d0f568a71b7217644b6ff017fffe4018aa25d
|
4
|
+
data.tar.gz: 648cd95098a5c1395011fd05bd4bb79acc2bac7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5938d4d656616ba863955212c1f8f2c307198d81e6299408983a4f52e9000d1db3ea3c5184782f12654a8cfd6c6a433c71d685dd8d4a6041d6237526d786148a
|
7
|
+
data.tar.gz: 491deed20028116610efc849a95ddc2628f314b08feaf8480270fc532959a7d4e6478da481c1a82ec0e71129f25e8f7f64527c3f0632ce6d0784fd2b77641bae
|
@@ -5,7 +5,8 @@ module SourceFinder
|
|
5
5
|
# See README.md for documentation on these configuration parameters.
|
6
6
|
|
7
7
|
attr_accessor :ruby_dirs, :source_dirs, :extra_files, :extra_ruby_files,
|
8
|
-
:ruby_file_extensions, :source_file_extensions,
|
8
|
+
:ruby_file_extensions, :source_file_extensions,
|
9
|
+
:exclude_files, :source_files_glob, :source_files_exclude_glob
|
9
10
|
|
10
11
|
def ruby_dirs
|
11
12
|
@ruby_dirs ||= %w(src app lib test spec feature)
|
@@ -24,7 +25,11 @@ module SourceFinder
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def exclude_files
|
27
|
-
@
|
28
|
+
if @source_files_exclude_glob
|
29
|
+
@globber.glob(@source_files_exclude_glob)
|
30
|
+
else
|
31
|
+
@exclude_files
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
def source_file_extensions
|
@@ -36,16 +41,18 @@ module SourceFinder
|
|
36
41
|
def source_files_glob(extra_source_files = extra_files,
|
37
42
|
dirs = source_dirs,
|
38
43
|
extensions = source_file_extensions)
|
39
|
-
|
44
|
+
@source_files_glob ||
|
45
|
+
"{#{extra_source_files.join(',')}," \
|
40
46
|
"{*,.*}.{#{extensions}}," +
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
File.join("{#{dirs.join(',')}}",
|
48
|
+
'**',
|
49
|
+
"{*,.*}.{#{extensions}}") +
|
50
|
+
'}'
|
45
51
|
end
|
46
52
|
|
47
53
|
def source_files_exclude_glob
|
48
|
-
|
54
|
+
@source_files_exclude_glob ||
|
55
|
+
"{#{exclude_files.join(', ')}}"
|
49
56
|
end
|
50
57
|
|
51
58
|
def ruby_file_extensions
|
@@ -57,10 +64,14 @@ module SourceFinder
|
|
57
64
|
end
|
58
65
|
|
59
66
|
def ruby_files
|
60
|
-
|
67
|
+
@globber.glob(ruby_files_glob) - exclude_files
|
61
68
|
end
|
62
69
|
|
63
|
-
def
|
70
|
+
def source_files
|
71
|
+
@globber.glob(source_files_glob) - exclude_files
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize(globber: Dir)
|
64
75
|
@globber = globber
|
65
76
|
end
|
66
77
|
end
|