stepmod-utils 0.3.13 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +4 -6
- data/exe/stepmod-extract-terms +36 -2
- data/lib/stepmod/utils/terms_extractor.rb +6 -4
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dbfad6cebbd4552c2b91cfd5aac3dc5a032bde8a44269b83303d8472bf86310
|
4
|
+
data.tar.gz: 185a292f76f2e5b792383b8f2ca17438cb939a557f3df763ed5c9321c28b7438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6f855167c151253c8b2278dfafe460198fe2c7789ce3cb2eba4dca20dc216546d88b68f199f48a6508574b1c28eaf476604799c99b3762662269eec743e0d5e
|
7
|
+
data.tar.gz: a85e8f5a2d4607f5c001c5889c4549d2698279bb5163b3e87c79e5e28c3f0bbea7a38dd56d3440af3b43467ac2d93d7b16407d63f27c7abc61ca3fe1f5aa6551
|
data/README.adoc
CHANGED
@@ -10,7 +10,8 @@ image:https://img.shields.io/github/commits-since/metanorma/stepmod-utils/latest
|
|
10
10
|
|
11
11
|
== Purpose
|
12
12
|
|
13
|
-
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod
|
13
|
+
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod
|
14
|
+
repository.
|
14
15
|
|
15
16
|
|
16
17
|
== CVS to Git migration procedures
|
@@ -31,11 +32,8 @@ Or include it in your gemspec.
|
|
31
32
|
|
32
33
|
[source,sh]
|
33
34
|
----
|
34
|
-
# Extracts from
|
35
|
-
$ stepmod-extract-terms
|
36
|
-
|
37
|
-
# Extracts from specified stepmod/ or stepmod/data/ directory
|
38
|
-
$ stepmod-extract-terms {stepmod-data-directory}
|
35
|
+
# Extracts from specified stepmod/data/ directory
|
36
|
+
$ stepmod-extract-terms -p {stepmod-data-directory} -i {path-to-repository_index.xml}
|
39
37
|
----
|
40
38
|
|
41
39
|
Then these files will be created:
|
data/exe/stepmod-extract-terms
CHANGED
@@ -21,14 +21,48 @@ end
|
|
21
21
|
require "bundler/setup"
|
22
22
|
require "stepmod/utils/terms_extractor"
|
23
23
|
|
24
|
-
|
24
|
+
require 'optparse'
|
25
|
+
|
26
|
+
options = {}
|
27
|
+
OptionParser.new do |opts|
|
28
|
+
opts.banner = "Usage: #{$0} [options]"
|
29
|
+
|
30
|
+
opts.on("-p", "--path STEPMOD_DATA_PATH", String, "Path to STEPmod CVS data directory") do |path|
|
31
|
+
options[:stepmod_dir] = path
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on("-i", "--index INDEX_PATH", String, "Path to repository_index.xml") do |path|
|
35
|
+
unless path.nil?
|
36
|
+
options[:index_path] = Pathname.new(path).to_s
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
41
|
+
puts opts
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
end.parse!
|
45
|
+
|
46
|
+
stepmod_dir = options[:stepmod_dir]
|
47
|
+
if stepmod_dir.nil?
|
48
|
+
raise StandardError.new("STEPmod data path not set, set with the `-p` option.")
|
49
|
+
else
|
50
|
+
log "STEPmod data path: `#{stepmod_dir}`"
|
51
|
+
end
|
52
|
+
|
53
|
+
index_path = options[:index_path] || File.join(stepmod_dir, "repository_index.xml")
|
54
|
+
unless File.exists?(index_path)
|
55
|
+
raise StandardError.new("Index file not present at #{index_path}, set with the `-i` option.")
|
56
|
+
else
|
57
|
+
log "Repository index path: `#{index_path}`"
|
58
|
+
end
|
25
59
|
|
26
60
|
general_concepts,
|
27
61
|
resource_concepts,
|
28
62
|
parsed_bibliography,
|
29
63
|
part_concepts,
|
30
64
|
part_resources,
|
31
|
-
part_modules = Stepmod::Utils::TermsExtractor.call(stepmod_dir)
|
65
|
+
part_modules = Stepmod::Utils::TermsExtractor.call(stepmod_dir, index_path)
|
32
66
|
|
33
67
|
def part_to_title(bibdata)
|
34
68
|
case bibdata.part.to_i
|
@@ -15,6 +15,7 @@ module Stepmod
|
|
15
15
|
|
16
16
|
attr_reader :stepmod_path,
|
17
17
|
:stepmod_dir,
|
18
|
+
:index_path,
|
18
19
|
:general_concepts,
|
19
20
|
:resource_concepts,
|
20
21
|
:parsed_bibliography,
|
@@ -25,14 +26,15 @@ module Stepmod
|
|
25
26
|
:part_modules,
|
26
27
|
:stdout
|
27
28
|
|
28
|
-
def self.call(stepmod_dir, stdout = $stdout)
|
29
|
-
new(stepmod_dir, stdout).call
|
29
|
+
def self.call(stepmod_dir, index_path, stdout = $stdout)
|
30
|
+
new(stepmod_dir, index_path, stdout).call
|
30
31
|
end
|
31
32
|
|
32
|
-
def initialize(stepmod_dir, stdout)
|
33
|
+
def initialize(stepmod_dir, index_path, stdout)
|
33
34
|
@stdout = stdout
|
34
35
|
@stepmod_dir = stepmod_dir
|
35
36
|
@stepmod_path = Pathname.new(stepmod_dir).realpath
|
37
|
+
@index_path = Pathname.new(index_path).to_s
|
36
38
|
@general_concepts = Glossarist::Collection.new
|
37
39
|
@resource_concepts = Glossarist::Collection.new
|
38
40
|
@parsed_bibliography = []
|
@@ -79,7 +81,7 @@ module Stepmod
|
|
79
81
|
|
80
82
|
log "INFO: Detecting paths..."
|
81
83
|
|
82
|
-
repo_index = Nokogiri::XML(File.read(
|
84
|
+
repo_index = Nokogiri::XML(File.read(@index_path)).root
|
83
85
|
|
84
86
|
files = []
|
85
87
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|