From 89da645b54b09fa0e1ce117be93a3d121e872c87 Mon Sep 17 00:00:00 2001 From: hmdne <54514036+hmdne@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:33:00 +0200 Subject: [PATCH] Merger: Replace with stub gem --- .github/workflows/macos.yml | 36 -- .github/workflows/release.yml | 22 ++ .github/workflows/ubuntu.yml | 36 -- .github/workflows/windows.yml | 36 -- .gitignore | 11 - .rspec | 3 - CODE_OF_CONDUCT.md | 74 ---- Gemfile | 5 +- README.adoc | 6 + README.md | 40 --- Rakefile | 7 +- bin/console | 14 - bin/setup | 8 - exe/lutaml-sysml | 20 -- lib/lutaml/sysml.rb | 10 - lib/lutaml/sysml/allocate.rb | 8 - lib/lutaml/sysml/allocated.rb | 7 - lib/lutaml/sysml/binding_connector.rb | 7 - lib/lutaml/sysml/block.rb | 27 -- lib/lutaml/sysml/constraint_block.rb | 12 - lib/lutaml/sysml/copy.rb | 6 - lib/lutaml/sysml/derive_requirement.rb | 7 - lib/lutaml/sysml/nested_connector_end.rb | 11 - lib/lutaml/sysml/refine.rb | 7 - lib/lutaml/sysml/requirement.rb | 34 -- lib/lutaml/sysml/requirement_related.rb | 7 - lib/lutaml/sysml/satisfy.rb | 7 - lib/lutaml/sysml/test_case.rb | 22 -- lib/lutaml/sysml/trace.rb | 7 - lib/lutaml/sysml/verify.rb | 6 - lib/lutaml/sysml/version.rb | 5 - lib/lutaml/sysml/xmi_file.rb | 417 ----------------------- lutaml-sysml.gemspec | 58 ++-- spec/lutaml/sysml_spec.rb | 9 - spec/spec_helper.rb | 14 - 35 files changed, 54 insertions(+), 952 deletions(-) delete mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/ubuntu.yml delete mode 100644 .github/workflows/windows.yml delete mode 100644 .gitignore delete mode 100644 .rspec delete mode 100644 CODE_OF_CONDUCT.md create mode 100644 README.adoc delete mode 100644 README.md delete mode 100755 bin/console delete mode 100755 bin/setup delete mode 100755 exe/lutaml-sysml delete mode 100644 lib/lutaml/sysml.rb delete mode 100644 lib/lutaml/sysml/allocate.rb delete mode 100644 lib/lutaml/sysml/allocated.rb delete mode 100644 lib/lutaml/sysml/binding_connector.rb delete mode 100644 lib/lutaml/sysml/block.rb delete mode 100644 lib/lutaml/sysml/constraint_block.rb delete mode 100644 lib/lutaml/sysml/copy.rb delete mode 100644 lib/lutaml/sysml/derive_requirement.rb delete mode 100644 lib/lutaml/sysml/nested_connector_end.rb delete mode 100644 lib/lutaml/sysml/refine.rb delete mode 100644 lib/lutaml/sysml/requirement.rb delete mode 100644 lib/lutaml/sysml/requirement_related.rb delete mode 100644 lib/lutaml/sysml/satisfy.rb delete mode 100644 lib/lutaml/sysml/test_case.rb delete mode 100644 lib/lutaml/sysml/trace.rb delete mode 100644 lib/lutaml/sysml/verify.rb delete mode 100644 lib/lutaml/sysml/version.rb delete mode 100644 lib/lutaml/sysml/xmi_file.rb delete mode 100644 spec/lutaml/sysml_spec.rb delete mode 100644 spec/spec_helper.rb diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 9c277b9..0000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: macos - -on: - push: - branches: - - main - tags: - - '*' - pull_request: - paths-ignore: - - .github/workflows/ubuntu.yml - - .github/workflows/windows.yml - -jobs: - test-macos: - name: Test on Ruby ${{ matrix.ruby }} macOS - runs-on: macos-latest - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - ruby: [ '2.7', '3.0', '3.1' ] - experimental: [false] - include: - - ruby: '3.2' - experimental: true - steps: - - uses: actions/checkout@v3 - - name: Use Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run specs - run: | - bundle exec rake diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aa6ca31 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: release + +on: + workflow_dispatch: + inputs: + next_version: + description: | + Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc + required: true + default: 'skip' + push: + tags: [ v* ] + +jobs: + release: + uses: metanorma/ci/.github/workflows/rubygems-release.yml@main + with: + next_version: ${{ github.event.inputs.next_version }} + secrets: + rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }} + pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }} + diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml deleted file mode 100644 index 25e5a04..0000000 --- a/.github/workflows/ubuntu.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: ubuntu - -on: - push: - branches: - - main - tags: - - '*' - pull_request: - paths-ignore: - - .github/workflows/macos.yml - - .github/workflows/windows.yml - -jobs: - test-linux: - name: Test on Ruby ${{ matrix.ruby }} Ubuntu - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - ruby: [ '2.7', '3.0', '3.1' ] - experimental: [false] - include: - - ruby: '3.2' - experimental: true - steps: - - uses: actions/checkout@v3 - - name: Use Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run specs - run: | - bundle exec rake diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index d0b5d0d..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: windows - -on: - push: - branches: - - main - tags: - - '*' - pull_request: - paths-ignore: - - .github/workflows/macos.yml - - .github/workflows/ubuntu.yml - -jobs: - test-windows: - name: Test on Ruby ${{ matrix.ruby }} Windows - runs-on: windows-latest - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - ruby: [ '2.7', '3.0', '3.1' ] - experimental: [false] - include: - - ruby: '3.2' - experimental: true - steps: - - uses: actions/checkout@v3 - - name: Use Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run specs - run: | - bundle exec rake diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b04a8c8..0000000 --- a/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/.bundle/ -/.yardoc -/_yardoc/ -/coverage/ -/doc/ -/pkg/ -/spec/reports/ -/tmp/ - -# rspec failure tracking -.rspec_status diff --git a/.rspec b/.rspec deleted file mode 100644 index 34c5164..0000000 --- a/.rspec +++ /dev/null @@ -1,3 +0,0 @@ ---format documentation ---color ---require spec_helper diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 41e7e49..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at ronald.tse@ribose.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [https://contributor-covenant.org/version/1/4][version] - -[homepage]: https://contributor-covenant.org -[version]: https://contributor-covenant.org/version/1/4/ diff --git a/Gemfile b/Gemfile index 0aac757..354d102 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,4 @@ source "https://rubygems.org" -# Specify your gem's dependencies in lutaml-sysml.gemspec gemspec - -gem "rake", "~> 12.0" -gem "rspec", "~> 3.0" +gem "rake" diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..13afee1 --- /dev/null +++ b/README.adoc @@ -0,0 +1,6 @@ += lutaml-sysml + +This repository has been merged into LutaML. See: + +* https://github.com/lutaml/lutaml/ +* https://github.com/lutaml/lutaml/tree/main/lib/lutaml/sysml diff --git a/README.md b/README.md deleted file mode 100644 index 99b1648..0000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Lutaml::Sysml - -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/lutaml/sysml`. To experiment with that code, run `bin/console` for an interactive prompt. - -TODO: Delete this and the text above, and describe your gem - -## Installation - -Add this line to your application's Gemfile: - -```ruby -gem 'lutaml-sysml' -``` - -And then execute: - - $ bundle install - -Or install it yourself as: - - $ gem install lutaml-sysml - -## Usage - -TODO: Write usage instructions here - -## Development - -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. - -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). - -## Contributing - -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lutaml-sysml. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/lutaml-sysml/blob/master/CODE_OF_CONDUCT.md). - - -## Code of Conduct - -Everyone interacting in the Lutaml::Sysml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lutaml-sysml/blob/master/CODE_OF_CONDUCT.md). diff --git a/Rakefile b/Rakefile index b7e9ed5..5263b58 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,3 @@ -require "bundler/gem_tasks" -require "rspec/core/rake_task" - -RSpec::Core::RakeTask.new(:spec) +# frozen_string_literal: true -task :default => :spec +require "bundler/gem_tasks" diff --git a/bin/console b/bin/console deleted file mode 100755 index 776e13a..0000000 --- a/bin/console +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby - -require "bundler/setup" -require "lutaml/sysml" - -# You can add fixtures and/or initialization code here to make experimenting -# with your gem easier. You can also use a different console, if you like. - -# (If you use this, don't forget to add pry to your Gemfile!) -# require "pry" -# Pry.start - -require "irb" -IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup deleted file mode 100755 index dce67d8..0000000 --- a/bin/setup +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -IFS=$'\n\t' -set -vx - -bundle install - -# Do any other automated setup that you need to do here diff --git a/exe/lutaml-sysml b/exe/lutaml-sysml deleted file mode 100755 index f2df1b0..0000000 --- a/exe/lutaml-sysml +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby -# encoding: UTF-8 - -# resolve bin path, ignoring symlinks -require "pathname" -bin_file = Pathname.new(__FILE__).realpath - -# add self to libpath -$:.unshift File.expand_path("../../lib", bin_file) - -# Fixes https://github.com/rubygems/rubygems/issues/1420 -require "rubygems/specification" - -class Gem::Specification - def this; self; end -end - -# start up the CLI -require "reeper" -Reeper::Cli.start(ARGV) diff --git a/lib/lutaml/sysml.rb b/lib/lutaml/sysml.rb deleted file mode 100644 index 872f31a..0000000 --- a/lib/lutaml/sysml.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "lutaml/sysml/version" -require "lutaml/uml" -require 'nokogiri' - -module Lutaml - module Sysml - class Error < StandardError; end - # Your code goes here... - end -end diff --git a/lib/lutaml/sysml/allocate.rb b/lib/lutaml/sysml/allocate.rb deleted file mode 100644 index a6f16a3..0000000 --- a/lib/lutaml/sysml/allocate.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Lutaml::SysMl - - -class Allocate < Lutaml::Uml::Abstraction - attr_accessor :base_abstraction -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/allocated.rb b/lib/lutaml/sysml/allocated.rb deleted file mode 100644 index 57db1b6..0000000 --- a/lib/lutaml/sysml/allocated.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class Allocated < Lutaml::Uml::TopElement - attr_accessor :base_named_element, :allocated_from, :allocated_to -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/binding_connector.rb b/lib/lutaml/sysml/binding_connector.rb deleted file mode 100644 index ade49d1..0000000 --- a/lib/lutaml/sysml/binding_connector.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class BindingConnector < Lutaml::Uml::Connector - attr_accessor :base_connector -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/block.rb b/lib/lutaml/sysml/block.rb deleted file mode 100644 index 9c0556c..0000000 --- a/lib/lutaml/sysml/block.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Lutaml::SysMl - -class Block < Lutaml::Uml::Class - attr_accessor :base_class - def initialize - @xmi_id = nil - @nested_classifier = [] - @stereotype = [] - @namespace = nil - end - - def name - if base_class != nil and base_class.name != nil - return base_class.name - end - return nil - end - - def full_name - if base_class != nil and base_class.name != nil - return base_class.full_name - end - return nil - end -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/constraint_block.rb b/lib/lutaml/sysml/constraint_block.rb deleted file mode 100644 index eb13852..0000000 --- a/lib/lutaml/sysml/constraint_block.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Lutaml::SysMl - -class ConstraintBlock < Block - def initialize - @xmi_id = nil - @nested_classifier = [] - @stereotype = [] - @namespace = nil - end -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/copy.rb b/lib/lutaml/sysml/copy.rb deleted file mode 100644 index d805157..0000000 --- a/lib/lutaml/sysml/copy.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Lutaml::SysMl - - class Copy < Trace - end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/derive_requirement.rb b/lib/lutaml/sysml/derive_requirement.rb deleted file mode 100644 index 673c9f8..0000000 --- a/lib/lutaml/sysml/derive_requirement.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class DeriveRequirement < Lutaml::Uml::TopElement - attr_accessor :base_abstraction -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/nested_connector_end.rb b/lib/lutaml/sysml/nested_connector_end.rb deleted file mode 100644 index 9f59eb4..0000000 --- a/lib/lutaml/sysml/nested_connector_end.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Lutaml::SysMl - -class NestedConnectorEnd < Lutaml::Uml::ConnectorEnd - attr_accessor :base_connectorend, :property_path - def initialize - @property_path = [] - end -end - - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/refine.rb b/lib/lutaml/sysml/refine.rb deleted file mode 100644 index e7b1a71..0000000 --- a/lib/lutaml/sysml/refine.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class Refine < Lutaml::Uml::TopElement - attr_accessor :base_abstraction -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/requirement.rb b/lib/lutaml/sysml/requirement.rb deleted file mode 100644 index c3c4dc7..0000000 --- a/lib/lutaml/sysml/requirement.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Lutaml::Sysml - -class Requirement < Lutaml::Uml::Class - attr_accessor :id, :text, :base_class, :refined_by, :traced_to, :derived_from, :satisfied_by - def initialize - @xmi_id = nil - @id = nil - @nested_classifier = [] - @stereotype = [] - @namespace = nil - end - def name - if base_class != nil and base_class.name != nil - return base_class.name - end - return nil - end - def full_name - if base_class != nil and base_class.name != nil - return base_class.full_name - end - return nil - end -## def name -## if base_class != nil and base_class.name != nil -## base_class.name -## else -## nil -## end -## end -## def full_name -## get_base_class_full_name ( self ) -## end -end \ No newline at end of file diff --git a/lib/lutaml/sysml/requirement_related.rb b/lib/lutaml/sysml/requirement_related.rb deleted file mode 100644 index 7b36316..0000000 --- a/lib/lutaml/sysml/requirement_related.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class RequirementRelated < Lutaml::Uml::TopElement - attr_accessor :base_named_element, :satisfies, :refines -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/satisfy.rb b/lib/lutaml/sysml/satisfy.rb deleted file mode 100644 index 9ad90e4..0000000 --- a/lib/lutaml/sysml/satisfy.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class Satisfy < Trace - attr_accessor :base_realization -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/test_case.rb b/lib/lutaml/sysml/test_case.rb deleted file mode 100644 index e433d9d..0000000 --- a/lib/lutaml/sysml/test_case.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Lutaml::SysMl - -class TestCase < Lutaml::Uml::TopElement - attr_accessor :base_behavior, :verifies - - def name - if base_behavior != nil and base_behavior.name != nil - return base_behavior.name - end - return nil - end - - def full_name - if base_behavior != nil and base_behavior.name != nil - return base_behavior.full_name - end - return nil - end - -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/trace.rb b/lib/lutaml/sysml/trace.rb deleted file mode 100644 index b646ed9..0000000 --- a/lib/lutaml/sysml/trace.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Lutaml::SysMl - -class Trace < Lutaml::Uml::TopElement - attr_accessor :base_abstraction -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/verify.rb b/lib/lutaml/sysml/verify.rb deleted file mode 100644 index e262995..0000000 --- a/lib/lutaml/sysml/verify.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Lutaml::SysMl - -class Verify < Trace -end - -end \ No newline at end of file diff --git a/lib/lutaml/sysml/version.rb b/lib/lutaml/sysml/version.rb deleted file mode 100644 index 748b6a4..0000000 --- a/lib/lutaml/sysml/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Lutaml - module Sysml - VERSION = "0.1.0" - end -end diff --git a/lib/lutaml/sysml/xmi_file.rb b/lib/lutaml/sysml/xmi_file.rb deleted file mode 100644 index 93e7dc8..0000000 --- a/lib/lutaml/sysml/xmi_file.rb +++ /dev/null @@ -1,417 +0,0 @@ -module Lutaml::SysMl - -class XmiFile - - attr_accessor :package_list, :model_list, :class_list, :activity_list, :property_list, :port_list, :datatype_list, :instance_list, - :realization_list, :abstraction_list, :association_list , :connector_list, :connectorend_list, :constraint_list, :block_list , :constraintblock_list, - :requirement_list, :testcase_list, :binding_connector_list, :nested_connectorend_list, :derive_requirement_list, - :refine_requirement_list, :trace_requirement_list, :copy_requirement_list, :verify_requirement_list, :satisfy_requirement_list , - :allocate_requirement_list, :element_hash - - def initialize - @package_list = [] - @model_list = [] - @class_list = [] - @activity_list = [] - @property_list = [] - @port_list = [] - @datatype_list = [] - @instance_list = [] - @realization_list = [] - @abstraction_list = [] - @association_list = [] - @connector_list = [] - @connectorend_list = [] - @constraint_list = [] - - @block_list = [] - @constraintblock_list = [] - @requirement_list = [] - @testcase_list = [] - @binding_connector_list = [] - @nested_connectorend_list = [] - @derive_requirement_list = [] - @refine_requirement_list = [] - @trace_requirement_list = [] - @copy_requirement_list = [] - @verify_requirement_list = [] - @satisfy_requirement_list = [] - @allocate_requirement_list = [] - - @element_hash = Hash.new - end - - def parse (filename) - xmifile = File.new(filename, "r") - inxml = Nokogiri::XML(xmifile) - - xmi_elements = inxml.xpath('//xmi:XMI') - if xmi_elements.size == 0 - puts "ERROR : File contains no 'xmi:XMI' XML elements : #{filename}, may not be XMI file." - xmifile.close - exit - end - - #setup xmi namespace - xmiNS = inxml.root.namespace_definitions.find{|ns| ns.prefix=="xmi"} - - ## Step 1: Find UML and SysML Core Objects in XMI file and create as instance of metamodel - - for xml_node in inxml.xpath('//*' ) - element_new = nil - - if xml_node.name.to_s == 'packagedElement' and xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Package' - element_new = Lutaml::Uml::Package.new - package_list.push element_new - end - - if xml_node.name.to_s == 'Model' - element_new = Lutaml::Uml::Model.new - model_list.push element_new - element_new.viewpoint = xml_node['viewpoint'] - element_new.href = xml_node['href'] - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Class' - element_new = Lutaml::Uml::Class.new - if xml_node['isAbstract'] != nil - element_new.is_abstract = xml_node['isAbstract'] == 'true' - end - class_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Activity' - element_new = Lutaml::Uml::Activity.new - activity_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Property' - element_new = Lutaml::Uml::Property.new - property_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s== 'uml:InstanceSpecification' - element_new = Lutaml::Uml::Instance.new - instance_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:DataType' - element_new = Lutaml::Uml::DataType.new - datatype_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Port' - element_new = Lutaml::Uml::Port.new - port_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Connector' - element_new = Lutaml::Uml::Connector.new - connector_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:ConnectorEnd' - element_new = Lutaml::Uml::ConnectorEnd.new - connectorend_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Constraint' - element_new = Lutaml::Uml::Constraint.new - constraint_list.push element_new - end - - if xml_node.name.to_s == 'Block' - element_new = SYSML::Block.new - block_list.push element_new - end - - if xml_node.name.to_s == 'Template' - element_new = SYSML::Block.new - block_list.push element_new - end - - if xml_node.name.to_s == 'ConstraintBlock' - element_new = SYSML::ConstraintBlock.new - constraintblock_list.push element_new - end - - if xml_node.name.to_s.index('Requirement') or xml_node.name.to_s == 'designConstraint' - if xml_node.name.to_s != 'RequirementRelated' - element_new = SYSML::Requirement.new - requirement_list.push element_new - element_new.id = xml_node.attribute_with_ns('id',xmiNS.href).to_s.strip - element_new.text = xml_node['Text'] - if xml_node.name != 'Requirement' - element_new.stereotype.push xml_node.name - end - end - end - - if xml_node.name.to_s == 'TestCase' - element_new = SYSML::TestCase.new - testcase_list.push element_new - end - - if xml_node.name.to_s == 'BindingConnector' - element_new = SYSML::BindingConnector.new - binding_connector_list.push element_new - end - - if xml_node.name.to_s == 'NestedConnectorEnd' - element_new = SYSML::NestedConnectorEnd.new - nested_connectorend_list.push element_new - end - - if xml_node.name.to_s == 'DeriveReqt' - element_new = SYSML::DeriveRequirement.new - derive_requirement_list.push element_new - end - if xml_node.name.to_s == 'refine' - element_new = SYSML::Refine.new - refine_requirement_list.push element_new - end - if xml_node.name.to_s == 'trace' - element_new = SYSML::Trace.new - trace_requirement_list.push element_new - end - if xml_node.name.to_s == 'Copy' - element_new = SYSML::Copy.new - copy_requirement_list.push element_new - end - if xml_node.name.to_s == 'Verify' - element_new = SYSML::Verify.new - verify_requirement_list.push element_new - end - if xml_node.name.to_s == 'Allocate' - element_new = SYSML::Allocate.new - allocate_requirement_list.push element_new - end - - if xml_node.name.to_s == 'Satisfy' - element_new = SYSML::Satisfy.new - satisfy_requirement_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Abstraction' - element_new = Lutaml::Uml::Abstraction.new - abstraction_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Realization' - element_new = Lutaml::Uml::Realization.new - realization_list.push element_new - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Association' - element_new = Lutaml::Uml::Association.new - association_list.push element_new - end - - if element_new != nil - new_xmi_id_node = xml_node.attribute_with_ns('id',xmiNS.href) - new_xmi_uuid_node = xml_node.attribute_with_ns('uuid',xmiNS.href) - new_name_node = xml_node['name'] - new_href_node = xml_node['href'] - - if new_xmi_id_node != nil - element_new.xmi_id = new_xmi_id_node.to_s - element_hash[element_new.xmi_id] = element_new - end - - if new_xmi_uuid_node != nil - element_new.xmi_uuid = new_xmi_uuid_node.to_s - end - - if new_name_node != nil - element_new.name = xml_node['name'].strip - end - - if new_href_node != nil - element_new.href = new_href_node.to_s - if new_xmi_id_node == nil - element_hash[element_new.href] = element_new - end - if xml_node.at('xmi:Extension/referenceExtension') != nil - element_new.name = xml_node.at('xmi:Extension/referenceExtension')['referentPath'] - end - end - - if (xml_node.parent != nil and - xml_node.parent.attribute_with_ns('id',xmiNS.href) != nil and - element_hash[xml_node.parent.attribute_with_ns('id',xmiNS.href).to_s] != nil) - - parent = element_hash[xml_node.parent.attribute_with_ns('id',xmiNS.href).to_s] - element_new.namespace = parent - if parent.kind_of? Lutaml::Uml::Package - parent.contents.push element_new - end - end - end - end - - for xml_node in inxml.xpath('//*') - - if (xml_node.attribute_with_ns('id',xmiNS.href) != nil and - element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] != nil) - - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - end - - if xml_node.name.to_s == 'nestedClassifier' and xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Class' - owning_class_xmi_id = xml_node.parent.attribute_with_ns('id',xmiNS.href).to_s - owned_class_xmi_id = xml_node.attribute_with_ns('id',xmiNS.href).to_s - owning_class = element_hash[owning_class_xmi_id] - owned_class = element_hash[owned_class_xmi_id] - owning_class.nested_classifier.push owned_class - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Realization' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - supplier_xmi_id = xml_node.at('supplier')['idref'] - client_xmi_id = xml_node.at('client')['idref'] - this_thing.supplier.push element_hash[supplier_xmi_id] - this_thing.client.push element_hash[client_xmi_id] - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Abstraction' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - supplier_xmi_id = xml_node.at('supplier')['idref'] - client_xmi_id = xml_node.at('client')['idref'] - this_thing.supplier.push element_hash[supplier_xmi_id] - this_thing.client.push element_hash[client_xmi_id] - end - - if xml_node.name.to_s == 'Block' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_class_xmi_id = xml_node['base_Class'] - this_thing.base_class = element_hash[base_class_xmi_id] - end - - if xml_node.name.to_s == 'Template' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_class_xmi_id = xml_node['base_Class'] - this_thing.base_class = element_hash[base_class_xmi_id] - this_thing.base_class.stereotype.push 'Template' - end - - if xml_node.name.to_s == 'ConstraintBlock' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_class_xmi_id = xml_node['base_Class'] - this_thing.base_class = element_hash[base_class_xmi_id] - end - - if xml_node.name.to_s.index('Requirement') or xml_node.name.to_s == 'designConstraint' - if xml_node.name.to_s != 'RequirementRelated' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_class_xmi_id = xml_node['base_Class'] - this_thing.base_class = element_hash[base_class_xmi_id] - this_thing.refined_by = element_hash[xml_node['RefinedBy']] - this_thing.derived_from = element_hash[xml_node['DerivedFrom']] - this_thing.traced_to = element_hash[xml_node['TracedTo']] - end - end - - if xml_node.name.to_s == 'TestCase' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - this_thing.base_behavior = element_hash[xml_node['base_Behavior']] - this_thing.verifies = element_hash[xml_node['Verifies']] - end - - if xml_node.name.to_s == 'BindingConnector' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_connector_xmi_id = xml_node['base_Connector'] - this_thing.base_connector = element_hash[base_connector_xmi_id] - end - - if xml_node.name.to_s == 'NestedConnectorEnd' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_connectorend_xmi_id = xml_node['base_ConnectorEnd'] - this_thing.base_connectorend = element_hash[base_connectorend_xmi_id] - if xml_node['propertyPath'] != nil - this_thing.property_path.push element_hash[xml_node['propertyPath']] - else - for prop_path in xml_node.xpath('./propertyPath') - #to deal with href = '#xmi:id' i.e. local references - href_parts = prop_path['href'].split('#') - if href_parts[0].size == 0 - prop = element_hash[href_parts[1]] - else - prop = element_hash[prop_path['href']] - end - this_thing.property_path.push prop - end - end - end - - if xml_node.name.to_s == 'Satisfy' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_realization_xmi_id = xml_node['base_Realization'] - this_thing.base_realization = element_hash[base_realization_xmi_id] - end - - if ['DeriveReqt', 'refine', 'trace', 'Copy', 'Verify', 'Allocate', ''].include? xml_node.name.to_s - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - base_abstraction_xmi_id = xml_node['base_Abstraction'] - this_thing.base_abstraction = element_hash[base_abstraction_xmi_id] - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Association' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - member_end_list = xml_node.xpath('./memberEnd') - for item in member_end_list - this_thing.member_end.push element_hash[item['idref']] - end - owned_end_list = xml_node.xpath('./ownedEnd') - for item in owned_end_list - this_thing.owned_end.push element_hash[item.attribute_with_ns('id',xmiNS.href).to_s] - end - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Property' or xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Port' - if not ['definingFeature', 'partWithPort', 'propertyPath', 'role'].include? xml_node.name.to_s - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - if xml_node['association'] != nil - this_thing.association = element_hash[xml_node['association']] - end - if xml_node['aggregation'] != nil - this_thing.aggregation = xml_node['aggregation'] - end - if xml_node['visibility'] != nil - this_thing.visibility = xml_node['visibility'] - end - - if xml_node.at('lowerValue') != nil - - if xml_node.at('lowerValue')['value'] != nil - this_thing.lowerValue = xml_node.at('lowerValue')['value'] - else - this_thing.lowerValue = '0' - end - end - if xml_node.at('upperValue') != nil - this_thing.upperValue = xml_node.at('upperValue')['value'] - end - end - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:Connector' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - connector_end_list = xml_node.xpath('./end') - for end_xml_node in connector_end_list - this_thing.connector_end.push element_hash[end_xml_node.attribute_with_ns('id',xmiNS.href).to_s] - end - end - - if xml_node.attribute_with_ns('type',xmiNS.href).to_s == 'uml:ConnectorEnd' - this_thing = element_hash[xml_node.attribute_with_ns('id',xmiNS.href).to_s] - this_thing.connector = element_hash[xml_node.parent.attribute_with_ns('id',xmiNS.href).to_s] - this_thing.role = element_hash[xml_node['role']] - if this_thing.role == nil - this_thing.role = element_hash[xml_node.at('role')['href']] - end - this_thing.part_with_port = element_hash[xml_node['part_with_port']] - end - end - end -end -end diff --git a/lutaml-sysml.gemspec b/lutaml-sysml.gemspec index a9c6a4d..258227f 100644 --- a/lutaml-sysml.gemspec +++ b/lutaml-sysml.gemspec @@ -1,36 +1,24 @@ -require_relative 'lib/lutaml/sysml/version' - -Gem::Specification.new do |spec| - spec.name = "lutaml-sysml" - spec.version = Lutaml::Sysml::VERSION - spec.authors = ["Ribose Inc."] - spec.email = ["open.source@ribose.com'"] - - spec.summary = "SysML model module for LutaML." - spec.description = "SysML model module for LutaML." - spec.homepage = "https://github.com/lutaml/lutaml-sysml" - spec.license = "MIT" - - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = spec.homepage - spec.metadata["changelog_uri"] = "https://github.com/lutaml/lutaml-sysml/releases" - - spec.files = `git ls-files`.split("\n") - spec.test_files = `git ls-files -- {spec}/*`.split("\n") - - spec.bindir = "exe" - spec.require_paths = ["lib"] - spec.executables = %w[lutaml-sysml] - - spec.required_ruby_version = '>= 2.7.0' - - spec.add_runtime_dependency "thor", "~> 1.0" - # spec.add_runtime_dependency "lutaml-uml" - spec.add_development_dependency "lutaml-uml" - spec.add_development_dependency "nokogiri", "~> 1.10" - - spec.add_development_dependency "bundler", "~> 2.0" - spec.add_development_dependency "pry", "~> 0.12.2" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "rspec", "~> 3.0" +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = "lutaml-sysml" + s.version = "1.0.0" + s.authors = ["Ribose Inc."] + s.email = ["open.source@ribose.com"] + + s.homepage = "http://github.com/lutaml/lutaml" + s.summary = "Lutaml stub gem for lutaml-sysml" + s.description = "Lutaml stub gem for lutaml-sysml" + s.license = "BSD-2-Clause" + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- exe/*`.split("\n").map do |f| + File.basename(f) + end + s.bindir = "exe" + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 2.7.0") + + s.add_dependency "lutaml", "> 0.7.7" end diff --git a/spec/lutaml/sysml_spec.rb b/spec/lutaml/sysml_spec.rb deleted file mode 100644 index 5d17d9b..0000000 --- a/spec/lutaml/sysml_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -RSpec.describe Lutaml::Sysml do - it "has a version number" do - expect(Lutaml::Sysml::VERSION).not_to be nil - end - - # it "does something useful" do - # expect(false).to eq(true) - # end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 0aaf94a..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,14 +0,0 @@ -require "bundler/setup" -require "lutaml/sysml" - -RSpec.configure do |config| - # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = ".rspec_status" - - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! - - config.expect_with :rspec do |c| - c.syntax = :expect - end -end