distincter2 1.3.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ffd3065d97f5ea86eaa09c2a0a12f1d86bbce35409c8469ae4a3593284d831a
4
- data.tar.gz: 40b4baf7cddb4ce8123442a7efb7b6e3c21a7a07236e0c3fe523877bc1c8901e
3
+ metadata.gz: 4b8d1d5aa62302ef718c566a9053311075f4999fc1e8509c1e2d93e788f85a87
4
+ data.tar.gz: 66ebec72784df7a866f179c730f354120db1e227911655a8ee11ce509947adb5
5
5
  SHA512:
6
- metadata.gz: 238b6ca822da1fe8752e8dfbeea444cccf51ac237f9e044543ac92552d012bd4c330d4798bcd666e758b372bd5ad21c585abf8539f8ad41afe976780c79833bc
7
- data.tar.gz: f526bdee7e4be1bebd6af837d223bef292c67c7b34d7a7078afa3d8def5722d11d1b88cc120e4b669c94927dbed3f324cf3d3f500b89f77a16406c9dd362e7e6
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
@@ -34,7 +34,7 @@ module Distincter2
34
34
  else
35
35
  next unless entry.end_with?('.md')
36
36
 
37
- next if @config.exclude_paths.include?(entry_name)
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
@@ -6,11 +6,13 @@ module Distincter2
6
6
  # Distincter2 config.
7
7
  class D2Config
8
8
  # @param {String[]} exclude_paths
9
- def initialize(exclude_paths)
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
- exclude_paths += file.readlines.map(&:strip)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distincter2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Fomchenkov