expressir 2.1.29 → 2.1.30

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: fbc607242e5dfe5db0276c14d37cdc1d38fc07e4f0014134b20105e443a3b96c
4
- data.tar.gz: 32ba2fe11da1f6439b7a97e30215df127aa6826ae6199f205fa4376c7624a4d2
3
+ metadata.gz: 8b14a8f31cc94d89bc7229adf4ceb23a0180bc9bdf36e01024b7f1b27b638a9f
4
+ data.tar.gz: 249f65e92a803eac2a10a9c0717104e4e194d19b7fe30374f733e48b8807ab01
5
5
  SHA512:
6
- metadata.gz: 06e09081cbb49ef2d4656e8f9104c830edf8fc0427ffbcef0f6fa686884468e561370656d74b3c0f893b1786e0e9d4d4d8f335d297e9e3ddb8211d9bc26bbfd1
7
- data.tar.gz: 15350b06e45e272b7b7dbaee29c5030b794e67a30544344bf534ec2b86c89998fcb1123c1352201d4d41f217f8e11c3054f5e0ef3f94fccb96b3daa42aacda82
6
+ metadata.gz: 7dbf61a6903ef0317b98fcbfd3b5056258b263001e81cf9150aa52a3712e7b040e2289fb8b779d1843428617f5b29002de4deb79775aa0e28182488d14ca8f2f
7
+ data.tar.gz: c1c6057d4618d4caf1c6af8ad39cf3c165e3ecbebc6894ffc98b47c777ec19b3a0c6c91798fcb055be3a8cc6d1e46bc69e128de87db1a512f9069d6281e3c19f
data/.rubocop_todo.yml CHANGED
@@ -1,57 +1,18 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-10-15 09:12:23 UTC using RuboCop version 1.81.1.
3
+ # on 2025-10-16 03:45:37 UTC using RuboCop version 1.81.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: EnforcedStyle, IndentationWidth.
12
- # SupportedStyles: with_first_argument, with_fixed_indentation
13
- Layout/ArgumentAlignment:
14
- Exclude:
15
- - 'lib/expressir/commands/changes_import_eengine.rb'
16
-
17
- # Offense count: 4
18
- # This cop supports safe autocorrection (--autocorrect).
19
- # Configuration parameters: EnforcedStyleAlignWith.
20
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
21
- Layout/BlockAlignment:
22
- Exclude:
23
- - 'lib/expressir/commands/changes_import_eengine.rb'
24
- - 'spec/expressir/commands/changes_import_eengine_spec.rb'
25
-
26
- # Offense count: 4
27
- # This cop supports safe autocorrection (--autocorrect).
28
- Layout/BlockEndNewline:
29
- Exclude:
30
- - 'lib/expressir/commands/changes_import_eengine.rb'
31
- - 'spec/expressir/commands/changes_import_eengine_spec.rb'
32
-
33
- # Offense count: 8
34
- # This cop supports safe autocorrection (--autocorrect).
35
- # Configuration parameters: Width, AllowedPatterns.
36
- Layout/IndentationWidth:
37
- Exclude:
38
- - 'lib/expressir/commands/changes_import_eengine.rb'
39
- - 'spec/expressir/commands/changes_import_eengine_spec.rb'
40
-
41
- # Offense count: 569
9
+ # Offense count: 562
42
10
  # This cop supports safe autocorrection (--autocorrect).
43
11
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
44
12
  # URISchemes: http, https
45
13
  Layout/LineLength:
46
14
  Enabled: false
47
15
 
48
- # Offense count: 3
49
- # This cop supports safe autocorrection (--autocorrect).
50
- # Configuration parameters: AllowInHeredoc.
51
- Layout/TrailingWhitespace:
52
- Exclude:
53
- - 'lib/expressir/commands/changes_import_eengine.rb'
54
-
55
16
  # Offense count: 1
56
17
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
57
18
  Lint/DuplicateBranch:
