stepmod-utils 0.4.5 → 0.4.7

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: 5b2f0b9f05434375d9b8fe91885488cc3efc712b2188aac852e02fd58d5a5809
4
- data.tar.gz: d7a9244861b65696173a61cc46bfd70739b50beefd184612b07f10e24ab2207a
3
+ metadata.gz: fb9578dd41ed9730c2c5821debb5a29f405741f12d5f5838a7547145abfbf3f2
4
+ data.tar.gz: 2c019e36f6a2ada973ef012bda7a41a50d57d391fceabfa9b613e6c96b29b238
5
5
  SHA512:
6
- metadata.gz: 64610bbd1d253e7d3dab575d4bb4a16059633a0526009bde73e867aed7fa873281a0256ed188f917737167d32362dbca80448169067c3f0634533323afeb8156
7
- data.tar.gz: a4e39cdac5b8fea94d28ca2683cd662efc5eb9273e12371ca74e524bf6d65f4c45ea9aac38a59ea233665c6ff79fb19448639adbf93ed7ea8313767cdd0bd403
6
+ metadata.gz: 5f452f78f0d2ad725a03643561315373be8b3b70cad58b75d0728a8ea256b4a0563c8c8380ae84c991cec7788bffd84355573d51885105b3c2ec961f91c93a59
7
+ data.tar.gz: f9440eed18984579c7ba222d7ff32609a46528ebee9d76b650245c20463a8d5f5a27b67000402f653d9ecc7076a21e5330feafb1771f2919651c1241f0980054
@@ -26,11 +26,18 @@ jobs:
26
26
  token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
27
27
  path: iso-10303-stepmod-wg12
28
28
 
29
+ - name: Generate Folders for schemas
30
+ run: mkdir schemas
31
+
32
+ - name: Generate Folders for documents
33
+ run: mkdir documents
34
+
29
35
  - name: Generate Annotated EXPRESS files
30
36
  run: |
31
37
  bundle exec stepmod-annotate-all \
32
38
  --stepmod-dir ./iso-10303-stepmod-wg12 \
33
- --output schemas
39
+ --schemas schemas \
40
+ --documents documents
34
41
 
35
42
  - name: Generate Concept YAML files
36
43
  working-directory: iso-10303-stepmod-wg12
@@ -25,13 +25,21 @@ OptionParser.new do |opts|
25
25
  end
26
26
 
27
27
  opts.on(
28
- "--output SRL_SCHEMAS_DIR",
28
+ "--schemas SRL_SCHEMAS_DIR",
29
29
  String,
30
30
  "Path to output SRL schemas",
31
31
  ) do |path|
32
32
  options[:srl_output_schemas_dir] = path
33
33
  end
34
34
 
35
+ opts.on(
36
+ "--documents SRL_DOCS_DIR",
37
+ String,
38
+ "Path to SRL documents (generated by stepmod2mn)",
39
+ ) do |path|
40
+ options[:srl_output_docs_dir] = path
41
+ end
42
+
35
43
  opts.on_tail("-h", "--help", "Show this message") do
36
44
  puts opts
37
45
  exit
@@ -48,9 +56,17 @@ end
48
56
  log "STEPmod data path: `#{stepmod_dir}`"
49
57
 
50
58
  srl_output_schemas_dir = options[:srl_output_schemas_dir]
51
- raise StandardError.new("--output directory for SRL schemas not set") unless srl_output_schemas_dir
59
+ raise StandardError.new("--schemas directory for SRL schemas not set") unless srl_output_schemas_dir
52
60
  log "SRL schemas output path: `#{srl_output_schemas_dir}`"
53
61
 
62
+ srl_output_docs_dir = options[:srl_output_docs_dir]
63
+ raise StandardError.new("--documents directory for SRL documents (generated by stepmod2mn) not set") unless srl_output_docs_dir
64
+ log "SRL documents path: `#{srl_output_docs_dir}`"
65
+
66
+ unless File.exist?(srl_output_docs_dir) && File.directory?(srl_output_docs_dir)
67
+ raise StandardError.new("--documents directory for SRL documents (generated by stepmod2mn) does not exist yet, please run stepmod2mn")
68
+ end
69
+
54
70
  def all_express_files(stepmod_dir)
55
71
  index_file = File.read(File.join(stepmod_dir, "repository_index.xml"))
56
72
  index = Nokogiri::XML(index_file).root
@@ -113,6 +129,9 @@ files = all_express_files(stepmod_dir)
113
129
  filename_cache = {}
114
130
 
115
131
  FileUtils.mkdir_p(srl_output_schemas_dir)
132
+ srl_output_schemas_path = Pathname.new(srl_output_schemas_dir)
133
+ srl_output_docs_path = Pathname.new(srl_output_docs_dir)
134
+
116
135
 
117
136
  files.each do |file|
118
137
  puts "#{Thread.current.object_id}: `#{file}` processing..."
@@ -125,7 +144,6 @@ files.each do |file|
125
144
  destination_rel_path = Pathname.new(file).dirname.relative_path_from(stepmod_path.join("data"))
126
145
  directory_type = destination_rel_path.each_filename.to_a.first
127
146
 
128
- srl_output_schemas_path = Pathname.new(srl_output_schemas_dir)
129
147
  destination_path = srl_output_schemas_path.join(destination_rel_path)
130
148
  FileUtils.mkdir_p(destination_path)
131
149
 
@@ -151,7 +169,7 @@ files.each do |file|
151
169
 
152
170
  puts "#{Thread.current.object_id}: Copy image NOT FOUND at schema path: `#{source_file}`, trying glob..."
153
171
 
154
- source_path = srl_output_schemas_path.glob("**/#{source_file}").first
172
+ source_path = (srl_output_schemas_path.glob("**/#{source_file}") + srl_output_docs_path.glob("**/#{source_file}")).first
155
173
  if source_path
156
174
  puts "EXISTS" if source_path.exist?
157
175
  system_source_path = file_system_path(source_path.to_s, filename_cache)
@@ -60,6 +60,7 @@ module Stepmod
60
60
  #{remove_trash_symbols(content.strip)}
61
61
  ++++
62
62
 
63
+
63
64
  TEMPLATE
64
65
  res = "[[#{cloned_node['id']}]]\n#{res}" if cloned_node["id"]&.length&.positive?
65
66
  res
@@ -10,6 +10,7 @@ module Stepmod
10
10
 
11
11
  <<~TEMPLATE
12
12
 
13
+
13
14
  [example]
14
15
  ====
15
16
  #{treat_children(node, state).strip}
@@ -6,6 +6,7 @@ module Stepmod
6
6
  class ExpressNote < ReverseAdoc::Converters::Base
7
7
  def convert(node, state = {})
8
8
  <<~TEMPLATE
9
+
9
10
  (*"#{state[:schema_and_entity]}.__note"
10
11
  #{treat_children(node, state).strip}
11
12
  *)
@@ -6,7 +6,6 @@ module Stepmod
6
6
  module Utils
7
7
  module Converters
8
8
  class Figure < ReverseAdoc::Converters::Figure
9
-
10
9
  def self.pattern(state, id)
11
10
  if state[:schema_and_entity].nil?
12
11
  raise StandardError.new("[figure]: no state given, #{id}")
@@ -10,6 +10,7 @@ module Stepmod
10
10
 
11
11
  <<~TEMPLATE
12
12
 
13
+
13
14
  [NOTE]
14
15
  --
15
16
  #{treat_children(node, state).strip}
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.4.5".freeze
3
+ VERSION = "0.4.7".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.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-09 00:00:00.000000000 Z
11
+ date: 2023-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby