expressir 0.2.19-arm64-darwin → 0.2.21-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +16 -4
- data/README.adoc +3 -3
- data/exe/format +45 -29
- data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/cache.rb +48 -0
- data/lib/expressir/model.rb +2 -0
- data/lib/expressir/model/cache.rb +13 -0
- data/lib/expressir/version.rb +1 -1
- data/spec/expressir/express_exp/cache_spec.rb +64 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37e0708a5e57cb5f7f4c1b45af5fbf6f191618576653a3279739237fe82b492f
|
4
|
+
data.tar.gz: 9356a6e34273883e7e1daf97fc03e4764c9799018e51d2dd4bf19ade02869564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c02566bad733b3a700e5f72186a23a47bbe523303e5b3e8fc586eeff0aa7e925b053f03f3a68de84d0a7e2caa23b241a59052ec484943d6632e3d1f3fc648af
|
7
|
+
data.tar.gz: 8e513c9053ac3a1f2295c4e0a978115052e0462421753e7966cbed6995991844875054faf52c235bd4c475998dbec09a919acc92ae6ac299b5aea1e98a4f3b9c
|
@@ -1,9 +1,15 @@
|
|
1
1
|
name: release
|
2
2
|
|
3
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'
|
4
11
|
push:
|
5
12
|
tags: [ v* ]
|
6
|
-
workflow_dispatch:
|
7
13
|
|
8
14
|
jobs:
|
9
15
|
pack:
|
@@ -20,9 +26,15 @@ jobs:
|
|
20
26
|
- uses: ruby/setup-ruby@v1
|
21
27
|
with:
|
22
28
|
ruby-version: '2.6'
|
29
|
+
bundler-cache: true
|
23
30
|
|
24
|
-
-
|
31
|
+
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
32
|
+
run: |
|
33
|
+
git config user.name github-actions
|
34
|
+
git config user.email github-actions@github.com
|
35
|
+
gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
25
36
|
|
37
|
+
# build gem WITHOUT pre-built native extension
|
26
38
|
- run: gem build expressir.gemspec
|
27
39
|
|
28
40
|
- if: matrix.host == 'linux'
|
@@ -31,6 +43,7 @@ jobs:
|
|
31
43
|
name: pkg-ruby
|
32
44
|
path: expressir-*.gem
|
33
45
|
|
46
|
+
# build gem WITH pre-built native extension
|
34
47
|
- run: bundle exec rake gem:${{ matrix.host }}
|
35
48
|
|
36
49
|
- uses: actions/upload-artifact@v2
|
@@ -38,8 +51,7 @@ jobs:
|
|
38
51
|
name: pkg-${{ matrix.host }}
|
39
52
|
path: pkg/*.gem
|
40
53
|
|
41
|
-
|
42
|
-
release:
|
54
|
+
publish:
|
43
55
|
runs-on: ubuntu-18.04
|
44
56
|
needs: pack
|
45
57
|
steps:
|
data/README.adoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= Expressir: EXPRESS in Ruby
|
2
2
|
|
3
|
-
image:https://
|
4
|
-
image:https://
|
5
|
-
image:https://github.com/lutaml/expressir/workflows/
|
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
6
|
|
7
7
|
== Purpose
|
8
8
|
|
data/exe/format
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "yaml"
|
4
|
+
require "tempfile"
|
4
5
|
require "expressir/express_exp/parser"
|
5
6
|
require "expressir/express_exp/formatter"
|
6
7
|
require "expressir/express_exp/schema_head_formatter"
|
7
8
|
require "expressir/express_exp/hyperlink_formatter"
|
9
|
+
require "expressir/express_exp/cache"
|
8
10
|
|
9
11
|
exp_files = [
|
10
12
|
# basic test
|
@@ -22,44 +24,58 @@ exp_files = [
|
|
22
24
|
# '../iso-10303-stepmod/data/resources/iso13584_expressions_schema/iso13584_expressions_schema.exp',
|
23
25
|
# annotated-express test (12s)
|
24
26
|
# see https://github.com/metanorma/annotated-express/blob/master/data/documents/resources/fundamentals_of_product_description_and_support/sections/04-schemas.adoc
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
27
|
+
'../iso-10303-stepmod/data/resources/action_schema/action_schema_annotated.exp',
|
28
|
+
'../iso-10303-stepmod/data/resources/application_context_schema/application_context_schema_annotated.exp',
|
29
|
+
'../iso-10303-stepmod/data/resources/approval_schema/approval_schema_annotated.exp',
|
30
|
+
'../iso-10303-stepmod/data/resources/basic_attribute_schema/basic_attribute_schema_annotated.exp',
|
31
|
+
'../iso-10303-stepmod/data/resources/certification_schema/certification_schema_annotated.exp',
|
32
|
+
'../iso-10303-stepmod/data/resources/contract_schema/contract_schema_annotated.exp',
|
33
|
+
'../iso-10303-stepmod/data/resources/date_time_schema/date_time_schema_annotated.exp',
|
34
|
+
'../iso-10303-stepmod/data/resources/document_schema/document_schema.exp',
|
35
|
+
'../iso-10303-stepmod/data/resources/effectivity_schema/effectivity_schema_annotated.exp',
|
36
|
+
'../iso-10303-stepmod/data/resources/experience_schema/experience_schema_annotated.exp',
|
37
|
+
'../iso-10303-stepmod/data/resources/external_reference_schema/external_reference_schema_annotated.exp',
|
38
|
+
'../iso-10303-stepmod/data/resources/group_schema/group_schema_annotated.exp',
|
39
|
+
'../iso-10303-stepmod/data/resources/language_schema/language_schema_annotated.exp',
|
40
|
+
'../iso-10303-stepmod/data/resources/location_schema/location_schema_annotated.exp',
|
41
|
+
'../iso-10303-stepmod/data/resources/management_resources_schema/management_resources_schema_annotated.exp',
|
42
|
+
'../iso-10303-stepmod/data/resources/measure_schema/measure_schema_annotated.exp',
|
43
|
+
'../iso-10303-stepmod/data/resources/person_organization_schema/person_organization_schema_annotated.exp',
|
44
|
+
'../iso-10303-stepmod/data/resources/process_property_schema/process_property_schema_annotated.exp',
|
45
|
+
'../iso-10303-stepmod/data/resources/product_definition_schema/product_definition_schema_annotated.exp',
|
46
|
+
'../iso-10303-stepmod/data/resources/product_property_definition_schema/product_property_definition_schema_annotated.exp',
|
47
|
+
'../iso-10303-stepmod/data/resources/product_property_representation_schema/product_property_representation_schema_annotated.exp',
|
48
|
+
'../iso-10303-stepmod/data/resources/qualifications_schema/qualifications_schema_annotated.exp',
|
49
|
+
'../iso-10303-stepmod/data/resources/security_classification_schema/security_classification_schema_annotated.exp',
|
50
|
+
'../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp',
|
49
51
|
# full test (6m18s + 8s = 6m26s)
|
50
|
-
*`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip.split("\n").map{|file| File.exists?(file.sub(/\.exp$/, '_annotated.exp')) ? file.sub(/\.exp$/, '_annotated.exp') : file}
|
52
|
+
# *`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip.split("\n").map{|file| File.exists?(file.sub(/\.exp$/, '_annotated.exp')) ? file.sub(/\.exp$/, '_annotated.exp') : file}
|
51
53
|
]
|
52
54
|
|
53
55
|
start = Time.now
|
54
56
|
repository = Expressir::ExpressExp::Parser.from_files(exp_files)
|
55
|
-
puts "
|
56
|
-
|
57
|
+
puts "Parser.from_files time: #{(Time.now - start).round(2)}s"
|
58
|
+
|
59
|
+
temp_file = Tempfile.new
|
60
|
+
begin
|
61
|
+
start = Time.now
|
62
|
+
Expressir::ExpressExp::Cache.to_file(temp_file, repository)
|
63
|
+
puts "Cache.to_file time: #{(Time.now - start).round(2)}s"
|
64
|
+
|
65
|
+
start = Time.now
|
66
|
+
repository = Expressir::ExpressExp::Cache.from_file(temp_file)
|
67
|
+
puts "Cache.from_file time: #{(Time.now - start).round(2)}s"
|
68
|
+
ensure
|
69
|
+
temp_file.close
|
70
|
+
temp_file.unlink
|
71
|
+
end
|
72
|
+
|
73
|
+
start = Time.now
|
57
74
|
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
58
75
|
include Expressir::ExpressExp::SchemaHeadFormatter
|
59
76
|
include Expressir::ExpressExp::HyperlinkFormatter
|
60
77
|
end
|
61
78
|
result = repository.to_hash(formatter: formatter, skip_empty: true)
|
62
|
-
puts "
|
63
|
-
puts "Total time: #{Time.now - start}"
|
79
|
+
puts "Repository.to_hash time: #{(Time.now - start).round(2)}s"
|
64
80
|
|
65
81
|
# puts YAML.dump(result)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'zlib'
|
3
|
+
require 'expressir/model'
|
4
|
+
|
5
|
+
module Expressir
|
6
|
+
module ExpressExp
|
7
|
+
class Cache
|
8
|
+
def self.to_file(file, content, options = {})
|
9
|
+
root_path = options[:root_path]
|
10
|
+
test_overwrite_version = options[:test_overwrite_version] # don't use, only for tests
|
11
|
+
|
12
|
+
version = test_overwrite_version || VERSION
|
13
|
+
|
14
|
+
cache = Model::Cache.new({
|
15
|
+
version: version,
|
16
|
+
content: content
|
17
|
+
})
|
18
|
+
|
19
|
+
hash = cache.to_hash(root_path: root_path, skip_empty: true)
|
20
|
+
yaml = YAML.dump(hash)
|
21
|
+
yaml_compressed = Zlib::Deflate.deflate(yaml)
|
22
|
+
|
23
|
+
File.binwrite(file, yaml_compressed)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.from_file(file, options = {})
|
27
|
+
root_path = options[:root_path]
|
28
|
+
test_overwrite_version = options[:test_overwrite_version] # don't use, only for tests
|
29
|
+
|
30
|
+
version = test_overwrite_version || VERSION
|
31
|
+
|
32
|
+
yaml_compressed = File.binread(file)
|
33
|
+
yaml = Zlib::Inflate.inflate(yaml_compressed)
|
34
|
+
hash = YAML.load(yaml)
|
35
|
+
cache = Model::ModelElement.from_hash(hash, root_path: root_path)
|
36
|
+
|
37
|
+
if cache.version != version
|
38
|
+
raise CacheLoadError.new("Cache version mismatch, cache version is #{cache.version}, Expressir version is #{VERSION}")
|
39
|
+
end
|
40
|
+
|
41
|
+
cache.content
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class CacheLoadError < StandardError
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/expressir/model.rb
CHANGED
data/lib/expressir/version.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "tempfile"
|
3
|
+
require "spec_helper"
|
4
|
+
require "expressir/express_exp/parser"
|
5
|
+
require "expressir/express_exp/cache"
|
6
|
+
|
7
|
+
RSpec.describe Expressir::ExpressExp::Cache do
|
8
|
+
TEST_VERSION = "0.0.0"
|
9
|
+
|
10
|
+
describe ".to_file" do
|
11
|
+
it "exports an object" do
|
12
|
+
temp_file = Tempfile.new
|
13
|
+
|
14
|
+
repository = Expressir::Model::Repository.new
|
15
|
+
|
16
|
+
begin
|
17
|
+
Expressir::ExpressExp::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
|
18
|
+
|
19
|
+
size = File.size(temp_file)
|
20
|
+
|
21
|
+
expect(size).to be > 0
|
22
|
+
ensure
|
23
|
+
temp_file.close
|
24
|
+
temp_file.unlink
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe ".from_file" do
|
30
|
+
it "parses a file" do
|
31
|
+
temp_file = Tempfile.new
|
32
|
+
|
33
|
+
repository = Expressir::Model::Repository.new
|
34
|
+
|
35
|
+
begin
|
36
|
+
Expressir::ExpressExp::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
|
37
|
+
|
38
|
+
result = Expressir::ExpressExp::Cache.from_file(temp_file, test_overwrite_version: TEST_VERSION)
|
39
|
+
|
40
|
+
expect(result).to be_instance_of(Expressir::Model::Repository)
|
41
|
+
ensure
|
42
|
+
temp_file.close
|
43
|
+
temp_file.unlink
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "fails parsing a file from a different Expressir version" do
|
48
|
+
temp_file = Tempfile.new
|
49
|
+
|
50
|
+
repository = Expressir::Model::Repository.new
|
51
|
+
|
52
|
+
begin
|
53
|
+
Expressir::ExpressExp::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
|
54
|
+
|
55
|
+
expect do
|
56
|
+
Expressir::ExpressExp::Cache.from_file(temp_file)
|
57
|
+
end.to raise_error(Expressir::ExpressExp::CacheLoadError)
|
58
|
+
ensure
|
59
|
+
temp_file.close
|
60
|
+
temp_file.unlink
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expressir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.21
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -215,6 +215,7 @@ files:
|
|
215
215
|
- lib/expressir/express_exp/2.6/express_parser.bundle
|
216
216
|
- lib/expressir/express_exp/2.7/express_parser.bundle
|
217
217
|
- lib/expressir/express_exp/3.0/express_parser.bundle
|
218
|
+
- lib/expressir/express_exp/cache.rb
|
218
219
|
- lib/expressir/express_exp/formatter.rb
|
219
220
|
- lib/expressir/express_exp/hyperlink_formatter.rb
|
220
221
|
- lib/expressir/express_exp/parser.rb
|
@@ -223,6 +224,7 @@ files:
|
|
223
224
|
- lib/expressir/express_parser.rb
|
224
225
|
- lib/expressir/model.rb
|
225
226
|
- lib/expressir/model/attribute.rb
|
227
|
+
- lib/expressir/model/cache.rb
|
226
228
|
- lib/expressir/model/constant.rb
|
227
229
|
- lib/expressir/model/entity.rb
|
228
230
|
- lib/expressir/model/enumeration_item.rb
|
@@ -347,6 +349,7 @@ files:
|
|
347
349
|
- spec/acceptance/express_to_owl_spec.rb
|
348
350
|
- spec/acceptance/version_spec.rb
|
349
351
|
- spec/expressir/express/repository_spec.rb
|
352
|
+
- spec/expressir/express_exp/cache_spec.rb
|
350
353
|
- spec/expressir/express_exp/formatter_spec.rb
|
351
354
|
- spec/expressir/express_exp/parser_spec.rb
|
352
355
|
- spec/expressir/model/model_element_spec.rb
|