expressir 1.3.0.pre.1-x86_64-linux-gnu

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +7 -0
  2. data/.cross_rubies +20 -0
  3. data/.github/workflows/rake.yml +312 -0
  4. data/.github/workflows/release.yml +124 -0
  5. data/.gitignore +23 -0
  6. data/.gitmodules +6 -0
  7. data/.hound.yml +3 -0
  8. data/.rspec +2 -0
  9. data/.rubocop.yml +18 -0
  10. data/.yardopts +11 -0
  11. data/Gemfile +4 -0
  12. data/README.adoc +155 -0
  13. data/Rakefile +17 -0
  14. data/bin/console +11 -0
  15. data/bin/rspec +29 -0
  16. data/bin/setup +8 -0
  17. data/docs/development.md +90 -0
  18. data/exe/expressir +22 -0
  19. data/exe/format +18 -0
  20. data/exe/format-test +81 -0
  21. data/exe/generate-parser +51 -0
  22. data/expressir.gemspec +48 -0
  23. data/lib/expressir/cli/ui.rb +36 -0
  24. data/lib/expressir/cli.rb +21 -0
  25. data/lib/expressir/config.rb +23 -0
  26. data/lib/expressir/express/2.7/express_parser.so +0 -0
  27. data/lib/expressir/express/3.0/express_parser.so +0 -0
  28. data/lib/expressir/express/3.1/express_parser.so +0 -0
  29. data/lib/expressir/express/3.2/express_parser.so +0 -0
  30. data/lib/expressir/express/cache.rb +51 -0
  31. data/lib/expressir/express/extension.rb +30 -0
  32. data/lib/expressir/express/formatter.rb +1608 -0
  33. data/lib/expressir/express/hyperlink_formatter.rb +36 -0
  34. data/lib/expressir/express/model_visitor.rb +24 -0
  35. data/lib/expressir/express/parser.rb +79 -0
  36. data/lib/expressir/express/resolve_references_model_visitor.rb +31 -0
  37. data/lib/expressir/express/schema_head_formatter.rb +23 -0
  38. data/lib/expressir/express/visitor.rb +2581 -0
  39. data/lib/expressir/model/cache.rb +17 -0
  40. data/lib/expressir/model/data_type.rb +9 -0
  41. data/lib/expressir/model/data_types/aggregate.rb +31 -0
  42. data/lib/expressir/model/data_types/array.rb +31 -0
  43. data/lib/expressir/model/data_types/bag.rb +25 -0
  44. data/lib/expressir/model/data_types/binary.rb +22 -0
  45. data/lib/expressir/model/data_types/boolean.rb +10 -0
  46. data/lib/expressir/model/data_types/enumeration.rb +25 -0
  47. data/lib/expressir/model/data_types/enumeration_item.rb +26 -0
  48. data/lib/expressir/model/data_types/generic.rb +26 -0
  49. data/lib/expressir/model/data_types/generic_entity.rb +26 -0
  50. data/lib/expressir/model/data_types/integer.rb +10 -0
  51. data/lib/expressir/model/data_types/list.rb +28 -0
  52. data/lib/expressir/model/data_types/logical.rb +10 -0
  53. data/lib/expressir/model/data_types/number.rb +10 -0
  54. data/lib/expressir/model/data_types/real.rb +19 -0
  55. data/lib/expressir/model/data_types/select.rb +28 -0
  56. data/lib/expressir/model/data_types/set.rb +25 -0
  57. data/lib/expressir/model/data_types/string.rb +22 -0
  58. data/lib/expressir/model/declaration.rb +9 -0
  59. data/lib/expressir/model/declarations/attribute.rb +47 -0
  60. data/lib/expressir/model/declarations/constant.rb +34 -0
  61. data/lib/expressir/model/declarations/entity.rb +53 -0
  62. data/lib/expressir/model/declarations/function.rb +67 -0
  63. data/lib/expressir/model/declarations/interface.rb +28 -0
  64. data/lib/expressir/model/declarations/interface_item.rb +23 -0
  65. data/lib/expressir/model/declarations/interfaced_item.rb +37 -0
  66. data/lib/expressir/model/declarations/parameter.rb +34 -0
  67. data/lib/expressir/model/declarations/procedure.rb +64 -0
  68. data/lib/expressir/model/declarations/remark_item.rb +21 -0
  69. data/lib/expressir/model/declarations/rule.rb +71 -0
  70. data/lib/expressir/model/declarations/schema.rb +117 -0
  71. data/lib/expressir/model/declarations/schema_version.rb +22 -0
  72. data/lib/expressir/model/declarations/schema_version_item.rb +22 -0
  73. data/lib/expressir/model/declarations/subtype_constraint.rb +40 -0
  74. data/lib/expressir/model/declarations/type.rb +45 -0
  75. data/lib/expressir/model/declarations/unique_rule.rb +31 -0
  76. data/lib/expressir/model/declarations/variable.rb +34 -0
  77. data/lib/expressir/model/declarations/where_rule.rb +31 -0
  78. data/lib/expressir/model/expression.rb +9 -0
  79. data/lib/expressir/model/expressions/aggregate_initializer.rb +19 -0
  80. data/lib/expressir/model/expressions/aggregate_initializer_item.rb +22 -0
  81. data/lib/expressir/model/expressions/binary_expression.rb +53 -0
  82. data/lib/expressir/model/expressions/entity_constructor.rb +22 -0
  83. data/lib/expressir/model/expressions/function_call.rb +22 -0
  84. data/lib/expressir/model/expressions/interval.rb +34 -0
  85. data/lib/expressir/model/expressions/query_expression.rb +35 -0
  86. data/lib/expressir/model/expressions/unary_expression.rb +27 -0
  87. data/lib/expressir/model/identifier.rb +34 -0
  88. data/lib/expressir/model/literal.rb +9 -0
  89. data/lib/expressir/model/literals/binary.rb +19 -0
  90. data/lib/expressir/model/literals/integer.rb +19 -0
  91. data/lib/expressir/model/literals/logical.rb +23 -0
  92. data/lib/expressir/model/literals/real.rb +19 -0
  93. data/lib/expressir/model/literals/string.rb +22 -0
  94. data/lib/expressir/model/model_element.rb +208 -0
  95. data/lib/expressir/model/reference.rb +9 -0
  96. data/lib/expressir/model/references/attribute_reference.rb +22 -0
  97. data/lib/expressir/model/references/group_reference.rb +22 -0
  98. data/lib/expressir/model/references/index_reference.rb +27 -0
  99. data/lib/expressir/model/references/simple_reference.rb +24 -0
  100. data/lib/expressir/model/repository.rb +23 -0
  101. data/lib/expressir/model/statement.rb +9 -0
  102. data/lib/expressir/model/statements/alias.rb +35 -0
  103. data/lib/expressir/model/statements/assignment.rb +22 -0
  104. data/lib/expressir/model/statements/case.rb +25 -0
  105. data/lib/expressir/model/statements/case_action.rb +22 -0
  106. data/lib/expressir/model/statements/compound.rb +19 -0
  107. data/lib/expressir/model/statements/escape.rb +10 -0
  108. data/lib/expressir/model/statements/if.rb +25 -0
  109. data/lib/expressir/model/statements/null.rb +10 -0
  110. data/lib/expressir/model/statements/procedure_call.rb +22 -0
  111. data/lib/expressir/model/statements/repeat.rb +47 -0
  112. data/lib/expressir/model/statements/return.rb +19 -0
  113. data/lib/expressir/model/statements/skip.rb +10 -0
  114. data/lib/expressir/model/supertype_expression.rb +9 -0
  115. data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +29 -0
  116. data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +19 -0
  117. data/lib/expressir/model.rb +79 -0
  118. data/lib/expressir/version.rb +3 -0
  119. data/lib/expressir.rb +24 -0
  120. data/rakelib/antlr4-native.rake +161 -0
  121. data/rakelib/cross-ruby.rake +383 -0
  122. data/spec/acceptance/version_spec.rb +27 -0
  123. data/spec/expressir/express/cache_spec.rb +89 -0
  124. data/spec/expressir/express/formatter_spec.rb +173 -0
  125. data/spec/expressir/express/parser_spec.rb +141 -0
  126. data/spec/expressir/model/model_element_spec.rb +318 -0
  127. data/spec/spec_helper.rb +24 -0
  128. data/spec/support/console_helper.rb +29 -0
  129. data/spec/syntax/multiple.exp +23 -0
  130. data/spec/syntax/multiple.yaml +198 -0
  131. data/spec/syntax/multiple_formatted.exp +71 -0
  132. data/spec/syntax/multiple_hyperlink_formatted.exp +71 -0
  133. data/spec/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
  134. data/spec/syntax/remark.exp +193 -0
  135. data/spec/syntax/remark.yaml +471 -0
  136. data/spec/syntax/remark_formatted.exp +228 -0
  137. data/spec/syntax/single.exp +4 -0
  138. data/spec/syntax/single.yaml +18 -0
  139. data/spec/syntax/single_formatted.exp +10 -0
  140. data/spec/syntax/single_formatted.yaml +36 -0
  141. data/spec/syntax/syntax.exp +333 -0
  142. data/spec/syntax/syntax.yaml +3509 -0
  143. data/spec/syntax/syntax_formatted.exp +902 -0
  144. data/spec/syntax/syntax_hyperlink_formatted.exp +902 -0
  145. data/spec/syntax/syntax_schema_head_formatted.exp +18 -0
  146. metadata +391 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2472c4714128b4739caeb224ec35b308bb3cd46cbfc3a06a72225d25840de5a6
