stepmod-utils 0.1.8 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +42 -0
  3. data/.github/workflows/release.yml +23 -20
  4. data/Gemfile +2 -0
  5. data/Makefile +5 -0
  6. data/README.adoc +136 -2
  7. data/exe/stepmod-annotate-all +39 -0
  8. data/exe/stepmod-build-resource-docs-cache +19 -0
  9. data/exe/stepmod-convert-express-description +33 -0
  10. data/exe/stepmod-convert-express-resource +33 -0
  11. data/exe/stepmod-extract-terms +56 -14
  12. data/exe/stepmod-find-express-files +23 -0
  13. data/lib/stepmod/utils/cleaner.rb +11 -0
  14. data/lib/stepmod/utils/converters/a.rb +47 -0
  15. data/lib/stepmod/utils/converters/blockquote.rb +22 -0
  16. data/lib/stepmod/utils/converters/br.rb +15 -0
  17. data/lib/stepmod/utils/converters/bypass.rb +81 -0
  18. data/lib/stepmod/utils/converters/code.rb +19 -0
  19. data/lib/stepmod/utils/converters/comment.rb +16 -0
  20. data/lib/stepmod/utils/converters/dd.rb +15 -0
  21. data/lib/stepmod/utils/converters/def.rb +11 -4
  22. data/lib/stepmod/utils/converters/dl.rb +31 -0
  23. data/lib/stepmod/utils/converters/drop.rb +22 -0
  24. data/lib/stepmod/utils/converters/dt.rb +17 -0
  25. data/lib/stepmod/utils/converters/em_express_description.rb +22 -0
  26. data/lib/stepmod/utils/converters/eqn.rb +97 -0
  27. data/lib/stepmod/utils/converters/example.rb +1 -6
  28. data/lib/stepmod/utils/converters/express_g.rb +49 -0
  29. data/lib/stepmod/utils/converters/express_ref_express_description.rb +13 -0
  30. data/lib/stepmod/utils/converters/ext_description.rb +17 -0
  31. data/lib/stepmod/utils/converters/ext_descriptions.rb +14 -0
  32. data/lib/stepmod/utils/converters/fund_cons.rb +21 -0
  33. data/lib/stepmod/utils/converters/head.rb +22 -0
  34. data/lib/stepmod/utils/converters/hr.rb +15 -0
  35. data/lib/stepmod/utils/converters/ignore.rb +16 -0
  36. data/lib/stepmod/utils/converters/introduction.rb +15 -0
  37. data/lib/stepmod/utils/converters/note.rb +1 -6
  38. data/lib/stepmod/utils/converters/ol.rb +3 -2
  39. data/lib/stepmod/utils/converters/p.rb +21 -0
  40. data/lib/stepmod/utils/converters/pass_through.rb +13 -0
  41. data/lib/stepmod/utils/converters/q.rb +16 -0
  42. data/lib/stepmod/utils/converters/resource.rb +14 -0
  43. data/lib/stepmod/utils/converters/schema.rb +19 -0
  44. data/lib/stepmod/utils/converters/schema_diag.rb +14 -0
  45. data/lib/stepmod/utils/converters/strong.rb +41 -0
  46. data/lib/stepmod/utils/converters/sub.rb +24 -0
  47. data/lib/stepmod/utils/converters/sup.rb +22 -0
  48. data/lib/stepmod/utils/converters/table.rb +62 -0
  49. data/lib/stepmod/utils/converters/text.rb +68 -0
  50. data/lib/stepmod/utils/html_to_asciimath.rb +157 -0
  51. data/lib/stepmod/utils/smrl_description_converter.rb +49 -0
  52. data/lib/stepmod/utils/smrl_resource_converter.rb +67 -0
  53. data/lib/stepmod/utils/stepmod_file_annotator.rb +78 -0
  54. data/lib/stepmod/utils/version.rb +1 -1
  55. data/migrating_from_cvs.adoc +190 -0
  56. data/stepmod-utils.gemspec +2 -0
  57. metadata +84 -9
  58. data/.github/workflows/macos.yml +0 -39
  59. data/.github/workflows/ubuntu.yml +0 -53
  60. data/.github/workflows/windows.yml +0 -41
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.1.8"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
@@ -0,0 +1,190 @@
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
+
@@ -31,5 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_runtime_dependency "thor", ">= 0.20.3"
33
33
  spec.add_runtime_dependency "reverse_adoc", ">= 0.2.9"
