code_manifest 1.3.0 → 1.5.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/code_manifest/manifest.rb +15 -16
- data/lib/code_manifest/rule.rb +2 -5
- data/lib/code_manifest/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57ebc00567f59f24c5be818a88ecb8d117175474290653d734a311d7718802de
|
4
|
+
data.tar.gz: b7a582abfe21b8f1eaf5beed11fe1244c43307d9e034c9a68da64ab4e9ff53b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6793af62e46f89a33aed509ef44c9bccfd4e280ec483a1a39ec405d2145112ae8ff5531c7bd4e197f45e6b1973901182327eda7ea54f922930c172b63d21a083
|
7
|
+
data.tar.gz: 88387c161220a1142bbd69a8d6811fe8de84d8bdb8a7381db027c76f193e5461f34bdc5fda4b9b802e5d0fc3b7202329d015c942703236e5c0d386b14b2bb2eb
|
@@ -16,7 +16,13 @@ module CodeManifest
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def files
|
19
|
-
@files ||=
|
19
|
+
@files ||= begin
|
20
|
+
inclusion_files = Dir.glob(inclusion_rules.map(&:glob), GLOB_OPTIONS)
|
21
|
+
inclusion_files.delete_if do |file|
|
22
|
+
exclusion_rules.any? { |rule| rule.match?(file) }
|
23
|
+
end
|
24
|
+
files_with_relative_path(inclusion_files).sort!.freeze
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def digest
|
@@ -27,11 +33,11 @@ module CodeManifest
|
|
27
33
|
end
|
28
34
|
|
29
35
|
def matches(paths)
|
30
|
-
result_paths = paths.select do |path|
|
36
|
+
result_paths = Array(paths).select do |path|
|
31
37
|
inclusion_rules.any? { |rule| rule.match?(path) }
|
32
38
|
end
|
33
39
|
result_paths.reject! do |path|
|
34
|
-
|
40
|
+
exclusion_rules.any? { |rule| rule.match?(path) }
|
35
41
|
end
|
36
42
|
|
37
43
|
result_paths.sort!
|
@@ -39,29 +45,22 @@ module CodeManifest
|
|
39
45
|
|
40
46
|
private
|
41
47
|
|
42
|
-
def inclusion_files
|
43
|
-
@inclusion_files ||= files_with_relative_path(Dir.glob(inclusion_rules.map(&:glob), GLOB_OPTIONS))
|
44
|
-
end
|
45
|
-
|
46
48
|
def inclusion_rules
|
47
49
|
@inclusion_rules ||= rules.reject(&:exclude)
|
48
50
|
end
|
49
51
|
|
50
|
-
def exclusion_files
|
51
|
-
@exclusion_files ||= files_with_relative_path(Dir.glob(exclusion_rules.map(&:glob), GLOB_OPTIONS))
|
52
|
-
end
|
53
|
-
|
54
52
|
def exclusion_rules
|
55
53
|
@exclusion_rules ||= rules.select(&:exclude)
|
56
54
|
end
|
57
55
|
|
58
56
|
def files_with_relative_path(files)
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
prefix = File.join(CodeManifest.root, "/")
|
58
|
+
|
59
|
+
files.filter_map do |file|
|
60
|
+
next if File.directory?(file)
|
62
61
|
|
63
|
-
|
64
|
-
end
|
62
|
+
file.delete_prefix(prefix)
|
63
|
+
end
|
65
64
|
end
|
66
65
|
end
|
67
66
|
end
|
data/lib/code_manifest/rule.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'pathname'
|
4
|
-
|
5
3
|
module CodeManifest
|
6
4
|
class Rule
|
7
5
|
attr_reader :exclude, :glob
|
@@ -26,10 +24,9 @@ module CodeManifest
|
|
26
24
|
end
|
27
25
|
|
28
26
|
def match?(file)
|
29
|
-
file =
|
30
|
-
file = @root.join(file) unless file.absolute?
|
27
|
+
file = File.join(@root, file) unless File.absolute_path?(file)
|
31
28
|
|
32
|
-
File.fnmatch?(glob, file
|
29
|
+
File.fnmatch?(glob, file, Manifest::GLOB_OPTIONS)
|
33
30
|
end
|
34
31
|
end
|
35
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_manifest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -41,7 +41,7 @@ licenses: []
|
|
41
41
|
metadata:
|
42
42
|
homepage_uri: https://github.com/rubyatscale/code_manifest
|
43
43
|
source_code_uri: https://github.com/rubyatscale/code_manifest
|
44
|
-
changelog_uri: https://github.com/rubyatscale/code_manifest/
|
44
|
+
changelog_uri: https://github.com/rubyatscale/code_manifest/releases
|
45
45
|
post_install_message:
|
46
46
|
rdoc_options: []
|
47
47
|
require_paths:
|