4
+ data.tar.gz: d38d4a11d33b40020a1bea67fe9be4498a251af7d2fcbff929728c47720b9a9b
5
+ SHA512:
6
+ metadata.gz: a551137e16a1f34466bfbdeb83ed52a353e1bcea5c6e5589a4399938f9e550ba31bd11b472454f374406be67e33b40e1bb62e4d5bb435d0cbf85c1aebc6afbfd
7
+ data.tar.gz: 6ab692cb98aaa63f933956129cb2d5406695f4fcf088efa0cba432782a2c2dcf116ec308cdb38fbe5213258f6eb479e63efc4957d6fd130ebb2a1ea9a877aa28
data/.cross_rubies ADDED
@@ -0,0 +1,20 @@
1
+ 3.2.0:x86_64-w64-mingw32
2
+ 3.2.0:x86_64-linux-gnu
3
+ 3.2.0:aarch64-linux-gnu
4
+ 3.2.0:x86_64-darwin
5
+ 3.2.0:arm64-darwin
6
+ 3.1.0:x86_64-w64-mingw32
7
+ 3.1.0:x86_64-linux-gnu
8
+ 3.1.0:aarch64-linux-gnu
9
+ 3.1.0:x86_64-darwin
10
+ 3.1.0:arm64-darwin
11
+ 3.0.0:x86_64-w64-mingw32
12
+ 3.0.0:x86_64-linux-gnu
13
+ 3.0.0:aarch64-linux-gnu
14
+ 3.0.0:x86_64-darwin
15
+ 3.0.0:arm64-darwin
16
+ 2.7.0:x86_64-w64-mingw32
17
+ 2.7.0:x86_64-linux-gnu
18
+ 2.7.0:aarch64-linux-gnu
19
+ 2.7.0:x86_64-darwin
20
+ 2.7.0:arm64-darwin
@@ -0,0 +1,312 @@
1
+ name: rake
2
+
3
+ on:
4
+ push:
5
+ branches: [ master, main ]
6
+ paths-ignore:
7
+ - 'docs/**'
8
+ - '**.adoc'
9
+ - '**.md'
10
+ - .github/workflows/alpine.yml
11
+ - .github/workflows/release.yml
12
+ pull_request:
13
+ workflow_dispatch:
14
+
15
+ concurrency:
16
+ group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
17
+ cancel-in-progress: true
18
+
19
+ env:
20
+ BUNDLER_VER: 2.4.22
21
+ # Forcing bundler version to ensure that it is consistent everywhere and
22
+ # does not cause bundler gem reinstalls
23
+ # bundler/rubygems 2.3.22 is a minimal requirement to support gnu/musl differentiation
24
+ # https://github.com/rubygems/rubygems/pull/4488
25
+
26
+ jobs:
27
+ rubocop:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - name: Checkout
31
+ uses: actions/checkout@v4
32
+ with:
33
+ submodules: recursive
34
+
35
+ - name: Install Ruby
36
+ uses: ruby/setup-ruby@master
37
+ with:
38
+ ruby-version: 3.1
39
+ bundler: ${{ env.BUNDLER_VER }}
40
+ bundler-cache: true
41
+
42
+ - name: Bundle
43
+ run: bundle install --jobs 4 --retry 3
44
+
45
+ - name: Rubocop
46
+ run: bundle exec rake rubocop
47
+
48
+ rake:
49
+ name: test on ruby-${{ matrix.ruby }} ${{ matrix.os }}
50
+ runs-on: ${{ matrix.os }}
51
+ strategy:
52
+ fail-fast: false
53
+ matrix:
54
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
55
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
56
+
57
+ steps:
58
+ - name: Checkout
59
+ uses: actions/checkout@v4
60
+ with:
61
+ submodules: recursive
62
+
63
+ - name: Setup packages
64
+ if: startsWith(matrix.os, 'macos')
65
+ run: brew install autoconf automake libtool
66
+
67
+ - name: Install Ruby
68
+ uses: ruby/setup-ruby@master
69
+ with:
70
+ ruby-version: ${{ matrix.ruby }}
71
+ bundler: ${{ env.BUNDLER_VER }}
72
+ bundler-cache: true
73
+
74
+ - name: Process cache
75
+ uses: actions/cache@v3
76
+ id: cache
77
+ with:
78
+ path: lib/expressir/express/express_parser.*
79
+ key: v4-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('ext/express-parser/extconf.rb', 'ext/express-parser/antlrgen/**', 'ext/express-parser/express_parser.cpp', '.git/modules/ext/express-parser/antlr4-upstream/HEAD') }}
80
+
81
+ - name: Build native extension
82
+ if: steps.cache.outputs.cache-hit != 'true'
83
+ run: bundle exec rake compile
84
+
85
+ - name: Run tests
86
+ run: |
87
+ bundle exec rake
88
+ cat .rspec_status
89
+
90
+ # test release workflow
91
+ pack-ruby:
92
+ runs-on: ubuntu-latest
93
+ steps:
94
+ - name: Checkout
95
+ uses: actions/checkout@v4
96
+ with:
97
+ submodules: recursive
98
+
99
+ - name: Setup Ruby
100
+ uses: ruby/setup-ruby@master
101
+ with:
102
+ ruby-version: '3.0'
103
+ # bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
104
+ # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
105
+ bundler: ${{ env.BUNDLER_VER }}
106
+
107
+ - name: Bundle
108
+ run: bundle install --jobs 4 --retry 3
109
+
110
+ - name: Build gem without native extension
111
+ run: gem build expressir.gemspec
112
+
113
+ - name: Package gem without native extension
114
+ uses: actions/upload-artifact@v3
115
+ with:
116
+ name: pkg-ruby
117
+ path: expressir-*.gem
118
+
119
+ pack:
120
+ runs-on: ubuntu-latest
121
+ strategy:
122
+ fail-fast: false
123
+ matrix:
124
+ platform: [ linux-gnu, windows, darwin ]
125
+ steps:
126
+ - name: Checkout
127
+ uses: actions/checkout@v4
128
+ with:
129
+ submodules: recursive
130
+
131
+ - name: Setup Ruby
132
+ uses: ruby/setup-ruby@master
133
+ with:
134
+ ruby-version: '3.0'
135
+ # bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
136
+ # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
137
+ bundler: ${{ env.BUNDLER_VER }}
138
+
139
+ - name: Bundle
140
+ run: bundle install --jobs 4 --retry 3
141
+
142
+ - name: Enable swap
143
+ run: |
144
+ sudo fallocate -l 15g /compile.swap
145
+ sudo chmod 600 /compile.swap
146
+ sudo mkswap /compile.swap
147
+ sudo swapon /compile.swap
148
+ sudo swapon --all --verbose
149
+
150
+ - name: Build gem with native extension
151
+ run: bundle exec rake gem:${{ matrix.platform }}
152
+
153
+ - name: Package gem with native extension
154
+ uses: actions/upload-artifact@v3
155
+ with:
156
+ name: pkg-${{ matrix.platform }}
157
+ path: pkg/*.gem
158
+
159
+ verify-ruby:
160
+ name: verify ruby gem on ruby-${{ matrix.ruby }} ${{ matrix.os }}
161
+ needs: pack-ruby
162
+ runs-on: ${{ matrix.os }}
163
+ strategy:
164
+ fail-fast: false
165
+ matrix:
166
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
167
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
168
+ steps:
169
+ - name: Install Ruby
170
+ uses: ruby/setup-ruby@master
171
+ with:
172
+ ruby-version: ${{ matrix.ruby }}
173
+ bundler-cache: true
174
+ bundler: ${{ env.BUNDLER_VER }}
175
+
176
+ - name: Checkout
177
+ uses: actions/checkout@v4
178
+ with:
179
+ submodules: recursive
180
+
181
+ - name: Bundle
182
+ run: bundle install --jobs 4 --retry 3
183
+
184
+ - name: Download packaged gem
185
+ uses: actions/download-artifact@v3
186
+ with:
187
+ name: pkg-ruby
188
+ path: pkg
189
+
190
+ - name: Install gem
191
+ run: gem install -l pkg/expressir-*.gem
192
+
193
+ - name: Verify
194
+ run: |
195
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
196
+ ruby bin/rspec
197
+ cat .rspec_status || echo ".rspec_status was not found"
198
+
199
+ verify-darwin:
200
+ name: verify MacOS binary gem on ruby-${{ matrix.ruby }}
201
+ needs: pack
202
+ runs-on: macos-latest
203
+ strategy:
204
+ fail-fast: false
205
+ matrix:
206
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
207
+ steps:
208
+ - name: Install Ruby
209
+ uses: ruby/setup-ruby@master
210
+ with:
211
+ ruby-version: ${{ matrix.ruby }}
212
+ bundler-cache: true
213
+ bundler: ${{ env.BUNDLER_VER }}
214
+
215
+ - name: Checkout
216
+ uses: actions/checkout@v4
217
+
218
+ - name: Bundle
219
+ run: bundle install --jobs 4 --retry 3
220
+
221
+ - name: Download packaged gem
222
+ uses: actions/download-artifact@v3
223
+ with:
224
+ name: pkg-darwin
225
+ path: pkg
226
+
227
+ - name: Install binary gem
228
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM.sub(/darwin\d{2}$/, 'darwin')").gem
229
+ # MacOS with have something like x86_64-darwin19, others just x86_64-linux
230
+
231
+ - name: Verify
232
+ run: |
233
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
234
+ ruby bin/rspec
235
+ cat .rspec_status || echo ".rspec_status was not found"
236
+
237
+ verify-linux-gnu:
238
+ name: verify Linux (gnu) binary gem on ruby-${{ matrix.ruby }}
239
+ needs: pack
240
+ runs-on: ubuntu-latest
241
+ strategy:
242
+ fail-fast: false
243
+ matrix:
244
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
245
+ steps:
246
+ - name: Install Ruby
247
+ uses: ruby/setup-ruby@master
248
+ with:
249
+ ruby-version: ${{ matrix.ruby }}
250
+ bundler-cache: true
251
+ bundler: ${{ env.BUNDLER_VER }}
252
+
253
+ - name: Checkout
254
+ uses: actions/checkout@v4
255
+
256
+ - name: Bundle
257
+ run: bundle install --jobs 4 --retry 3
258
+
259
+ - name: Download packaged gem
260
+ uses: actions/download-artifact@v3
261
+ with:
262
+ name: pkg-linux-gnu
263
+ path: pkg
264
+
265
+ - name: Install binary gem
266
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM")-gnu.gem
267
+
268
+ - name: Verify
269
+ run: |
270
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
271
+ ruby bin/rspec
272
+ cat .rspec_status || echo ".rspec_status was not found"
273
+
274
+ verify-windows:
275
+ name: verify Windows binary gem on ruby-${{ matrix.ruby }}
276
+ needs: pack
277
+ continue-on-error: true
278
+ runs-on: windows-latest
279
+ strategy:
280
+ fail-fast: false
281
+ # Ruby 3.1 fails
282
+ # https://github.com/lutaml/expressir/issues/103
283
+ matrix:
284
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
285
+ steps:
286
+ - name: Install Ruby
287
+ uses: ruby/setup-ruby@master
288
+ with:
289
+ ruby-version: ${{ matrix.ruby }}
290
+ bundler-cache: true
291
+ bundler: ${{ env.BUNDLER_VER }}
292
+
293
+ - name: Checkout
294
+ uses: actions/checkout@v4
295
+
296
+ - name: Bundle
297
+ run: bundle install --jobs 4 --retry 3
298
+
299
+ - name: Download packaged gem
300
+ uses: actions/download-artifact@v3
301
+ with:
302
+ name: pkg-windows
303
+ path: pkg
304
+
305
+ - name: Install binary gem
306
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM").gem
307
+
308
+ - name: Verify
309
+ run: |
310
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
311
+ ruby bin/rspec
312
+ cat .rspec_status || echo ".rspec_status was not found"
@@ -0,0 +1,124 @@
1
+ name: release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ next_version:
7
+ description: |
8
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
9
+ required: true
10
+ default: 'patch'
11
+ push:
12
+ tags: [ v* ]
13
+
14
+ concurrency:
15
+ group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ bump:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ submodules: recursive
25
+
26
+ - uses: ruby/setup-ruby@master
27
+ with:
28
+ ruby-version: '3.1'
29
+ bundler: ${{ env.BUNDLER_VER }}
30
+
31
+ - if: ${{ github.event_name == 'workflow_dispatch' }} # unfortunatelly cannot keep this condition on job level
32
+ run: |
33
+ git config --global user.name github-actions
34
+ git config --global user.email github-actions@github.com
35
+ gem install gem-release
36
+ gem bump --version ${{ github.event.inputs.next_version }} --tag --push
37
+
38
+ pack:
39
+ runs-on: ubuntu-latest
40
+ needs: bump
41
+ strategy:
42
+ fail-fast: false
43
+ matrix:
44
+ platform: [ linux-gnu, windows, darwin ]
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ with:
48
+ submodules: recursive
49
+
50
+ - uses: ruby/setup-ruby@master
51
+ with:
52
+ ruby-version: '3.1'
53
+ # bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
54
+ # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
55
+
56
+ - run: bundle install --jobs 4 --retry 3
57
+
58
+ # build gem WITHOUT pre-built native extension
59
+ - run: gem build expressir.gemspec
60
+
61
+ - if: matrix.platform == 'linux-gnu'
62
+ uses: actions/upload-artifact@v3
63
+ with:
64
+ name: pkg-ruby
65
+ path: expressir-*.gem
66
+
67
+ - name: Enable swap
68
+ run: |
69
+ sudo fallocate -l 15g /compile.swap
70
+ sudo chmod 600 /compile.swap
71
+ sudo mkswap /compile.swap
72
+ sudo swapon /compile.swap
73
+ sudo swapon --all --verbose
74
+
75
+ # build gem WITH pre-built native extension
76
+ - run: bundle exec rake gem:${{ matrix.platform }}
77
+
78
+ - uses: actions/upload-artifact@v3
79
+ with:
80
+ name: pkg-${{ matrix.platform }}
81
+ path: pkg/*.gem
82
+
83
+ publish:
84
+ runs-on: ubuntu-latest
85
+ needs: pack
86
+ steps:
87
+ - uses: actions/download-artifact@v3
88
+ with:
89
+ name: pkg-ruby
90
+ path: pkg
91
+
92
+ - uses: actions/download-artifact@v3
93
+ with:
94
+ name: pkg-linux-gnu
95
+ path: pkg
96
+
97
+ - uses: actions/download-artifact@v3
98
+ with:
99
+ name: pkg-windows
100
+ path: pkg
101
+
102
+ - uses: actions/download-artifact@v3
103
+ with:
104
+ name: pkg-darwin
105
+ path: pkg
106
+
107
+ - uses: ruby/setup-ruby@master
108
+ with:
109
+ ruby-version: '3.1'
110
+
111
+ - run: ls -l pkg/
112
+
113
+ - name: Publish to rubygems.org
114
+ env:
115
+ RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
116
+ run: |
117
+ mkdir -p ~/.gem
118
+ cat > ~/.gem/credentials << EOF
119
+ ---
120
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
121
+ EOF
122
+ chmod 0600 ~/.gem/credentials
123
+ gem signin
124
+ for gem in pkg/*.gem; do gem push $gem -V; done
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
10
+ /.idea
11
+ /.vscode
12
+ /lib/expressir/express/express_parser.bundle
13
+ /lib/expressir/express/express_parser.so
14
+ /lib/expressir/express/*/express_parser.bundle
15
+ /lib/expressir/express/*/express_parser.so
16
+ /spec/syntax/*-pretty.exp
17
+ /ext/express-parser/rice-embed
18
+
19
+ # rspec failure tracking
20
+ .rspec_status
21
+
22
+ # rubocop guide
23
+ .rubocop-https---*
data/.gitmodules ADDED
@@ -0,0 +1,6 @@
1
+ [submodule "ext/express-parser/antlr4-upstream"]
2
+ path = ext/express-parser/antlr4-upstream
3
+ url = https://github.com/antlr/antlr4
4
+ [submodule "ext/express-grammar"]
5
+ path = ext/express-grammar
6
+ url = https://github.com/lutaml/express-grammar
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ enabled: true
3
+ config_file: .rubocop.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
7
+ SuggestExtensions: false
8
+ Exclude:
9
+ - 'vendor/**/*'
10
+ - 'expressir.gemspec'
11
+ - 'tmp/**/*'
12
+ - 'pkg/**/*'
13
+ - 'exe/format-test'
14
+ - 'lib/expressir/express/**/*'
15
+ - 'lib/expressir/model/**/*'
16
+
17
+ Layout/LineLength:
18
+ Max: 160
data/.yardopts ADDED
@@ -0,0 +1,11 @@
1
+ # macro must be defined first, see https://stackoverflow.com/a/10344776/1823988
2
+ lib/expressir/model/model_element.rb
3
+ lib/expressir/model/data_type.rb
4
+ lib/expressir/model/declaration.rb
5
+ lib/expressir/model/expression.rb
6
+ lib/expressir/model/literal.rb
7
+ lib/expressir/model/reference.rb
8
+ lib/expressir/model/statement.rb
9
+ lib/expressir/model/supertype_expression.rb
10
+
11
+ lib/**/*.rb
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in reeper.gemspec
4
+ gemspec
data/README.adoc ADDED
@@ -0,0 +1,155 @@
1
+ = Expressir: EXPRESS in Ruby
2
+
3
+ image:https://img.shields.io/gem/v/expressir.svg["Gem Version", link="https://rubygems.org/gems/expressir"]
4
+ // image:https://codeclimate.com/github/lutaml/expressir/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/lutaml/expressir"]
5
+ image:https://github.com/lutaml/expressir/workflows/rake/badge.svg["Build Status", link="https://github.com/lutaml/expressir/actions?workflow=rake"]
6
+
7
+ == Purpose
8
+
9
+ Expressir ("`EXPRESS in Ruby`") is a Ruby parser for EXPRESS and
10
+ a set of Ruby tools for accessing ISO EXPRESS data models.
11
+
12
+ == Architecture
13
+
14
+ Expressir consists of 3 parts:
15
+
16
+ . Parsers. A parser allows Expressir to read EXPRESS files, including:
17
+
18
+ ** EXPRESS data modelling language (ISO 10303-11:2007)
19
+ ** EXPRESS data modelling language in XML (STEPmod)
20
+ ** EXPRESS XML (ISO 10303-28:2007)
21
+ "`Industrial automation systems and integration — Product data representation and exchange — Part 28: Implementation methods: XML representations of EXPRESS schemas and data, using XML schemas`")
22
+
23
+ . Data model. The data model (`lib/expressir/express`) is the Ruby data model that fully represents an EXPRESS data model.
24
+
25
+ . Converters. A converter transforms the EXPRESS Ruby data model into an interoperable export format, including:
26
+ ** EXPRESS data modelling language (ISO 10303-11:2007)
27
+ ** W3C OWL
28
+ ** OMG SysML (XMI 2.1, XMI 2.5)
29
+ ** OMG UML 2 (XMI 2.1)
30
+ ** OMG UML 2 for Eclipse (XMI 2.1)
31
+
32
+
33
+ == Usage
34
+
35
+ This gem ships with a CLI tool. To check what's available you can simply run
36
+ the script directly from `exe/expressir`, by default it will display some usage
37
+ instructions.
38
+
39
+ [source, sh]
40
+ ----
41
+ ./exe/expressir
42
+
43
+ Commands:
44
+ expressir help [COMMAND] # Describe available commands or one specific command
45
+ expressir version # The Expressir Version
46
+ ----
47
+
48
+ == Development
49
+
50
+ We are following Sandi Metz's Rules for this gem, you can read
51
+ the http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[description of the rules here] All new code should follow these rules.
52
+ If you make changes in a pre-existing file that violates these rules you should
53
+ fix the violations as part of your contribution.
54
+
55
+ === Setup
56
+
57
+ Clone the repository.
58
+
59
+ [source, sh]
60
+ ----
61
+ git clone https://github.com/metanorma/expressir
62
+ ----
63
+
64
+ Setup your environment.
65
+
66
+ [source, sh]
67
+ ----
68
+ bin/setup
69
+ ----
70
+
71
+ Run the test suite
72
+
73
+ [source, sh]
74
+ ----
75
+ bin/rspec
76
+ ----
77
+
78
+ === Grammar updates
79
+ EXPRESS grammar is lined as git submodule to ext/express-grammar
80
+ Shoudl you update it, run ```rake generate```. This command will generate source code for updated native extension using antlr4-native gem.
81
+ Please note that we create several classes on top of antlr4-native output so using embedded rake task is a real requirement.
82
+
83
+ When new extension is gnerated and tested plase check in updated C++ files to git (```rake generate``` is NOT a CI step,
84
+ extension source files are pulled from the repo).
85
+
86
+ == Installation
87
+
88
+ Add this line to your application's `Gemfile`:
89
+
90
+ [source, sh]
91
+ ----
92
+ gem "expressir"
93
+ ----
94
+
95
+ And then execute:
96
+
97
+ [source, sh]
98
+ ----
99
+ $ bundle install
100
+ ----
101
+
102
+ Or install it yourself as:
103
+
104
+ [source, sh]
105
+ ----
106
+ $ gem install expressir
107
+ ----
108
+
109
+
110
+ == Contributing
111
+
112
+ First, thank you for contributing! We love pull requests from everyone. By
113
+ participating in this project, you hereby grant
114
+ https://www.ribose.com[Ribose Inc.] the right to grant or transfer an unlimited
115
+ number of non exclusive licenses or sub-licenses to third parties, under the
116
+ copyright covering the contribution to use the contribution by all means.
117
+
118
+ Here are a few technical guidelines to follow:
119
+
120
+ * Open an https://github.com/lutaml/expressir/issues[issues] to discuss a new
121
+ feature.
122
+ * Write tests to support your new feature.
123
+ * Make sure the entire test suite passes locally and on CI.
124
+ * Open a Pull Request.
125
+ * https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits] after receiving feedback.
126
+ * Party!
127
+
128
+
129
+ == License
130
+
131
+ Expressir is distributed under the BSD 2-clause license.
132
+
133
+ Expressir is built on code originally from the NIST Reeper project.
134
+
135
+ The https://www.nist.gov/services-resources/software/reeper[NIST Reeper license]
136
+ is reproduced below:
137
+
138
+ [quote]
139
+ ____
140
+ This software was funded by NIST and developed by EuroSTEP.
141
+ Pursuant to title 17 Section 105 of the United States Code this
142
+ software is not subject to copyright protection and is in the public
143
+ domain.
144
+
145
+ We would appreciate acknowledgment if the software is used. Links to
146
+ non-Federal Government Web sites do not imply NIST endorsement of any
147
+ particular product, service, organization, company, information
148
+ provider, or content.
149
+ ____
150
+
151
+
152
+ == Credits
153
+
154
+ Expressir is created using the structure and examples provided by
155
+ the NIST Reeper software on https://sourceforge.net/p/reeper/[Sourceforge].