expressir 0.2.19-x64-mingw32 → 0.2.21-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 963caf9af7bd040e1f026e8afa954005db3d9a8f8967afabf98f5dd7c5466700
4
- data.tar.gz: 35fbe83171c059f36a920c2cd29afac398faccbb3c627ba06002f3d71fced758
3
+ metadata.gz: 0e991de8c97827d3add5e3ba867357dce84a9ac3cb358161ac3d01fb90f13b7f
4
+ data.tar.gz: b2de64ce5948597f31fde3867d9c55a8f957b8f008b2446fd1b706a5e730afa1
5
5
  SHA512:
6
- metadata.gz: 7174e01b018c930bba79f34b64d164997ccbcb9bc9f63a3ed33d3339b8d25234dd101aa7e8ac0449a354d3941df883515d926a4aee5310dc15a3a381ab7cbb4f
7
- data.tar.gz: e23a7bd47ab28afdea70dbae56f999a9520798c3d614e3435cc16351f4e2be9c066d63dfb2c983d5e9d592e2308d9488ab9d3aeaee57fb4aaba91154c6b6be6b
6
+ metadata.gz: 132c38604635a7dfddd9922a661547177e6d4210f6a91904413c2ddda80846d61afaa750819c43a3819906e676b6b26465e4d9ffefa7574d3018774c4a4b7f6f
7
+ data.tar.gz: 39131591150b11cc43a021eca3468b79dce5b6384d796fb6ad5926675f9d67c08689129ce252e75b58607496a718c8c1ea2d80d83b69c8c10186031afa52bb55
@@ -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
- - run: bundle install --jobs 4 --retry 3
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://github.com/lutaml/expressir/workflows/ubuntu/badge.svg[ubuntu]
4
- image:https://github.com/lutaml/expressir/workflows/macos/badge.svg[macos]
5
- image:https://github.com/lutaml/expressir/workflows/windows/badge.svg[windows]
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
- # '../iso-10303-stepmod/data/resources/action_schema/action_schema_annotated.exp',
26
- # '../iso-10303-stepmod/data/resources/application_context_schema/application_context_schema_annotated.exp',
27
- # '../iso-10303-stepmod/data/resources/approval_schema/approval_schema_annotated.exp',
28
- # '../iso-10303-stepmod/data/resources/basic_attribute_schema/basic_attribute_schema_annotated.exp',
29
- # '../iso-10303-stepmod/data/resources/certification_schema/certification_schema_annotated.exp',
30
- # '../iso-10303-stepmod/data/resources/contract_schema/contract_schema_annotated.exp',
31
- # '../iso-10303-stepmod/data/resources/date_time_schema/date_time_schema_annotated.exp',
32
- # '../iso-10303-stepmod/data/resources/document_schema/document_schema.exp',
33
- # '../iso-10303-stepmod/data/resources/effectivity_schema/effectivity_schema_annotated.exp',
34
- # '../iso-10303-stepmod/data/resources/experience_schema/experience_schema_annotated.exp',
35
- # '../iso-10303-stepmod/data/resources/external_reference_schema/external_reference_schema_annotated.exp',
36
- # '../iso-10303-stepmod/data/resources/group_schema/group_schema_annotated.exp',
37
- # '../iso-10303-stepmod/data/resources/language_schema/language_schema_annotated.exp',
38
- # '../iso-10303-stepmod/data/resources/location_schema/location_schema_annotated.exp',
39
- # '../iso-10303-stepmod/data/resources/management_resources_schema/management_resources_schema_annotated.exp',
40
- # '../iso-10303-stepmod/data/resources/measure_schema/measure_schema_annotated.exp',
41
- # '../iso-10303-stepmod/data/resources/person_organization_schema/person_organization_schema_annotated.exp',
42
- # '../iso-10303-stepmod/data/resources/process_property_schema/process_property_schema_annotated.exp',
43
- # '../iso-10303-stepmod/data/resources/product_definition_schema/product_definition_schema_annotated.exp',
44
- # '../iso-10303-stepmod/data/resources/product_property_definition_schema/product_property_definition_schema_annotated.exp',
45
- # '../iso-10303-stepmod/data/resources/product_property_representation_schema/product_property_representation_schema_annotated.exp',
46
- # '../iso-10303-stepmod/data/resources/qualifications_schema/qualifications_schema_annotated.exp',
47
- # '../iso-10303-stepmod/data/resources/security_classification_schema/security_classification_schema_annotated.exp',
48
- # '../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp',
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 "Parsing time: #{Time.now - start}"
56
- start2 = Time.now
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 "Formatting & serializing time: #{Time.now - start2}"
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
@@ -1,5 +1,7 @@
1
1
  require 'expressir/model/model_element'
2
2
 
3
+ require 'expressir/model/cache'
4
+
3
5
  require 'expressir/model/identifier'
4
6
 
5
7
  require 'expressir/model/attribute'
@@ -0,0 +1,13 @@
1
+ module Expressir
2
+ module Model
3
+ class Cache < ModelElement
4
+ attr_accessor :version
5
+ attr_accessor :content
6
+
7
+ def initialize(options = {})
8
+ @version = options[:version]
9
+ @content = options[:content]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Expressir
2
- VERSION = "0.2.19".freeze
2
+ VERSION = "0.2.21".freeze
3
3
  end
@@ -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.19
4
+ version: 0.2.21
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-10 00:00:00.000000000 Z
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.so
216
216
  - lib/expressir/express_exp/2.7/express_parser.so
217
217
  - lib/expressir/express_exp/3.0/express_parser.so
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