@@ -67,7 +28,7 @@ Lint/UnusedMethodArgument:
67
28
  - 'lib/expressir/express/cache.rb'
68
29
  - 'lib/expressir/express/parser.rb'
69
30
 
70
- # Offense count: 83
31
+ # Offense count: 84
71
32
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
72
33
  Metrics/AbcSize:
73
34
  Enabled: false
@@ -96,7 +57,7 @@ Metrics/CyclomaticComplexity:
96
57
  - 'lib/expressir/model/model_element.rb'
97
58
  - 'spec/support/model_element_helper.rb'
98
59
 
99
- # Offense count: 113
60
+ # Offense count: 114
100
61
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
101
62
  Metrics/MethodLength:
102
63
  Max: 106
@@ -172,18 +133,6 @@ RSpec/RepeatedExample:
172
133
  Exclude:
173
134
  - 'spec/expressir/model/data_types/logical_spec.rb'
174
135
 
175
- # Offense count: 6
176
- # This cop supports safe autocorrection (--autocorrect).
177
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
178
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
179
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
180
- # FunctionalMethods: let, let!, subject, watch
181
- # AllowedMethods: lambda, proc, it
182
- Style/BlockDelimiters:
183
- Exclude:
184
- - 'lib/expressir/commands/changes_import_eengine.rb'
185
- - 'spec/expressir/commands/changes_import_eengine_spec.rb'
186
-
187
136
  # Offense count: 1
188
137
  # This cop supports safe autocorrection (--autocorrect).
189
138
  # Configuration parameters: EnforcedStyle, AllowComments.
data/README.adoc CHANGED
@@ -745,8 +745,8 @@ The import command:
745
745
 
746
746
  When the output file already exists:
747
747
 
748
- * **Same version**: Replaces the existing edition with that version
749
- * **New version**: Adds a new edition to the file
748
+ * **Same version**: Replaces the existing version with that version
749
+ * **New version**: Adds a new version to the file
750
750
 
751
751
  This allows you to build up a complete change history incrementally across
752
752
  multiple schema versions.
@@ -816,14 +816,14 @@ This creates a single YAML file tracking changes across all three versions:
816
816
  [source,yaml]
817
817
  ----
818
818
  schema: action_schema
819
- editions:
820
- - version: '2'
819
+ versions:
820
+ - version: 2
821
821
  description: Changes from eengine comparison
822
822
  additions: [...]
823
- - version: '3'
823
+ - version: 3
824
824
  description: Changes from eengine comparison
825
825
  additions: [...]
826
- - version: '4'
826
+ - version: 4
827
827
  description: Changes from eengine comparison
828
828
  additions: [...]
829
829
  ----
@@ -1236,7 +1236,7 @@ The Changes module enables:
1236
1236
 
1237
1237
  * Loading and saving schema change records from/to YAML files
1238
1238
  * Programmatic creation and manipulation of change records
1239
- * Smart edition handling (replace same version, add new version)
1239
+ * Smart version handling (replace same version, add new version)
1240
1240
  * Support for all change types: additions, modifications, deletions
1241
1241
  * Support for mapping changes in ARM/MIM schemas
1242
1242
  * Programmatic import from Express Engine comparison XML files
@@ -1278,7 +1278,7 @@ change_schema = Expressir::Commands::ChangesImportEengine.from_xml(
1278
1278
  )
1279
1279
 
1280
1280
  # Use the SchemaChange object
1281
- change_schema.editions.first.additions.each do |item|
1281
+ change_schema.versions.first.additions.each do |item|
1282
1282
  puts "#{item.type}: #{item.name}"
1283
1283
  puts " interfaced_items: #{item.interfaced_items}" if item.interfaced_items
1284
1284
  end
@@ -1392,8 +1392,8 @@ This will be converted to EXPRESS Changes YAML as:
1392
1392
  [source,yaml]
