rstub 0.2.0 → 0.2.1
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/rstub/path_parser.rb +3 -9
- data/rstub.gemspec +1 -1
- data/spec/path_parser_spec.rb +2 -2
- metadata +1 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44dda35b2036924e4e4d798aa8a3ca55b5dbe929
|
|
4
|
+
data.tar.gz: 6fd78aa063a60cad82e874cf0707438e09303e8c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a20122de6d8fd7864763532bfd961d6046ad0a32ce85dcb3744b66d02034af5c931485afeb853246ba0fc800738811cbbc7f84e82824f50b53d30fb30362cbe2
|
|
7
|
+
data.tar.gz: 55e9ce7005f0667e72d2f1a83e86ae0d4ed6cb6770825d6a12c79da8571543d183cb902af1ac83eb4b45c7f9dfbda6f70297464fafa735687affdba4ec1bafc2
|
data/lib/rstub/path_parser.rb
CHANGED
|
@@ -28,23 +28,17 @@ class PathParser
|
|
|
28
28
|
file.split('/').slice(0...-1)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def parse_out_directories(files)
|
|
32
|
-
directories = []
|
|
33
|
-
files.each do |file|
|
|
34
|
-
directories << extract_directories(file) if in_directory?(file)
|
|
35
|
-
end
|
|
36
|
-
directories.flatten
|
|
37
|
-
end
|
|
38
|
-
|
|
39
31
|
def get_directories(files)
|
|
40
32
|
dirs = []
|
|
41
33
|
files.each do |file|
|
|
42
34
|
if Dir.exist? file
|
|
43
35
|
dirs << file
|
|
44
36
|
dirs.concat(get_directories(Dir.glob("#{file}/*")))
|
|
37
|
+
elsif in_directory?(file)
|
|
38
|
+
dirs << extract_directories(file)
|
|
45
39
|
end
|
|
46
40
|
end
|
|
47
|
-
dirs
|
|
41
|
+
dirs.flatten.uniq
|
|
48
42
|
end
|
|
49
43
|
|
|
50
44
|
def get_files_from_directory(files, directories)
|
data/rstub.gemspec
CHANGED
data/spec/path_parser_spec.rb
CHANGED
|
@@ -19,7 +19,7 @@ describe PathParser do
|
|
|
19
19
|
it 'returns glob matches from current directory' do
|
|
20
20
|
paths = path_parser.get_globs(['*'])
|
|
21
21
|
expect(paths[:directories])
|
|
22
|
-
.to match_array(%w(test_dir test_dir/nested_dir))
|
|
22
|
+
.to match_array(%w(test_dir nested_dir test_dir/nested_dir))
|
|
23
23
|
expect(paths[:files])
|
|
24
24
|
.to match_array(%w(file1.rb file2.rb test_dir/nested_file.rb
|
|
25
25
|
test_dir/nested_dir/nested_file2.rb))
|
|
@@ -28,7 +28,7 @@ describe PathParser do
|
|
|
28
28
|
it 'returns glob matches from lowel directory' do
|
|
29
29
|
paths = path_parser.get_globs(['*/*'])
|
|
30
30
|
expect(paths[:directories])
|
|
31
|
-
.to match_array(%w(test_dir/nested_dir))
|
|
31
|
+
.to match_array(%w(test_dir nested_dir test_dir/nested_dir))
|
|
32
32
|
expect(paths[:files])
|
|
33
33
|
.to match_array(%w(test_dir/nested_file.rb
|
|
34
34
|
test_dir/nested_dir/nested_file2.rb))
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rstub
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Kim
|
|
@@ -91,4 +91,3 @@ test_files:
|
|
|
91
91
|
- spec/path_parser_spec.rb
|
|
92
92
|
- spec/rstub_spec.rb
|
|
93
93
|
- spec/spec_helper.rb
|
|
94
|
-
has_rdoc:
|