34
+ spec.add_runtime_dependency "ptools", '~> 1.3'
35
+ spec.add_runtime_dependency "concurrent-ruby"
34
36
  spec.add_development_dependency "byebug", "~> 11.1"
35
37
  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.1.8
4
+ version: 0.2.6
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: 2020-07-07 00:00:00.000000000 Z
11
+ date: 2021-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.2.9
41
+ - !ruby/object:Gem::Dependency
42
+ name: ptools
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: byebug
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -58,47 +86,94 @@ description: 'Stepmod-utils is a toolkit that works on STEPmod data.
58
86
  email:
59
87
  - open.source@ribose.com
60
88
  executables:
89
+ - stepmod-annotate-all
90
+ - stepmod-build-resource-docs-cache
91
+ - stepmod-convert-express-description
92
+ - stepmod-convert-express-resource
61
93
  - stepmod-extract-terms
94
+ - stepmod-find-express-files
62
95
  extensions: []
63
96
  extra_rdoc_files: []
64
97
  files:
65
- - ".github/workflows/macos.yml"
98
+ - ".github/workflows/rake.yml"
66
99
  - ".github/workflows/release.yml"
67
- - ".github/workflows/ubuntu.yml"
68
- - ".github/workflows/windows.yml"
69
100
  - ".gitignore"
70
101
  - ".rspec"
71
102
  - CODE_OF_CONDUCT.md
72
103
  - Gemfile
104
+ - Makefile
73
105
  - README.adoc
74
106
  - Rakefile
75
107
  - bin/console
76
108
  - bin/setup
109
+ - exe/stepmod-annotate-all
110
+ - exe/stepmod-build-resource-docs-cache
111
+ - exe/stepmod-convert-express-description
112
+ - exe/stepmod-convert-express-resource
77
113
  - exe/stepmod-extract-terms
114
+ - exe/stepmod-find-express-files
78
115
  - lib/stepmod/utils.rb
79
116
  - lib/stepmod/utils/bibdata.rb
117
+ - lib/stepmod/utils/cleaner.rb
80
118
  - lib/stepmod/utils/concept.rb
119
+ - lib/stepmod/utils/converters/a.rb
120
+ - lib/stepmod/utils/converters/blockquote.rb
121
+ - lib/stepmod/utils/converters/br.rb
122
+ - lib/stepmod/utils/converters/bypass.rb
81
123
  - lib/stepmod/utils/converters/clause_ref.rb
124
+ - lib/stepmod/utils/converters/code.rb
125
+ - lib/stepmod/utils/converters/comment.rb
126
+ - lib/stepmod/utils/converters/dd.rb
82
127
  - lib/stepmod/utils/converters/def.rb
83
128
  - lib/stepmod/utils/converters/definition.rb
129
+ - lib/stepmod/utils/converters/dl.rb
130
+ - lib/stepmod/utils/converters/drop.rb
131
+ - lib/stepmod/utils/converters/dt.rb
84
132
  - lib/stepmod/utils/converters/em.rb
133
+ - lib/stepmod/utils/converters/em_express_description.rb
134
+ - lib/stepmod/utils/converters/eqn.rb
85
135
  - lib/stepmod/utils/converters/example.rb
136
+ - lib/stepmod/utils/converters/express_g.rb
86
137
  - lib/stepmod/utils/converters/express_ref.rb
138
+ - lib/stepmod/utils/converters/express_ref_express_description.rb
139
+ - lib/stepmod/utils/converters/ext_description.rb
140
+ - lib/stepmod/utils/converters/ext_descriptions.rb
141
+ - lib/stepmod/utils/converters/fund_cons.rb
142
+ - lib/stepmod/utils/converters/head.rb
143
+ - lib/stepmod/utils/converters/hr.rb
144
+ - lib/stepmod/utils/converters/ignore.rb
145
+ - lib/stepmod/utils/converters/introduction.rb
87
146
  - lib/stepmod/utils/converters/module_ref.rb
