stepmod-utils 0.3.9 → 0.3.13
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/exe/stepmod-extract-terms +34 -1
- data/lib/stepmod/utils/cleaner.rb +3 -1
- data/lib/stepmod/utils/concept.rb +1 -1
- data/lib/stepmod/utils/converters/a.rb +0 -4
- data/lib/stepmod/utils/converters/ext_description.rb +1 -1
- data/lib/stepmod/utils/converters/stepmod_ext_description.rb +22 -5
- data/lib/stepmod/utils/converters/strong.rb +2 -1
- data/lib/stepmod/utils/converters/uof.rb +1 -1
- data/lib/stepmod/utils/stepmod_definition_converter.rb +2 -1
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +2 -3
- data/migrating_from_cvs.adoc +0 -190
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7bf9af17dc5e00cbaa48dbadcca9866867c666f27454fdcedd05cc10424e77
|
4
|
+
data.tar.gz: e082809ce1ba11806170e75ab9e35e4fb32dbf5062b0cc991c52a320adef12d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f181ca96460491b225d3f589092af504c18dc684d1d561556ab0504f148e01413566a05a17ccfe7f4de8fd8f6d0b154949d2e7fea3b21d9cd3bbdcf162285df
|
7
|
+
data.tar.gz: 6cfe79605d3aa7da7387caf85b1374dec3601eec9880f1740364976feb12b218908635dffc1bc446fc519458856e4a5e55e9fffaca677e3cdbf1c7d0c6b86b4e
|
data/exe/stepmod-extract-terms
CHANGED
@@ -85,18 +85,40 @@ part_concepts.each do |(bibdata, current_part_concepts)|
|
|
85
85
|
log "INFO: written to: #{fn}"
|
86
86
|
end
|
87
87
|
|
88
|
+
File.open("03x-stepmod.adoc", "w") do |file|
|
89
|
+
part_concepts.sort_by do |(bibdata, current_part_concepts)|
|
90
|
+
bibdata.part.to_i
|
91
|
+
end.each do |(bibdata, current_part_concepts)|
|
92
|
+
fn = "03x-stepmod-#{bibdata.part}.adoc"
|
93
|
+
file.puts("\ninclude::#{fn}[]\n")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
log "INFO: written summary file to: 03x-stepmod.adoc"
|
98
|
+
|
88
99
|
part_resources.each do |(bibdata, current_part_resources)|
|
89
100
|
current_part_resources = current_part_resources.to_a.map do |n|
|
90
101
|
n.localizations["en"]
|
91
102
|
end
|
92
103
|
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
93
104
|
File.open(fn, "w") do |file|
|
94
|
-
file.puts("== #{part_to_title(bibdata)}\n\n")
|
105
|
+
# file.puts("== #{part_to_title(bibdata)}\n\n")
|
95
106
|
file.puts(replace_images(current_part_resources.map(&:to_mn_adoc).join("\n")))
|
96
107
|
end
|
97
108
|
log "INFO: written to: #{fn}"
|
98
109
|
end
|
99
110
|
|
111
|
+
File.open("04x-stepmod-entities-resources.adoc", "w") do |file|
|
112
|
+
part_resources.sort_by do |(bibdata, current_part_resources)|
|
113
|
+
bibdata.part.to_i
|
114
|
+
end.each do |(bibdata, current_part_resources)|
|
115
|
+
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
116
|
+
file.puts("\ninclude::#{fn}[]\n")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
log "INFO: written summary file to: 04x-stepmod-entities-resources.adoc"
|
121
|
+
|
100
122
|
part_modules.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
101
123
|
fn = "05x-stepmod-entities-modules-#{bibdata.part}.adoc"
|
102
124
|
File.open(fn, "w") do |file|
|
@@ -128,6 +150,17 @@ part_modules.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
|
128
150
|
log "INFO: written to: #{fn}"
|
129
151
|
end
|
130
152
|
|
153
|
+
File.open("05x-stepmod-entities-modules.adoc", "w") do |file|
|
154
|
+
part_modules.sort_by do |(bibdata, part_modules_arm, part_modules_mim)|
|
155
|
+
bibdata.part.to_i
|
156
|
+
end.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
157
|
+
fn = "05x-stepmod-entities-modules-#{bibdata.part}.adoc"
|
158
|
+
file.puts("\ninclude::#{fn}[]\n")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
log "INFO: written summary file to: 05x-stepmod-entities-modules.adoc"
|
163
|
+
|
131
164
|
File.open("031-stepmod-general.adoc", "w") do |file|
|
132
165
|
file.puts(
|
133
166
|
replace_images(
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "uri"
|
4
|
-
|
5
3
|
module Stepmod
|
6
4
|
module Utils
|
7
5
|
module Converters
|
@@ -31,9 +29,7 @@ module Stepmod
|
|
31
29
|
name = title if name.empty?
|
32
30
|
href = "link:#{href}" unless href.to_s&.match?(URI::DEFAULT_PARSER.make_regexp)
|
33
31
|
link = "#{href}[#{name}]"
|
34
|
-
# link.prepend(' ')
|
35
32
|
" #{link}"
|
36
|
-
|
37
33
|
end
|
38
34
|
end
|
39
35
|
end
|
@@ -3,7 +3,7 @@ module Stepmod
|
|
3
3
|
module Converters
|
4
4
|
class ExtDescription < ReverseAdoc::Converters::Base
|
5
5
|
def convert(node, state = {})
|
6
|
-
state = state.merge(schema_name: node["linkend"])
|
6
|
+
state = state.merge(schema_name: node["linkend"], non_flanking_whitesapce: true)
|
7
7
|
child_text = treat_children(node, state).strip
|
8
8
|
|
9
9
|
<<~TEMPLATE
|
@@ -13,10 +13,27 @@ module Stepmod
|
|
13
13
|
child_text = treat_children(node, state).strip
|
14
14
|
return nil if child_text.empty?
|
15
15
|
|
16
|
-
#
|
17
|
-
|
16
|
+
# Unless the first paragraph ends with "between" and is followed by a
|
17
|
+
# list, don't split
|
18
|
+
first_child = child_text.split("\n").first
|
19
|
+
|
20
|
+
unless (
|
21
|
+
first_child =~ /between:?\s*\Z/ ||
|
22
|
+
first_child =~ /include:?\s*\Z/ ||
|
23
|
+
first_child =~ /of:?\s*\Z/ ||
|
24
|
+
first_child =~ /[:;]\s*\Z/
|
25
|
+
) &&
|
26
|
+
child_text =~ /\n\n\*/
|
27
|
+
|
18
28
|
# Only taking the first paragraph of the definition
|
19
|
-
child_text =
|
29
|
+
child_text = first_child
|
30
|
+
end
|
31
|
+
|
32
|
+
# TEMP: Remove any whitespace (" ", not newlines) after an immediate
|
33
|
+
# newline due to:
|
34
|
+
# https://github.com/metanorma/iso-10303-2/issues/71
|
35
|
+
if child_text =~ /\n\ +/
|
36
|
+
child_text = child_text.gsub(/\n\ +/, "\n")
|
20
37
|
end
|
21
38
|
|
22
39
|
# # Only taking the first sentence
|
@@ -26,10 +43,10 @@ module Stepmod
|
|
26
43
|
|
27
44
|
domain = case linkend.first
|
28
45
|
when /_mim$/, /_arm$/
|
29
|
-
"
|
46
|
+
"ISO 10303 application module"
|
30
47
|
# when /_schema$/
|
31
48
|
else
|
32
|
-
"
|
49
|
+
"ISO 10303 resource"
|
33
50
|
end
|
34
51
|
|
35
52
|
<<~TEMPLATE
|
@@ -8,12 +8,13 @@ module Stepmod
|
|
8
8
|
|
9
9
|
def convert(node, state = {})
|
10
10
|
content = treat_children(node, state.merge(already_strong: true))
|
11
|
+
strong_tag = state[:non_flanking_whitesapce] ? '**' : '*'
|
11
12
|
if content.strip.empty? || state[:already_strong]
|
12
13
|
content
|
13
14
|
else
|
14
15
|
handle_express_escape_seq(
|
15
16
|
node,
|
16
|
-
"#{content[/^\s*/]}
|
17
|
+
"#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}"
|
17
18
|
)
|
18
19
|
end
|
19
20
|
end
|
@@ -17,6 +17,7 @@ require "stepmod/utils/converters/term"
|
|
17
17
|
require "stepmod/utils/converters/synonym"
|
18
18
|
require "stepmod/utils/converters/uof"
|
19
19
|
require "stepmod/utils/converters/figure"
|
20
|
+
require "stepmod/utils/cleaner"
|
20
21
|
|
21
22
|
require "reverse_adoc/converters/a"
|
22
23
|
require "reverse_adoc/converters/blockquote"
|
@@ -56,7 +57,7 @@ module Stepmod
|
|
56
57
|
options)
|
57
58
|
return "" unless result
|
58
59
|
|
59
|
-
|
60
|
+
Stepmod::Utils::Cleaner.new.tidy(result.dup)
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
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.13
|
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
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -215,7 +215,6 @@ files:
|
|
215
215
|
- lib/stepmod/utils/stepmod_file_annotator.rb
|
216
216
|
- lib/stepmod/utils/terms_extractor.rb
|
217
217
|
- lib/stepmod/utils/version.rb
|
218
|
-
- migrating_from_cvs.adoc
|
219
218
|
- resource_example.xml
|
220
219
|
- stepmod-utils.gemspec
|
221
220
|
homepage: https://github.com/metanorma/stepmod-utils
|
data/migrating_from_cvs.adoc
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
= STEPmod CVS to Git import
|
2
|
-
|
3
|
-
== Purpose
|
4
|
-
|
5
|
-
The `cvs/` submodule is a CSV import of STEPmod files from the CVS server hosted at Boost Conseil.
|
6
|
-
|
7
|
-
The goal is to import the CSV-managed files in a way useable via Git, with full history information.
|
8
|
-
|
9
|
-
This guide is used as reference for the usage of `cvs-fast-import`:
|
10
|
-
https://oitofelix.github.io/article-savannah-cvs-to-git-migration/
|
11
|
-
|
12
|
-
|
13
|
-
== Strategy to import
|
14
|
-
|
15
|
-
Cloning a remote CVS repository while importing is super slow,
|
16
|
-
especially for a large repository like STEPmod.
|
17
|
-
|
18
|
-
We have tested and settled on these steps:
|
19
|
-
|
20
|
-
. Maintain a local `rsync` copy of the CVS repository.
|
21
|
-
. Resolve all names from the CVS repository (CVS only stores UNIX usernames, in Git are names and emails) using `cvs-fast-import`.
|
22
|
-
. Run `cvs-fast-import` to import the CVS repository into the `iso-10303-stepmod-cvs` Git repo.
|
23
|
-
|
24
|
-
|
25
|
-
== Creating the `rsync` clone of the CVS repository
|
26
|
-
|
27
|
-
[source,sh]
|
28
|
-
----
|
29
|
-
rsync -avrPz -e ssh ronald@cvs.boost-lab.net:/stepmod/ stepmod-rsync/
|
30
|
-
----
|
31
|
-
|
32
|
-
|
33
|
-
== Install cvs-fast-export
|
34
|
-
|
35
|
-
`cvs-fast-export` only works on Linux.
|
36
|
-
Run it on Ubuntu with the `rsync`'ed CVS directory.
|
37
|
-
|
38
|
-
Install:
|
39
|
-
[source,sh]
|
40
|
-
----
|
41
|
-
$ apt-get -y install cvs-fast-export
|
42
|
-
----
|
43
|
-
|
44
|
-
== Getting all users for email mapping
|
45
|
-
|
46
|
-
Find all authors in the CVS repository using `cvs-fast-export -a`.
|
47
|
-
It is much faster than using the equivalent CVS command to list all authors.
|
48
|
-
|
49
|
-
[source,sh]
|
50
|
-
----
|
51
|
-
$ find stepmod-rsync -type f | cvs-fast-export -a
|
52
|
-
----
|
53
|
-
|
54
|
-
|
55
|
-
== Create fast-import file for Git
|
56
|
-
|
57
|
-
After all authors are mapped, run `cvs-fast-export` to create
|
58
|
-
the import file.
|
59
|
-
|
60
|
-
[source,sh]
|
61
|
-
----
|
62
|
-
$ find stepmod-rsync -type f | cvs-fast-export -A author-map.txt > fast-import-file
|
63
|
-
----
|
64
|
-
|
65
|
-
== Perform the Git fast-import
|
66
|
-
|
67
|
-
Once the fast-import file is created, we can perform the Git import.
|
68
|
-
|
69
|
-
[source,sh]
|
70
|
-
----
|
71
|
-
$ cd iso-10303-stepmod-cvs
|
72
|
-
$ git fast-import < ../fast-import-file
|
73
|
-
----
|
74
|
-
|
75
|
-
|
76
|
-
== Upload the new Git repo
|
77
|
-
|
78
|
-
[source,sh]
|
79
|
-
----
|
80
|
-
git push --all && git push --tags
|
81
|
-
----
|
82
|
-
|
83
|
-
|
84
|
-
== DEPRECATED steps using `git cvsimport` (do not use, it won't work)
|
85
|
-
|
86
|
-
=== General
|
87
|
-
|
88
|
-
https://stackoverflow.com/questions/11362676/how-to-import-and-keep-updated-a-cvs-repository-in-git[This StackOverflow post]
|
89
|
-
describes steps for using `git cvsimport`.
|
90
|
-
|
91
|
-
Originally the `git cvsimport` tool was chosen since it is part of
|
92
|
-
`git`. However, it utilizes a deprecated/unmaintained tool called
|
93
|
-
`cvsps`. The latest `cvsps` is version 3, but only version 2 is
|
94
|
-
compatible with `git cvsimport`.
|
95
|
-
|
96
|
-
In addition, the `cvsps` tool is maintained by the maintainer
|
97
|
-
of `cvs-fast-import`, and is no longer updated.
|
98
|
-
Eventually `cvs-fast-import` is used instead.
|
99
|
-
|
100
|
-
WARNING: This command completely fails
|
101
|
-
on this repository because it is too large and complex.
|
102
|
-
|
103
|
-
|
104
|
-
=== Setup
|
105
|
-
|
106
|
-
On macOS, run the following commands to setup for running the import. The `git` executable must be installed.
|
107
|
-
|
108
|
-
Install `cvsps` version 2.
|
109
|
-
|
110
|
-
NOTE: The steps from the StackOverflow of installing `cvsps` no longer work.
|
111
|
-
|
112
|
-
[source,sh]
|
113
|
-
----
|
114
|
-
$ brew tap Frizlab/Perso
|
115
|
-
# ==> Tapping frizlab/perso
|
116
|
-
# Cloning into '/usr/local/Homebrew/Library/Taps/frizlab/homebrew-perso'...
|
117
|
-
# remote: Enumerating objects: 123, done.
|
118
|
-
# remote: Total 123 (delta 0), reused 0 (delta 0), pack-reused 123
|
119
|
-
# Receiving objects: 100% (123/123), 19.08 KiB | 91.00 KiB/s, done.
|
120
|
-
# Resolving deltas: 100% (43/43), done.
|
121
|
-
# Tapped 1 cask and 10 formulae (38 files, 60.5KB).
|
122
|
-
|
123
|
-
$ brew install cvsps@2
|
124
|
-
# ==> Installing cvsps@2 from frizlab/perso
|
125
|
-
# Warning: A newer Command Line Tools release is available.
|
126
|
-
# Update them from Software Update in System Preferences or
|
127
|
-
# https://developer.apple.com/download/more/.
|
128
|
-
# ==> Downloading https://deb.debian.org/debian/pool/main/c/cvsps/cvsps_2.1.orig.tar.gz
|
129
|
-
######################################################################## 100.0%
|
130
|
-
# ==> make all
|
131
|
-
# ==> make install prefix=/usr/local/Cellar/cvsps@2/2.1
|
132
|
-
# 🍺 /usr/local/Cellar/cvsps@2/2.1: 7 files, 124.6KB, built in 6 seconds
|
133
|
-
----
|
134
|
-
|
135
|
-
Verify it is installed:
|
136
|
-
[source,sh]
|
137
|
-
----
|
138
|
-
$ cvsps -v
|
139
|
-
# Can't open CVS/Root
|
140
|
-
# cannot determine CVSROOT
|
141
|
-
----
|
142
|
-
|
143
|
-
////
|
144
|
-
== Checkout the CVS repository
|
145
|
-
|
146
|
-
First set the `CVSROOT` and `CVS_RSH` variables.
|
147
|
-
|
148
|
-
[source,sh]
|
149
|
-
----
|
150
|
-
export CVSROOT=:ext:ronald@cvs.boost-lab.net:/stepmod
|
151
|
-
export CVS_RSH=ssh
|
152
|
-
cvs checkout stepmod
|
153
|
-
# => stepmod/ is created in $PWD
|
154
|
-
----
|
155
|
-
////
|
156
|
-
|
157
|
-
|
158
|
-
=== Run the import
|
159
|
-
|
160
|
-
Run the import from CVS to Git.
|
161
|
-
|
162
|
-
Go to the directory that will carry the target Git repository.
|
163
|
-
|
164
|
-
Run `git cvsimport`.
|
165
|
-
|
166
|
-
[source,sh]
|
167
|
-
----
|
168
|
-
# Importing from remote
|
169
|
-
$ export CVSROOT=:ext:ronald@cvs.boost-lab.net:/stepmod
|
170
|
-
$ export CVS_RSH=ssh
|
171
|
-
$ git cvsimport -C iso-10303-stepmod-cvs -r cvs -k -v -d $CVSROOT stepmod
|
172
|
-
|
173
|
-
# Importing from local rsync'ed copy
|
174
|
-
$ export CVSROOT=$(pwd)/stepmod-rsync
|
175
|
-
$ git cvsimport -C iso-10303-stepmod-cvs -r cvs -k -v -d $CVSROOT stepmod
|
176
|
-
----
|
177
|
-
|
178
|
-
WARNING: TLDR. Technically this should work, but I ran into a `cvsps cannot allocate memory` error with 64GB of RAM, and not even completing the clone after 24 hours. So I gave up and switched to local. And local still takes a long time with tons of error messages. `cvs-fast-import` only takes 5-10 minutes to import.
|
179
|
-
|
180
|
-
|
181
|
-
=== Updating the CVS import
|
182
|
-
|
183
|
-
Run `git cvsimport` to synchronize the Git repo using updated data from CVS.
|
184
|
-
|
185
|
-
[source,sh]
|
186
|
-
----
|
187
|
-
$ git cvsimport
|
188
|
-
----
|
189
|
-
|
190
|
-
|