expressir 2.4.50-arm-linux → 2.4.51-arm-linux
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26a3966fee1735a6cb70ac8ad74c051d8c0968a819f5c9d1bc403b7ca3b33efa
|
|
4
|
+
data.tar.gz: ccb78f85184b17c0c92adb69d98560d52ee4cb6c7904cf0b4d68f085338d03fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33fbbccd4a2676eecc10a7c85b4b407129bbbdc66a2f1e87988b07489d97e2dbcc7718194be727085aca91bbf69ab6f36e59daedc5f0eada17d78fd685072070
|
|
7
|
+
data.tar.gz: 4608fe3ac7eee8797f4ee5bcd93786c661148554e7bd5c9eca0c4ca787f4b8ea5530541e97daa7c974638d2f66c94aeb437d95d59c26b980e72117e251377363
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "etc"
|
|
2
|
+
|
|
1
3
|
module Expressir
|
|
2
4
|
module Commands
|
|
3
5
|
class Base
|
|
@@ -7,6 +9,17 @@ module Expressir
|
|
|
7
9
|
@options = options
|
|
8
10
|
end
|
|
9
11
|
|
|
12
|
+
# The parallel-parse worker count for the validate family: the
|
|
13
|
+
# explicit --jobs value, or every core (issue #584). The
|
|
14
|
+
# ParallelFiles facility degrades to sequential where fork is
|
|
15
|
+
# unavailable (e.g. Windows).
|
|
16
|
+
def jobs_count
|
|
17
|
+
jobs = options[:jobs]
|
|
18
|
+
return jobs if jobs.is_a?(Integer) && jobs >= 1
|
|
19
|
+
|
|
20
|
+
Etc.nprocessors
|
|
21
|
+
end
|
|
22
|
+
|
|
10
23
|
# Common utilities that all commands might need
|
|
11
24
|
def say(message)
|
|
12
25
|
# Use instance variable for testability - if output is set, use it
|
|
@@ -29,6 +29,9 @@ module Expressir
|
|
|
29
29
|
DESC
|
|
30
30
|
method_option :verbose, type: :boolean, default: false,
|
|
31
31
|
desc: "Show verbose output"
|
|
32
|
+
method_option :jobs, type: :numeric,
|
|
33
|
+
desc: "Parallel parse workers (issue #584; " \
|
|
34
|
+
"default: every core, 1 = sequential)"
|
|
32
35
|
def load(*paths)
|
|
33
36
|
ValidateLoad.new(options).run(paths)
|
|
34
37
|
end
|
|
@@ -83,6 +86,9 @@ module Expressir
|
|
|
83
86
|
desc "remarks PATH_OR_MANIFEST",
|
|
84
87
|
"Validate remark blocks: a block anchor ([[name]]) must be " \
|
|
85
88
|
"defined in a single remark scope per schema"
|
|
89
|
+
method_option :jobs, type: :numeric,
|
|
90
|
+
desc: "Parallel parse workers (issue #584; " \
|
|
91
|
+
"default: every core, 1 = sequential)"
|
|
86
92
|
def remarks(*paths)
|
|
87
93
|
ValidateRemarks.new(options).run(paths)
|
|
88
94
|
end
|
|
@@ -40,18 +40,36 @@ module Expressir
|
|
|
40
40
|
no_version = []
|
|
41
41
|
no_valid = []
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
# The parses fan out across forked workers (issue #584); the
|
|
44
|
+
# reporting stays on the main thread, in input order. Small
|
|
45
|
+
# sets stay sequential (the facility's own threshold).
|
|
46
|
+
parse = ->(path) do
|
|
47
|
+
Expressir::Express::Parser.from_file(path)
|
|
48
|
+
rescue StandardError
|
|
49
|
+
nil
|
|
50
|
+
end
|
|
51
|
+
results =
|
|
52
|
+
if Expressir::Express::ParallelFiles.sequential?(paths, jobs_count)
|
|
53
|
+
paths.map { |path| parse.call(path) }
|
|
54
|
+
else
|
|
55
|
+
Expressir::Express::ParallelFiles.run(
|
|
56
|
+
paths, parse: parse, max_processes: jobs_count
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
paths.zip(results).each do |path, repository|
|
|
44
61
|
x = Pathname.new(path).realpath.relative_path_from(Dir.pwd)
|
|
45
62
|
say "Validating #{x}"
|
|
46
|
-
ret = validate_schema(path)
|
|
47
63
|
|
|
48
|
-
if
|
|
64
|
+
if repository.nil?
|
|
49
65
|
no_valid << "Failed to parse: #{x}"
|
|
50
66
|
next
|
|
51
67
|
end
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
69
|
+
repository.schemas.each do |schema|
|
|
70
|
+
unless schema.version&.value
|
|
71
|
+
no_version << "Missing version string: schema `#{schema.id}` | #{x}"
|
|
72
|
+
end
|
|
55
73
|
end
|
|
56
74
|
end
|
|
57
75
|
|
|
@@ -68,16 +86,6 @@ module Expressir
|
|
|
68
86
|
say "Validation passed for all EXPRESS schemas."
|
|
69
87
|
end
|
|
70
88
|
|
|
71
|
-
def validate_schema(path)
|
|
72
|
-
repository = Expressir::Express::Parser.from_file(path)
|
|
73
|
-
repository.schemas.inject([]) do |acc, schema|
|
|
74
|
-
acc << schema.id unless schema.version&.value
|
|
75
|
-
acc
|
|
76
|
-
end
|
|
77
|
-
rescue StandardError
|
|
78
|
-
nil
|
|
79
|
-
end
|
|
80
|
-
|
|
81
89
|
def print_validation_errors(type, array)
|
|
82
90
|
return if array.empty?
|
|
83
91
|
|
|
@@ -52,10 +52,22 @@ module Expressir
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def validate_from_paths(paths)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
files = schema_paths(paths)
|
|
56
|
+
# The parses fan out across forked workers (issue #584); a
|
|
57
|
+
# parse failure raises in input order, exactly like the
|
|
58
|
+
# sequential pass did. Small sets stay sequential (the
|
|
59
|
+
# facility's own threshold).
|
|
60
|
+
parse = ->(path) { Expressir::Express::Parser.from_file(path) }
|
|
61
|
+
results =
|
|
62
|
+
if Expressir::Express::ParallelFiles.sequential?(files, jobs_count)
|
|
63
|
+
files.map { |path| parse.call(path) }
|
|
64
|
+
else
|
|
65
|
+
Expressir::Express::ParallelFiles.run(
|
|
66
|
+
files, parse: parse, max_processes: jobs_count, strict: true
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
parsed = files.zip(results)
|
|
70
|
+
.filter_map { |path, repository| repository && [path, repository.schemas] }
|
|
59
71
|
schema_ids = parsed.flat_map { |_, schemas| schemas.map(&:id) }
|
|
60
72
|
.map { |id| id.to_s.downcase }
|
|
61
73
|
|
data/lib/expressir/version.rb
CHANGED