distincter2 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -1
- data/lib/distincter2/checker.rb +8 -1
- data/lib/distincter2/config.rb +17 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b8d1d5aa62302ef718c566a9053311075f4999fc1e8509c1e2d93e788f85a87
|
4
|
+
data.tar.gz: 66ebec72784df7a866f179c730f354120db1e227911655a8ee11ce509947adb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81680f8b162f0851527be19be9a8018ebf34a9a613aab8f7451a9035ba3e8b1146303054810dff9724638ab3bd871965e27a2c030949c85804a2a477e0e6f4f4
|
7
|
+
data.tar.gz: 9c5898feafe48a5111c47bdbe99907c2b36eba081ffcc2d89f9e70cdaa9cbc542828f76f10cf6f64ba7d7dc68acb6a44a9793f2f4b0e324b11277b7e4c25fa1d
|
data/README.md
CHANGED
@@ -25,7 +25,22 @@ $ ./bin/local_distincter2 ./path_to_directory_with_markdown_files
|
|
25
25
|
|
26
26
|
### Config
|
27
27
|
|
28
|
-
Add `distincter2_config.d2c` to root of your project and add excluded files line by line
|
28
|
+
Add `distincter2_config.d2c` to root of your project and add excluded files line by line. Below you can find examples.
|
29
|
+
|
30
|
+
#### v1
|
31
|
+
|
32
|
+
Provides basic list for excluding files by names (without directories).
|
33
|
+
|
34
|
+
Add `v1`:
|
35
|
+
|
36
|
+
```text
|
37
|
+
v1
|
38
|
+
|
39
|
+
BOOKS.md
|
40
|
+
DONE.md
|
41
|
+
```
|
42
|
+
|
43
|
+
Or without `v1`:
|
29
44
|
|
30
45
|
```text
|
31
46
|
BOOKS.md
|
data/lib/distincter2/checker.rb
CHANGED
@@ -34,7 +34,7 @@ module Distincter2
|
|
34
34
|
else
|
35
35
|
next unless entry.end_with?('.md')
|
36
36
|
|
37
|
-
next
|
37
|
+
next unless can_analyze(entry_name)
|
38
38
|
|
39
39
|
analyze_result = analyze_file(file)
|
40
40
|
end
|
@@ -47,6 +47,13 @@ module Distincter2
|
|
47
47
|
|
48
48
|
# rubocop:enable Metrics/MethodLength
|
49
49
|
|
50
|
+
# @param {String} entry
|
51
|
+
def can_analyze(entry)
|
52
|
+
return false unless @config.version == 'v1'
|
53
|
+
|
54
|
+
@config.exclude_paths.none?(entry)
|
55
|
+
end
|
56
|
+
|
50
57
|
# @param {String} path
|
51
58
|
# @return {String[]}
|
52
59
|
# rubocop:disable Metrics/MethodLength
|
data/lib/distincter2/config.rb
CHANGED
@@ -6,11 +6,13 @@ module Distincter2
|
|
6
6
|
# Distincter2 config.
|
7
7
|
class D2Config
|
8
8
|
# @param {String[]} exclude_paths
|
9
|
-
|
9
|
+
# @param {String} version
|
10
|
+
def initialize(exclude_paths, version = 'v1')
|
10
11
|
@exclude_paths = exclude_paths.to_set
|
12
|
+
@version = version
|
11
13
|
end
|
12
14
|
|
13
|
-
attr_accessor :exclude_paths
|
15
|
+
attr_accessor :exclude_paths, :version
|
14
16
|
end
|
15
17
|
|
16
18
|
# D2Config with empty arguments.
|
@@ -29,12 +31,23 @@ module Distincter2
|
|
29
31
|
end
|
30
32
|
|
31
33
|
# @return {D2Config}
|
34
|
+
# rubocop:disable Metrics/MethodLength
|
32
35
|
def parse
|
33
36
|
exclude_paths = []
|
37
|
+
version = 'v1'
|
34
38
|
::File.open(@config_path, 'r') do |file|
|
35
|
-
|
39
|
+
file.readlines.each do |line|
|
40
|
+
l = line.strip
|
41
|
+
|
42
|
+
next if l == 'v1'
|
43
|
+
|
44
|
+
next if l.empty?
|
45
|
+
|
46
|
+
exclude_paths << l
|
47
|
+
end
|
36
48
|
end
|
37
|
-
::Distincter2::D2Config.new(exclude_paths)
|
49
|
+
::Distincter2::D2Config.new(exclude_paths, version)
|
38
50
|
end
|
51
|
+
# rubocop:enable Metrics/MethodLength
|
39
52
|
end
|
40
53
|
end
|