1393
1393
  ----
1394
1394
  schema: aic_csg
1395
- editions:
1396
- - version: '2'
1395
+ versions:
1396
+ - version: 2
1397
1397
  description: Changes from eengine comparison
1398
1398
  additions:
1399
1399
  - type: USE_FROM
@@ -1453,14 +1453,14 @@ change_schema = Expressir::Changes::SchemaChange.from_file("schema.changes.yaml"
1453
1453
  # Access schema name
1454
1454
  puts "Schema: #{change_schema.schema}"
1455
1455
 
1456
- # Iterate through change editions
1457
- change_schema.editions.each do |edition|
1458
- puts "Version #{edition.version}: #{edition.description}"
1456
+ # Iterate through change versions
1457
+ change_schema.versions.each do |version|
1458
+ puts "Version #{version.version}: #{version.description}"
1459
1459
 
1460
1460
  # Access changes by type
1461
- puts " Additions: #{edition.additions.size}" if edition.additions
1462
- puts " Modifications: #{edition.modifications.size}" if edition.modifications
1463
- puts " Deletions: #{edition.deletions.size}" if edition.deletions
1461
+ puts " Additions: #{version.additions.size}" if version.additions
1462
+ puts " Modifications: #{version.modifications.size}" if version.modifications
1463
+ puts " Deletions: #{version.deletions.size}" if version.deletions
1464
1464
  end
1465
1465
  ----
1466
1466
 
@@ -1485,14 +1485,14 @@ modified_function = Expressir::Changes::ItemChange.new(
1485
1485
  description: "Updated parameters"
1486
1486
  )
1487
1487
 
1488
- # Add a change edition
1488
+ # Add a change version
1489
1489
  changes = {
1490
1490
  additions: [new_entity],
1491
1491
  modifications: [modified_function],
1492
1492
  deletions: []
1493
1493
  }
1494
1494
 
1495
- change_schema.add_or_update_edition(
1495
+ change_schema.add_or_update_version(
1496
1496
  "2",
1497
1497
  "Added new entity and modified function",
1498
1498
  changes
@@ -1504,10 +1504,10 @@ change_schema.to_file("my_schema.changes.yaml")
1504
1504
 
1505
1505
  === Updating existing change files
1506
1506
 
1507
- The `add_or_update_edition` method provides smart handling:
1507
+ The `add_or_update_version` method provides smart handling:
1508
1508
 
1509
- * **Same version**: Replaces the existing edition
1510
- * **Different version**: Adds a new edition
1509
+ * **Same version**: Replaces the existing version
1510
+ * **Different version**: Adds a new version
1511
1511
 
1512
1512
  [source,ruby]
1513
1513
  ----
@@ -1520,10 +1520,10 @@ changes = {
1520
1520
  Expressir::Changes::ItemChange.new(type: "TYPE", name: "updated_type")
1521
1521
  ]
1522
1522
  }
1523
- change_schema.add_or_update_edition("3", "Modified type definition", changes)
1523
+ change_schema.add_or_update_version("3", "Modified type definition", changes)
1524
1524
 
1525
1525
  # Or replace existing version
1526
- change_schema.add_or_update_edition("2", "Revised description", changes)
1526
+ change_schema.add_or_update_version("2", "Revised description", changes)
1527
1527
 
1528
1528
  # Save changes
1529
1529
  change_schema.to_file("schema.changes.yaml")
@@ -1547,9 +1547,9 @@ item = Expressir::Changes::ItemChange.new(
1547
1547
  )
1548
1548
  ----
1549
1549
 
1550
- === Change edition fields
1550
+ === Change version fields
1551
1551
 
1552
- Change editions support categorizing changes into:
1552
+ Change versions support categorizing changes into:
1553
1553
 
1554
1554
  `additions`:: New elements added to the schema
1555
1555
  `modifications`:: Existing elements that were modified
@@ -1559,7 +1559,7 @@ Change editions support categorizing changes into:
1559
1559
 
1560
1560
  [source,ruby]
1561
1561
  ----
1562
- edition = Expressir::Changes::EditionChange.new(
1562
+ version = Expressir::Changes::VersionChange.new(
1563
1563
  version: "2",
1564
1564
  description: "Added support for new functionality",
1565
1565
  additions: [item1, item2],
@@ -1586,8 +1586,8 @@ mapping_change = Expressir::Changes::MappingChange.new(
1586
1586
  ----
1587
1587
  ---
1588
1588
  schema: support_resource_schema
1589
- editions:
1590
- - version: '2'
1589
+ versions:
1590
+ - version: 2
1591
1591
  description: |-
1592
1592
  The definitions of the following EXPRESS entity data types were modified:
1593
1593
 
@@ -1600,7 +1600,7 @@ editions:
1600
1600
  modifications:
1601
1601
  - type: FUNCTION
1602
1602
  name: bag_to_set
1603
- - version: '4'
1603
+ - version: 4
1604
1604
  description: |-
1605
1605
  Added support for external element references.
1606
1606
  additions:
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lutaml/model"
4
- require_relative "edition_change"
4
+ require_relative "version_change"
5
5
 
6
6
  module Expressir
7
7
  module Changes
8
8
  # Represents changes to an EXPRESS schema across multiple versions
9
9
  class SchemaChange < Lutaml::Model::Serializable
10
10
  attribute :schema, :string
11
- attribute :editions, EditionChange, collection: true
11
+ attribute :versions, VersionChange, collection: true
12
12
 
13
13
  yaml do
14
14
  map "schema", to: :schema
15
- map "editions", to: :editions
15
+ map "versions", to: :versions
16
16
  end
17
17
 
18
18
  class << self
@@ -23,32 +23,40 @@ module Expressir
23
23
  def from_file(path)
24
24
  content = File.read(path)
25
25
  # Handle empty or minimal YAML files
26
+ # Skip leading comments and empty lines
27
+ lines = content.lines
28
+ yaml_start_index = lines.find_index do |line|
29
+ !line.strip.start_with?("#") && !line.strip.empty?
30
+ end
31
+
32
+ if yaml_start_index
33
+ content = lines[yaml_start_index..].join
34
+ end
35
+
26
36
  return new if content.strip == "---" || content.strip.empty?
27
37
 
28
38
  from_yaml(content)
29
39
  end
30
40
  end
31
41
 
32
- # Add or update a change edition in this schema
42
+ # Add or update a change version in this schema
33
43
  #
34
44
  # @param version [String] Version number
35
45
  # @param description [String] Description of changes
36
46
  # @param changes [Hash] Hash with :additions, :modifications, :deletions
37
- # @return [EditionChange] The added or updated edition
38
- def add_or_update_edition(version, description, changes)
39
- version_str = version.to_s
40
-
41
- # Initialize editions array if nil
42
- self.editions ||= []
47
+ # @return [VersionChange] The added or updated version
48
+ def add_or_update_version(version, description, changes)
49
+ # Initialize versions array if nil
50
+ self.versions ||= []
43
51
 
44
- # Find existing edition with this version
45
- existing_index = editions.find_index do |ed|
46
- ed.version == version_str
52
+ # Find existing version with this version
53
+ existing_index = versions.find_index do |ed|
54
+ ed.version == version
47
55
  end
48
56
 
49
- # Create new edition
50
- edition = EditionChange.new(
51
- version: version_str,
57
+ # Create new version
58
+ version = VersionChange.new(
59
+ version: version,
52
60
  description: description,
53
61
  additions: changes[:additions] || [],
54
62
  modifications: changes[:modifications] || [],
@@ -56,14 +64,14 @@ module Expressir
56
64
  )
57
65
 
58
66
  if existing_index
59
- # Replace existing edition with same version
60
- editions[existing_index] = edition
67
+ # Replace existing version with same version
68
+ versions[existing_index] = version
61
69
  else
62
- # Add new edition
63
- editions << edition
70
+ # Add new version
71
+ versions << version
64
72
  end
65
73
 
66
- edition
74
+ version
67
75
  end
68
76
 
69
77
  # Save this SchemaChange to a YAML file
@@ -71,7 +79,9 @@ module Expressir
71
79
  # @param path [String] Path where to save the file
72
80
  # @return [Integer] Number of bytes written
73
81
  def to_file(path)
74
- File.write(path, to_yaml)
82
+ # Add schema hint for editor support
83
+ content = "# yaml-language-server: $schema=https://www.expresslang.org/schemas/changes/v1/schema_changes.yaml\n#{to_yaml}"
84
+ File.write(path, content)
75
85
  end
76
86
  end
77
87
  end
@@ -6,9 +6,9 @@ require_relative "mapping_change"
6
6
 
7
7
  module Expressir
8
8
  module Changes
9
- # Represents a version edition of schema changes
10
- class EditionChange < Lutaml::Model::Serializable
11
- attribute :version, :string
9
+ # Represents a version version of schema changes
10
+ class VersionChange < Lutaml::Model::Serializable
11
+ attribute :version, :integer
12
12
  attribute :description, :string
13
13
  attribute :additions, ItemChange, collection: true
14
14
  attribute :modifications, ItemChange, collection: true
@@ -70,8 +70,8 @@ module Expressir
70
70
  change_schema = options[:existing_schema] ||
71
71
  Expressir::Changes::SchemaChange.new(schema: schema_name)
72
72
 
73
- # No edition-level description from eengine (only item-level)
74
- change_schema.add_or_update_edition(version, nil, changes)
73
+ # No version-level description from eengine (only item-level)
74
+ change_schema.add_or_update_version(version, nil, changes)
75
75
 
76
76
  change_schema
77
77
  end
@@ -31,7 +31,7 @@ module Expressir
31
31
 
32
32
  say "✓ File is valid" if options[:verbose]
33
33
  say " Schema: #{schema_change.schema}" if options[:verbose]
34
- say " Editions: #{schema_change.editions.length}" if options[:verbose]
34
+ say " Versions: #{schema_change.versions.length}" if options[:verbose]
35
35
 
36
36
  # Normalize if requested
37
37
  if options[:normalize]
@@ -1,3 +1,3 @@
1
1
  module Expressir
2
- VERSION = "2.1.29".freeze
2
+ VERSION = "2.1.30".freeze
3
3
  end
data/lib/expressir.rb CHANGED
@@ -180,7 +180,7 @@ module Expressir
180
180
  # Autoload for Changes module classes
181
181
  module Changes
182
182
  autoload :SchemaChange, "expressir/changes/schema_change"
183
- autoload :EditionChange, "expressir/changes/edition_change"
183
+ autoload :VersionChange, "expressir/changes/version_change"
184
184
  autoload :ItemChange, "expressir/changes/item_change"
185
185
  autoload :MappingChange, "expressir/changes/mapping_change"
186
186
  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: 2.1.29
4
+ version: 2.1.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-15 00:00:00.000000000 Z
11
+ date: 2025-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -184,10 +184,10 @@ files:
184
184
  - lib/expressir.rb
185
185
  - lib/expressir/benchmark.rb
186
186
  - lib/expressir/changes.rb
187
- - lib/expressir/changes/edition_change.rb
188
187
  - lib/expressir/changes/item_change.rb
189
188
  - lib/expressir/changes/mapping_change.rb
190
189
  - lib/expressir/changes/schema_change.rb
190
+ - lib/expressir/changes/version_change.rb
191
191
  - lib/expressir/cli.rb
192
192
  - lib/expressir/commands/base.rb
193
193
  - lib/expressir/commands/benchmark.rb