88
147
  - lib/stepmod/utils/converters/note.rb
89
148
  - lib/stepmod/utils/converters/ol.rb
149
+ - lib/stepmod/utils/converters/p.rb
150
+ - lib/stepmod/utils/converters/pass_through.rb
151
+ - lib/stepmod/utils/converters/q.rb
152
+ - lib/stepmod/utils/converters/resource.rb
153
+ - lib/stepmod/utils/converters/schema.rb
154
+ - lib/stepmod/utils/converters/schema_diag.rb
90
155
  - lib/stepmod/utils/converters/stem.rb
156
+ - lib/stepmod/utils/converters/strong.rb
157
+ - lib/stepmod/utils/converters/sub.rb
158
+ - lib/stepmod/utils/converters/sup.rb
91
159
  - lib/stepmod/utils/converters/synonym.rb
160
+ - lib/stepmod/utils/converters/table.rb
92
161
  - lib/stepmod/utils/converters/term.rb
162
+ - lib/stepmod/utils/converters/text.rb
163
+ - lib/stepmod/utils/html_to_asciimath.rb
164
+ - lib/stepmod/utils/smrl_description_converter.rb
165
+ - lib/stepmod/utils/smrl_resource_converter.rb
93
166
  - lib/stepmod/utils/stepmod_definition_converter.rb
167
+ - lib/stepmod/utils/stepmod_file_annotator.rb
94
168
  - lib/stepmod/utils/version.rb
169
+ - migrating_from_cvs.adoc
95
170
  - resource_example.xml
96
171
  - stepmod-utils.gemspec
97
172
  homepage: https://github.com/metanorma/stepmod-utils
98
173
  licenses:
99
174
  - BSD-2-Clause
100
175
  metadata: {}
101
- post_install_message:
176
+ post_install_message:
102
177
  rdoc_options: []
103
178
  require_paths:
104
179
  - lib
@@ -113,8 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
188
  - !ruby/object:Gem::Version
114
189
  version: '0'
115
190
  requirements: []
116
- rubygems_version: 3.0.3
117
- signing_key:
191
+ rubygems_version: 3.1.6
192
+ signing_key:
118
193
  specification_version: 4
119
194
  summary: Stepmod-utils is a toolkit that works on STEPmod data.
120
195
  test_files: []
@@ -1,39 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/ubuntu.yml
11
- - .github/workflows/windows.yml
12
-
13
- jobs:
14
- test-macos:
15
- name: Test on Ruby ${{ matrix.ruby }} macOS
16
- runs-on: macos-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Use Ruby
29
- uses: actions/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- architecture: 'x64'
33
- - name: Update gems
34
- run: |
35
- sudo gem install bundler --force
36
- bundle install --jobs 4 --retry 3
37
- - name: Run specs
38
- run: |
39
- bundle exec rake
@@ -1,53 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- tags:
9
- - '*'
10
- pull_request:
11
- paths-ignore:
12
- - .github/workflows/macos.yml
13
- - .github/workflows/windows.yml
14
-
15
- jobs:
16
- test-linux:
17
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
18
- runs-on: ubuntu-latest
19
- continue-on-error: ${{ matrix.experimental }}
20
- strategy:
21
- fail-fast: false
22
- matrix:
23
- ruby: [ '2.6', '2.5', '2.4' ]
24
- experimental: [false]
25
- include:
26
- - ruby: '2.7'
27
- experimental: true
28
- steps:
29
- - uses: actions/checkout@master
30
- - name: Use Ruby
31
- uses: actions/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- architecture: 'x64'
35
- - name: Update gems
36
- run: |
37
- gem install bundler
38
- bundle install --jobs 4 --retry 3
39
- - name: Run specs
40
- run: |
41
- bundle exec rake
42
- - name: Trigger dependent repositories
43
- if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
44
- env:
45
- GH_USERNAME: ${{ secrets.PAT_USERNAME }}
46
- GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
47
- run: |
48
- curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
49
- [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
50
- for repo in $DEPENDENT_REPOS
51
- do
52
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
53
- done