expressir 0.2.19 → 0.2.21
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/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 +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58e1bbf9a216e77cfda6594ad7040dba57086b8776c05b884bfcb25174967237
|
4
|
+
data.tar.gz: cf12bb3deef6b060f0d634e894a6bbcf10734cdcb8b3329d79ccb1d569d95a62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb15652a0cca4901425feea15981e60ce302b55471fcd8b95b2f98df1174f87e9a2eba7c233f97d3678349b5187f2785a7f23cf3bc0845a373bda668c66791c8
|
7
|
+
data.tar.gz: 1a9b788abfc17361421943a7b10c83fa47b0d6653e57b6ffa645175d33354b387de2506b70f271a781d97000c037b122ecab4b383d310293643335e64868bafc
|
@@ -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)
|
@@ -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: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
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
|
@@ -568,6 +568,7 @@ files:
|
|
568
568
|
- lib/expressir/express/type_select.rb
|
569
569
|
- lib/expressir/express/unique_rule.rb
|
570
570
|
- lib/expressir/express/where_rule.rb
|
571
|
+
- lib/expressir/express_exp/cache.rb
|
571
572
|
- lib/expressir/express_exp/formatter.rb
|
572
573
|
- lib/expressir/express_exp/hyperlink_formatter.rb
|
573
574
|
- lib/expressir/express_exp/parser.rb
|
@@ -576,6 +577,7 @@ files:
|
|
576
577
|
- lib/expressir/express_parser.rb
|
577
578
|
- lib/expressir/model.rb
|
578
579
|
- lib/expressir/model/attribute.rb
|
580
|
+
- lib/expressir/model/cache.rb
|
579
581
|
- lib/expressir/model/constant.rb
|
580
582
|
- lib/expressir/model/entity.rb
|
581
583
|
- lib/expressir/model/enumeration_item.rb
|
@@ -700,6 +702,7 @@ files:
|
|
700
702
|
- spec/acceptance/express_to_owl_spec.rb
|
701
703
|
- spec/acceptance/version_spec.rb
|
702
704
|
- spec/expressir/express/repository_spec.rb
|
705
|
+
- spec/expressir/express_exp/cache_spec.rb
|
703
706
|
- spec/expressir/express_exp/formatter_spec.rb
|
704
707
|
- spec/expressir/express_exp/parser_spec.rb
|
705
708
|
- spec/expressir/model/model_element_spec.rb
|
@@ -713,7 +716,7 @@ metadata:
|
|
713
716
|
homepage_uri: https://github.com/lutaml/expressir
|
714
717
|
source_code_uri: https://github.com/lutaml/expressir
|
715
718
|
changelog_uri: https://github.com/lutaml/expressir/releases
|
716
|
-
post_install_message:
|
719
|
+
post_install_message:
|
717
720
|
rdoc_options: []
|
718
721
|
require_paths:
|
719
722
|
- lib
|
@@ -728,8 +731,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
728
731
|
- !ruby/object:Gem::Version
|
729
732
|
version: '0'
|
730
733
|
requirements: []
|
731
|
-
rubygems_version: 3.0
|
732
|
-
signing_key:
|
734
|
+
rubygems_version: 3.2.0
|
735
|
+
signing_key:
|
733
736
|
specification_version: 4
|
734
737
|
summary: ISO EXPRESS parser in Ruby, tools for accessing EXPRESS data models.
|
735
738
|
test_files: []
|