stepmod-utils 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cede4c978acf6fd33ac7bae2dd5a0020e8f0e9f5ac06e1562f089dd2aa702ee5
4
- data.tar.gz: d4cdb2bf5abe663d7089c6d74a939fab72b698ef64a3029695cfd467a423f74d
3
+ metadata.gz: bb7bf9af17dc5e00cbaa48dbadcca9866867c666f27454fdcedd05cc10424e77
4
+ data.tar.gz: e082809ce1ba11806170e75ab9e35e4fb32dbf5062b0cc991c52a320adef12d0
5
5
  SHA512:
6
- metadata.gz: 9f9db582dd4c85836ed96c8916024d9cf75c8019a512305634df73af0be3dbe9faf53ea2e8b516afe7417f0c68a50f5b27303d5034cf627fcdbacf4e05a3f1c5
7
- data.tar.gz: 52cd06f6cd0a044d4e904a6daa85d2802a9731b1b2aa13643087b71c60f3c106f67623dca248a00c970f48875faf415776b3f48de74bf51539b6a3c94b9f57f2
6
+ metadata.gz: 8f181ca96460491b225d3f589092af504c18dc684d1d561556ab0504f148e01413566a05a17ccfe7f4de8fd8f6d0b154949d2e7fea3b21d9cd3bbdcf162285df
7
+ data.tar.gz: 6cfe79605d3aa7da7387caf85b1374dec3601eec9880f1740364976feb12b218908635dffc1bc446fc519458856e4a5e55e9fffaca677e3cdbf1c7d0c6b86b4e
@@ -4,7 +4,9 @@ module Stepmod
4
4
  module Utils
5
5
  class Cleaner < ReverseAdoc::Cleaner
6
6
  def tidy(string)
7
- super.gsub(/^ +/, "")
7
+ super
8
+ .gsub(/^ +/, "")
9
+ .gsub(/\*\s([,.])/, '*\1') # remove space between * and comma or dot.
8
10
  end
9
11
  end
10
12
  end
@@ -124,7 +124,7 @@ module Stepmod
124
124
 
125
125
  def to_mn_adoc
126
126
  <<~TEXT
127
- // STEPmod path:#{!file_path.empty? ? " #{file_path}" : ''}
127
+ // STEPmod path:#{file_path.empty? ? '' : " #{file_path}"}
128
128
  #{converted_definition}
129
129
 
130
130
  [.source]
@@ -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
@@ -43,10 +43,10 @@ module Stepmod
43
43
 
44
44
  domain = case linkend.first
45
45
  when /_mim$/, /_arm$/
46
- "STEP module"
46
+ "ISO 10303 application module"
47
47
  # when /_schema$/
48
48
  else
49
- "STEP resource"
49
+ "ISO 10303 resource"
50
50
  end
51
51
 
52
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*/]}*#{content.strip}*#{content[/\s*$/]}"
17
+ "#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}"
17
18
  )
18
19
  end
19
20
  end
@@ -14,7 +14,7 @@ module Stepmod
14
14
  # <<~TEXT
15
15
  # === #{node['name'].strip}
16
16
 
17
- # <STEP module> #{treat_children(node, state).strip}
17
+ # <ISO 10303 application module> #{treat_children(node, state).strip}
18
18
  # TEXT
19
19
  end
20
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
- ReverseAdoc.cleaner.tidy(result.dup)
60
+ Stepmod::Utils::Cleaner.new.tidy(result.dup)
60
61
  end
61
62
  end
62
63
  end
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.3.12".freeze
3
+ VERSION = "0.3.13".freeze
4
4
  end
5
5
  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.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-31 00:00:00.000000000 Z
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,14 +215,13 @@ 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
222
221
  licenses:
223
222
  - BSD-2-Clause
224
223
  metadata: {}
225
- post_install_message:
224
+ post_install_message:
226
225
  rdoc_options: []
227
226
  require_paths:
228
227
  - lib
@@ -237,8 +236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
236
  - !ruby/object:Gem::Version
238
237
  version: '0'
239
238
  requirements: []
240
- rubygems_version: 3.2.22
241
- signing_key:
239
+ rubygems_version: 3.0.3.1
240
+ signing_key:
242
241
  specification_version: 4
243
242
  summary: Stepmod-utils is a toolkit that works on STEPmod data.
244
243
  test_files: []
@@ -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
-