structurizr 1.26.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +1 -0
  3. data/.github/workflows/ci.yml +35 -0
  4. data/.gitignore +13 -0
  5. data/.jrubyrc +1 -0
  6. data/.reek.yml +127 -0
  7. data/.rubocop.yml +108 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +6 -0
  10. data/Makefile +30 -0
  11. data/README.md +65 -0
  12. data/bin/console +15 -0
  13. data/bin/test +9 -0
  14. data/exe/structurizr-repl +14 -0
  15. data/lib/com/fasterxml/jackson/core/jackson-annotations/2.14.2/jackson-annotations-2.14.2.jar +0 -0
  16. data/lib/com/fasterxml/jackson/core/jackson-core/2.14.2/jackson-core-2.14.2.jar +0 -0
  17. data/lib/com/fasterxml/jackson/core/jackson-databind/2.14.2/jackson-databind-2.14.2.jar +0 -0
  18. data/lib/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar +0 -0
  19. data/lib/com/structurizr/structurizr-client/1.26.1/structurizr-client-1.26.1.jar +0 -0
  20. data/lib/com/structurizr/structurizr-core/1.26.1/structurizr-core-1.26.1.jar +0 -0
  21. data/lib/com/structurizr/structurizr-documentation/1.1.1/structurizr-documentation-1.1.1.jar +0 -0
  22. data/lib/com/structurizr/structurizr-dsl/1.32.0/structurizr-dsl-1.32.0.jar +0 -0
  23. data/lib/com/structurizr/structurizr-export/1.16.1/structurizr-export-1.16.1.jar +0 -0
  24. data/lib/com/structurizr/structurizr-graphviz/2.2.1/structurizr-graphviz-2.2.1.jar +0 -0
  25. data/lib/com/structurizr/structurizr-import/1.5.0/structurizr-import-1.5.0.jar +0 -0
  26. data/lib/commons-logging/commons-logging/1.2/commons-logging-1.2.jar +0 -0
  27. data/lib/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar +0 -0
  28. data/lib/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar +0 -0
  29. data/lib/org/apache/httpcomponents/client5/httpclient5/5.2.1/httpclient5-5.2.1.jar +0 -0
  30. data/lib/org/apache/httpcomponents/core5/httpcore5/5.2/httpcore5-5.2.jar +0 -0
  31. data/lib/org/apache/httpcomponents/core5/httpcore5-h2/5.2/httpcore5-h2-5.2.jar +0 -0
  32. data/lib/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar +0 -0
  33. data/lib/structurizr/border.rb +7 -0
  34. data/lib/structurizr/component.rb +7 -0
  35. data/lib/structurizr/container.rb +7 -0
  36. data/lib/structurizr/enterprise.rb +7 -0
  37. data/lib/structurizr/enums.rb +11 -0
  38. data/lib/structurizr/filter_mode.rb +7 -0
  39. data/lib/structurizr/format.rb +7 -0
  40. data/lib/structurizr/image_utils.rb +7 -0
  41. data/lib/structurizr/interaction_style.rb +7 -0
  42. data/lib/structurizr/location.rb +13 -0
  43. data/lib/structurizr/metal.rb +31 -0
  44. data/lib/structurizr/model.rb +13 -0
  45. data/lib/structurizr/model_item.rb +18 -0
  46. data/lib/structurizr/paper_size.rb +7 -0
  47. data/lib/structurizr/person.rb +7 -0
  48. data/lib/structurizr/relationship.rb +19 -0
  49. data/lib/structurizr/repl/commands.rb +55 -0
  50. data/lib/structurizr/repl.rb +91 -0
  51. data/lib/structurizr/routing.rb +7 -0
  52. data/lib/structurizr/shape.rb +7 -0
  53. data/lib/structurizr/software_system.rb +7 -0
  54. data/lib/structurizr/tags.rb +7 -0
  55. data/lib/structurizr/version.rb +5 -0
  56. data/lib/structurizr/workspace.rb +23 -0
  57. data/lib/structurizr.rb +21 -0
  58. data/structurizr.gemspec +44 -0
  59. metadata +194 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 378c1ca8e4f0ea42e5ec932f434258d944680f767c87ebf9a921457c7182bd03
4
+ data.tar.gz: bb40e1832e297bb29d3a4199d77f80f8ce82fe050bbbe5ba7c97e20ad7e6a176
5
+ SHA512:
6
+ metadata.gz: 904248a8135a368f583039b1903a2d9ebfa6eabbf916e0c3441fb44c5ba56f6574845a6238650e88535a3572b4d666bc88f26ed6b6e33e190c8de5c5ca295221
7
+ data.tar.gz: 559aab2b564f0e62463c18e31a5f1f7b34140b76615d10999006b69ff66f84874f615a812bdec48ca20830b769487514a76ad32eb1206646e34352f62ecaac23
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ *.jar filter=lfs diff=lfs merge=lfs -text
@@ -0,0 +1,35 @@
1
+ name: ci
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby_version: [jruby]
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ with:
15
+ lfs: true
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby_version }}
20
+ - name: Download CodeClimate reporter
21
+ run: |
22
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
23
+ chmod +x ./cc-test-reporter
24
+ ./cc-test-reporter before-build
25
+ env:
26
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
27
+ - name: Build and test
28
+ run: |
29
+ make bundle
30
+ make test
31
+ - name: Report to CodeClimate
32
+ run: |
33
+ ./cc-test-reporter after-build --exit-code 0
34
+ env:
35
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ Gemfile.lock
11
+ .rbnext/
12
+
13
+ lib/**/*.jar
data/.jrubyrc ADDED
@@ -0,0 +1 @@
1
+ debug.fullTrace=true
data/.reek.yml ADDED
@@ -0,0 +1,127 @@
1
+ detectors:
2
+ Attribute:
3
+ enabled: false
4
+ exclude: []
5
+ BooleanParameter:
6
+ enabled: true
7
+ exclude: []
8
+ ClassVariable:
9
+ enabled: false
10
+ exclude: []
11
+ ControlParameter:
12
+ enabled: true
13
+ exclude: []
14
+ DataClump:
15
+ enabled: true
16
+ exclude: []
17
+ max_copies: 2
18
+ min_clump_size: 2
19
+ DuplicateMethodCall:
20
+ enabled: true
21
+ exclude: []
22
+ max_calls: 1
23
+ allow_calls: []
24
+ FeatureEnvy:
25
+ enabled: true
26
+ exclude: []
27
+ InstanceVariableAssumption:
28
+ enabled: false
29
+ IrresponsibleModule:
30
+ enabled: false
31
+ exclude: []
32
+ LongParameterList:
33
+ enabled: true
34
+ exclude: []
35
+ max_params: 4
36
+ overrides:
37
+ initialize:
38
+ max_params: 5
39
+ LongYieldList:
40
+ enabled: true
41
+ exclude: []
42
+ max_params: 3
43
+ ManualDispatch:
44
+ enabled: true
45
+ exclude: []
46
+ MissingSafeMethod:
47
+ enabled: false
48
+ exclude: []
49
+ ModuleInitialize:
50
+ enabled: true
51
+ exclude: []
52
+ NestedIterators:
53
+ enabled: true
54
+ exclude: []
55
+ max_allowed_nesting: 2
56
+ ignore_iterators: []
57
+ NilCheck:
58
+ enabled: false
59
+ exclude: []
60
+ RepeatedConditional:
61
+ enabled: true
62
+ exclude: []
63
+ max_ifs: 3
64
+ SubclassedFromCoreClass:
65
+ enabled: true
66
+ exclude: []
67
+ TooManyConstants:
68
+ enabled: true
69
+ exclude: []
70
+ max_constants: 5
71
+ TooManyInstanceVariables:
72
+ enabled: true
73
+ exclude: []
74
+ max_instance_variables: 9
75
+ TooManyMethods:
76
+ enabled: true
77
+ exclude: []
78
+ max_methods: 25
79
+ TooManyStatements:
80
+ enabled: true
81
+ exclude:
82
+ - initialize
83
+ max_statements: 12
84
+ UncommunicativeMethodName:
85
+ enabled: true
86
+ exclude: []
87
+ reject:
88
+ - "/^[a-z]$/"
89
+ - "/[0-9]$/"
90
+ - "/[A-Z]/"
91
+ accept: []
92
+ UncommunicativeModuleName:
93
+ enabled: true
94
+ exclude: []
95
+ reject:
96
+ - "/^.$/"
97
+ - "/[0-9]$/"
98
+ accept:
99
+ - Inline::C
100
+ - "/V[0-9]/"
101
+ UncommunicativeParameterName:
102
+ enabled: true
103
+ exclude: []
104
+ reject:
105
+ - "/^.$/"
106
+ - "/[0-9]$/"
107
+ - "/[A-Z]/"
108
+ accept: []
109
+ UncommunicativeVariableName:
110
+ enabled: true
111
+ exclude: []
112
+ reject:
113
+ - "/^.$/"
114
+ - "/[0-9]$/"
115
+ - "/[A-Z]/"
116
+ accept:
117
+ - _
118
+ UnusedParameters:
119
+ enabled: true
120
+ exclude: []
121
+ UnusedPrivateMethod:
122
+ enabled: false
123
+ UtilityFunction:
124
+ enabled: false
125
+
126
+ exclude_paths:
127
+ - config
data/.rubocop.yml ADDED
@@ -0,0 +1,108 @@
1
+ require:
2
+ - ruby-next/rubocop
3
+
4
+ AllCops:
5
+ NewCops: enable
6
+ TargetRubyVersion: 2.5
7
+ Exclude:
8
+ - 'lib/.rbnext/**/*'
9
+
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ Layout/SpaceBeforeFirstArg:
14
+ Exclude:
15
+
16
+ Lint/AmbiguousBlockAssociation:
17
+ Exclude:
18
+ - spec/**/*
19
+
20
+ Metrics/AbcSize:
21
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
22
+ # a Float.
23
+ Max: 15
24
+
25
+ Metrics/BlockLength:
26
+ CountComments: false
27
+ Max: 25
28
+ Exclude:
29
+ - '*.gemspec'
30
+ - config/**/*
31
+ - spec/**/*
32
+ ExcludedMethods:
33
+ - class_methods
34
+
35
+ Metrics/BlockNesting:
36
+ Max: 4
37
+
38
+ Metrics/ClassLength:
39
+ CountComments: false
40
+ Max: 200
41
+
42
+ # Avoid complex methods.
43
+ Metrics/CyclomaticComplexity:
44
+ Max: 7
45
+
46
+ Metrics/MethodLength:
47
+ CountComments: false
48
+ Max: 24
49
+
50
+ Metrics/ModuleLength:
51
+ CountComments: false
52
+ Max: 200
53
+
54
+ Layout/LineLength:
55
+ Max: 100
56
+ # To make it possible to copy or click on URIs in the code, we allow lines
57
+ # containing a URI to be longer than Max.
58
+ AllowURI: true
59
+ URISchemes:
60
+ - http
61
+ - https
62
+
63
+ Metrics/ParameterLists:
64
+ Max: 5
65
+ CountKeywordArgs: true
66
+
67
+ Metrics/PerceivedComplexity:
68
+ Max: 12
69
+
70
+ Style/FrozenStringLiteralComment:
71
+ Enabled: true
72
+
73
+ Style/ModuleFunction:
74
+ Enabled: false
75
+
76
+ Style/RescueModifier:
77
+ Exclude:
78
+ - spec/**/*
79
+
80
+ Naming/PredicateName:
81
+ Enabled: false
82
+
83
+ Style/HashEachMethods:
84
+ Enabled: true
85
+
86
+ Style/HashTransformKeys:
87
+ Enabled: true
88
+
89
+ Style/HashTransformValues:
90
+ Enabled: true
91
+
92
+ Style/RedundantSelf:
93
+ Enabled: false
94
+
95
+ Naming/VariableName:
96
+ Enabled: false
97
+
98
+ Lint/UselessAssignment:
99
+ Enabled: false
100
+
101
+ Metrics/AbcSize:
102
+ Exclude:
103
+ - test/**/*
104
+
105
+ Metrics/MethodLength:
106
+ Max: 20
107
+ Exclude:
108
+ - test/**/*
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at igor@morozov.is. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in structurizr.gemspec
6
+ gemspec
data/Makefile ADDED
@@ -0,0 +1,30 @@
1
+ .PHONY: test transpile install setup bundle lint console download-jars build-gem build
2
+
3
+ test:
4
+ jruby -Itest -Ilib bin/test
5
+
6
+ transpile:
7
+ ruby-next nextify ./lib
8
+
9
+ install:
10
+ jruby -S gem install bundler
11
+ jruby -S bundle install
12
+
13
+ setup: install transpile
14
+
15
+ bundle:
16
+ jruby -S bundle
17
+
18
+ lint:
19
+ jruby -S bundle exec rubocop
20
+
21
+ console:
22
+ bin/console
23
+
24
+ download-jars:
25
+ jruby -rjars/installer -e 'Jars::Installer.vendor_jars!'
26
+
27
+ build-gem:
28
+ gem build
29
+
30
+ build: transpile build-gem
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Structurizr
2
+
3
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/b75e8c130fc8b3bf54b5/test_coverage)](https://codeclimate.com/github/Morozzzko/structurizr-ruby/test_coverage)[![Maintainability](https://api.codeclimate.com/v1/badges/b75e8c130fc8b3bf54b5/maintainability)](https://codeclimate.com/github/Morozzzko/structurizr-ruby/maintainability)
4
+
5
+
6
+ `structurizr-ruby` brings the [C4 model](https://c4model.com) to Ruby. It piggybacks on top of [Java's API](https://github.com/structurizr/java) for [Structurizr](https://structurizr.com), which is a powerful tool for incorporating C4 model into your software architecture process.
7
+
8
+ The primary goal is to enable better introspection & scripting for workspaces defined by Structurizr DSL.
9
+
10
+ Number 1 feature of this library is actually a runnable `REPL` which allows a flexible introspection. You can run it via `structurizr-repl <workspace.json>`.
11
+
12
+ As a bonus, this library provides a complete integration to build Structurizr workspace from Ruby. However, it doesn't make much sense since there's [Structurizr DSL](https://structurizr.com/help/dsl). However, it's still a bit useful if you're using [DSL's scripting feature](https://github.com/structurizr/dsl/blob/master/docs/language-reference.md#scripts), you might find this library a bit useful.
13
+
14
+ If you've met something which doesn't have a nice Ruby DSL, you can always use [`Structurizr::Metal`](/lib/structurizr/metal.rb) to access Java classes and methods. Please don't forget to [submit issue or a pull-request](#Contributing) which describes your use-case and the missing features.
15
+
16
+ ## Versioning
17
+
18
+ After entering 1.0, this library will follow Structurizr-core versioning. If the gem bundles `structurizr-core` 1.26.1, the gem will use version 1.26.1.
19
+
20
+ Since Structurizr **does not follow SemVer**, there are no guarantees that minor versions won't break anything.
21
+
22
+ At least we have version parity with Structurizr.
23
+
24
+ ## Installation
25
+
26
+ Install the gem:
27
+
28
+ $ jruby -S gem install structurizr
29
+
30
+ or add it to your Gemfile via CLI:
31
+
32
+ $ jruby -S bundle add structurizr
33
+
34
+ or just edit your `Gemfile` manually:
35
+
36
+ ```ruby
37
+ # Gemfile
38
+
39
+ gem 'structurizr'
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ Before you start, you need to `require` the necessary files:
45
+
46
+ ```ruby
47
+ require 'structurizr'
48
+ ```
49
+
50
+ If you have a `workspace.json`, you can run an interactive REPL to read values from it: `structurizr-repl workspace.json`
51
+
52
+ ## Development
53
+
54
+ After checking out the repo, run `make setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
55
+
56
+ To install this gem onto your local machine, run `jruby -S 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).
57
+
58
+ ## Contributing
59
+
60
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Morozzzko/structurizr. 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/Morozzzko/structurizr-ruby/blob/master/CODE_OF_CONDUCT.md).
61
+
62
+
63
+ ## Code of Conduct
64
+
65
+ Everyone interacting in the Structurizr project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Morozzzko/structurizr-ruby/blob/master/CODE_OF_CONDUCT.md).
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env jruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'structurizr'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/test ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env jruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'test_helper'
6
+
7
+ Dir[File.join(__dir__, '../test/**/*_test.rb')].sort.each do |test_path|
8
+ require test_path
9
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env jruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'structurizr'
5
+ require 'structurizr/repl'
6
+ require 'ruby-next/pry'
7
+
8
+ application = Structurizr::REPL::Application.new(ARGV)
9
+
10
+ application.parse_workspace_path!
11
+ application.prepare_context!
12
+ application.setup_pry!
13
+
14
+ application.start
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Border = Metal::View::Border
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Component = Metal::Model::Component
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Container = Metal::Model::Container
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Enterprise = Metal::Model::Enterprise
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/interaction_style'
4
+ require 'structurizr/location'
5
+ require 'structurizr/paper_size'
6
+ require 'structurizr/tags'
7
+ require 'structurizr/shape'
8
+ require 'structurizr/border'
9
+ require 'structurizr/format'
10
+ require 'structurizr/routing'
11
+ require 'structurizr/filter_mode'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ FilterMode = Metal::View::FilterMode
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Format = Metal::Documentation::Format
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ ImageUtils = Metal::Util::ImageUtils
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ InteractionStyle = Metal::Model::InteractionStyle
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Location = Metal::Model::Location
7
+
8
+ class Location
9
+ def inspect
10
+ %(#<Structurizr::Location::#{name}>)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'java'
4
+
5
+ require 'structurizr_jars'
6
+
7
+ module Structurizr
8
+ # This namespace provides lower-level Java integration with Structurizr
9
+ module Metal
10
+ Root = ::Java::ComStructurizr
11
+ Model = ::Java::ComStructurizrModel
12
+ View = ::Java::ComStructurizrView
13
+ Client = ::Java::ComStructurizrClient
14
+ Util = ::Java::ComStructurizrUtil
15
+ Documentation = ::Java::ComStructurizrDocumentation
16
+
17
+ # We need it due to a behavior in jruby which doesn't bind methods from non-public classes
18
+ # https://github.com/jruby/jruby/issues/6197
19
+ # For now we'll stick to our own patch which manually binds those methods
20
+ class Model::ModelItem
21
+ java_alias :addTags, :addTags, [java.lang.String[]]
22
+ java_alias :add_tags, :addTags, [java.lang.String[]]
23
+ java_alias :getTags, :getTags, []
24
+ java_alias :get_tags, :getTags, []
25
+ java_alias :removeTag, :removeTag, [java.lang.String]
26
+ java_alias :remove_tag, :removeTag, [java.lang.String]
27
+ java_alias :hasTag, :hasTag, [java.lang.String]
28
+ java_alias :has_tag, :hasTag, [java.lang.String]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Model = Metal::Model::Model
7
+
8
+ class Model
9
+ def elements
10
+ get_elements.to_a
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ ModelItem = Metal::Model::ModelItem
7
+
8
+ class ModelItem
9
+ def tags
10
+ get_tags.split(',')
11
+ end
12
+
13
+ def inspect
14
+ class_name = self.class.name.split('::').last
15
+ %(#<Structurizr::#{class_name}(#{name.inspect})>)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ PaperSize = Metal::View::PaperSize
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Person = Metal::Model::Person
7
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Relationship = Metal::Model::Relationship
7
+
8
+ class Relationship
9
+ def inspect
10
+ parts = [
11
+ "#{source.name.inspect} -> #{destination.name.inspect}",
12
+ description.inspect,
13
+ technology.inspect
14
+ ].reject(&:empty?).join(" ")
15
+
16
+ %(#<#{parts}>)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Structurizr
4
+ module REPL
5
+ module Commands
6
+ class Workspace < Pry::ClassCommand
7
+ match 'workspace'
8
+ description 'Access current workspace'
9
+ group 'Structurizr'
10
+ command_options keep_retval: true
11
+
12
+ def process
13
+ target_self.workspace
14
+ end
15
+ end
16
+
17
+ class Model < Pry::ClassCommand
18
+ match 'model'
19
+ description "Access current workspace's model"
20
+ group 'Structurizr'
21
+ command_options keep_retval: true
22
+
23
+ def process
24
+ target_self.workspace.model
25
+ end
26
+ end
27
+
28
+ module Shortcuts
29
+ All = Pry::CommandSet.new
30
+
31
+ {
32
+ 'Relationships' => 'relationships',
33
+ 'Elements' => 'elements',
34
+ 'People' => 'people',
35
+ 'SoftwareSystems' => 'software_systems'
36
+ }.each do |class_name, attribute_name|
37
+ shortcut_class = Class.new(Pry::ClassCommand) do
38
+ match attribute_name
39
+ description "Access model's #{attribute_name}"
40
+ group 'Structurizr'
41
+ command_options keep_retval: true
42
+
43
+ define_method :process do
44
+ target_self.workspace.model.public_send(attribute_name.to_sym)
45
+ end
46
+ end
47
+
48
+ const_set(class_name, shortcut_class)
49
+
50
+ All.add_command shortcut_class
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pry'
4
+ require 'structurizr/repl/commands'
5
+
6
+ module Structurizr
7
+ module REPL
8
+ # Simple module which defines a reader for a nested attribute
9
+ module Delegation
10
+ def delegate(*methods, to:)
11
+ methods.each do |method|
12
+ define_method method do
13
+ public_send(to).public_send(method)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ InvalidWorkspaceFileError = Class.new(StandardError)
20
+
21
+ class Context
22
+ extend Delegation
23
+
24
+ attr_reader :workspace
25
+
26
+ delegate :model, to: :workspace
27
+ delegate :relationships, :elements, :software_systems, :people, to: :model
28
+
29
+ def initialize(workspace)
30
+ @workspace = workspace
31
+ end
32
+ end
33
+
34
+ class Application
35
+ attr_reader :context, :workspace_path, :argv
36
+
37
+ def initialize(argv)
38
+ @argv = argv
39
+ end
40
+
41
+ def parse_workspace_path!
42
+ @workspace_path =
43
+ if (input_path = argv.first) && File.file?(input_path)
44
+ argv.first
45
+ else
46
+ puts 'Usage: structurizr-repl <path/to/structurizr.json>'
47
+
48
+ raise InvalidWorkspaceFileError, 'Please specify a valid path'
49
+ end
50
+ end
51
+
52
+ def prepare_context!
53
+ @context = Structurizr::REPL::Context.new(
54
+ Structurizr::Workspace.from_json(
55
+ File.read(workspace_path)
56
+ )
57
+ )
58
+ end
59
+
60
+ def setup_pry!
61
+ setup_welcome_message
62
+ register_commands
63
+ end
64
+
65
+ def start
66
+ Pry.start(context)
67
+ end
68
+
69
+ private
70
+
71
+ def register_commands
72
+ Pry::Commands.add_command Structurizr::REPL::Commands::Workspace
73
+ Pry::Commands.add_command Structurizr::REPL::Commands::Model
74
+ Pry::Commands.import Structurizr::REPL::Commands::Shortcuts::All
75
+ end
76
+
77
+ def setup_welcome_message
78
+ Pry.hooks.add_hook(
79
+ :before_session,
80
+ :structurizr_welcome_message
81
+ ) do |output, _binding, _pry|
82
+ output.puts <<~ECHO
83
+ Welcome to Structurizr REPL
84
+
85
+ Type `help structurizr` to get a list of commands
86
+ ECHO
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Routing = Metal::View::Routing
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Shape = Metal::View::Shape
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ SoftwareSystem = Metal::Model::SoftwareSystem
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+
5
+ module Structurizr
6
+ Tags = Metal::Model::Tags
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Structurizr
4
+ VERSION = '1.26.1'
5
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'structurizr/metal'
4
+ require 'structurizr/model'
5
+ require 'structurizr/enterprise'
6
+
7
+ module Structurizr
8
+ Workspace = Metal::Root::Workspace
9
+
10
+ class Workspace
11
+ def to_json(*_args)
12
+ Metal::Util::WorkspaceUtils.to_json(self, true)
13
+ end
14
+
15
+ def self.from_json(json)
16
+ Metal::Util::WorkspaceUtils.from_json(json)
17
+ end
18
+
19
+ def inspect
20
+ %(#<Structurizr::Workspace(#{name.inspect})>)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-next/language/setup'
4
+ RubyNext::Language.setup_gem_load_path
5
+
6
+ require 'structurizr/version'
7
+ require 'structurizr/model_item'
8
+ require 'structurizr/workspace'
9
+ require 'structurizr/container'
10
+ require 'structurizr/component'
11
+ require 'structurizr/relationship'
12
+ require 'structurizr/software_system'
13
+ require 'structurizr/person'
14
+
15
+ require 'structurizr/enums'
16
+
17
+ require 'structurizr/image_utils'
18
+
19
+ module Structurizr
20
+ class Error < StandardError; end
21
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/structurizr/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'structurizr'
7
+ spec.version = Structurizr::VERSION
8
+ spec.authors = ['Igor S. Morozov']
9
+ spec.email = ['igor@morozov.is']
10
+
11
+ spec.summary = 'C4 model in Ruby. Wrapper for Structurizr API'
12
+ spec.homepage = 'https://github.com/Morozzzko/structurizr-ruby'
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = spec.homepage
17
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.files += Dir['lib/**/*.jar']
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'pry'
30
+ spec.add_dependency 'ruby-next'
31
+ spec.add_development_dependency 'minitest'
32
+ spec.add_development_dependency 'rubocop'
33
+ spec.add_development_dependency 'rubocop-minitest'
34
+ spec.add_development_dependency 'simplecov', '~> 0.17.1'
35
+
36
+ spec.platform = 'java'
37
+ spec.requirements << "jar com.structurizr, structurizr-core, #{Structurizr::VERSION}"
38
+ spec.requirements << "jar com.structurizr, structurizr-client, #{Structurizr::VERSION}"
39
+ spec.requirements << "jar com.structurizr, structurizr-documentation, 1.1.1"
40
+ spec.requirements << "jar com.structurizr, structurizr-graphviz, 2.2.1"
41
+ spec.requirements << "jar com.structurizr, structurizr-export, 1.16.1"
42
+ spec.requirements << "jar com.structurizr, structurizr-import, 1.5.0"
43
+ spec.requirements << "jar com.structurizr, structurizr-dsl, 1.32.0"
44
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: structurizr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.26.1
5
+ platform: java
6
+ authors:
7
+ - Igor S. Morozov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: pry
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ name: ruby-next
34
+ prerelease: false
35
+ type: :runtime
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ name: minitest
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: rubocop
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ name: rubocop-minitest
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.17.1
89
+ name: simplecov
90
+ prerelease: false
91
+ type: :development
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.17.1
97
+ description:
98
+ email:
99
+ - igor@morozov.is
100
+ executables:
101
+ - structurizr-repl
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitattributes"
106
+ - ".github/workflows/ci.yml"
107
+ - ".gitignore"
108
+ - ".jrubyrc"
109
+ - ".reek.yml"
110
+ - ".rubocop.yml"
111
+ - CODE_OF_CONDUCT.md
112
+ - Gemfile
113
+ - Makefile
114
+ - README.md
115
+ - bin/console
116
+ - bin/test
117
+ - exe/structurizr-repl
118
+ - lib/com/fasterxml/jackson/core/jackson-annotations/2.14.2/jackson-annotations-2.14.2.jar
119
+ - lib/com/fasterxml/jackson/core/jackson-core/2.14.2/jackson-core-2.14.2.jar
120
+ - lib/com/fasterxml/jackson/core/jackson-databind/2.14.2/jackson-databind-2.14.2.jar
121
+ - lib/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
122
+ - lib/com/structurizr/structurizr-client/1.26.1/structurizr-client-1.26.1.jar
123
+ - lib/com/structurizr/structurizr-core/1.26.1/structurizr-core-1.26.1.jar
124
+ - lib/com/structurizr/structurizr-documentation/1.1.1/structurizr-documentation-1.1.1.jar
125
+ - lib/com/structurizr/structurizr-dsl/1.32.0/structurizr-dsl-1.32.0.jar
126
+ - lib/com/structurizr/structurizr-export/1.16.1/structurizr-export-1.16.1.jar
127
+ - lib/com/structurizr/structurizr-graphviz/2.2.1/structurizr-graphviz-2.2.1.jar
128
+ - lib/com/structurizr/structurizr-import/1.5.0/structurizr-import-1.5.0.jar
129
+ - lib/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
130
+ - lib/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar
131
+ - lib/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar
132
+ - lib/org/apache/httpcomponents/client5/httpclient5/5.2.1/httpclient5-5.2.1.jar
133
+ - lib/org/apache/httpcomponents/core5/httpcore5-h2/5.2/httpcore5-h2-5.2.jar
134
+ - lib/org/apache/httpcomponents/core5/httpcore5/5.2/httpcore5-5.2.jar
135
+ - lib/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
136
+ - lib/structurizr.rb
137
+ - lib/structurizr/border.rb
138
+ - lib/structurizr/component.rb
139
+ - lib/structurizr/container.rb
140
+ - lib/structurizr/enterprise.rb
141
+ - lib/structurizr/enums.rb
142
+ - lib/structurizr/filter_mode.rb
143
+ - lib/structurizr/format.rb
144
+ - lib/structurizr/image_utils.rb
145
+ - lib/structurizr/interaction_style.rb
146
+ - lib/structurizr/location.rb
147
+ - lib/structurizr/metal.rb
148
+ - lib/structurizr/model.rb
149
+ - lib/structurizr/model_item.rb
150
+ - lib/structurizr/paper_size.rb
151
+ - lib/structurizr/person.rb
152
+ - lib/structurizr/relationship.rb
153
+ - lib/structurizr/repl.rb
154
+ - lib/structurizr/repl/commands.rb
155
+ - lib/structurizr/routing.rb
156
+ - lib/structurizr/shape.rb
157
+ - lib/structurizr/software_system.rb
158
+ - lib/structurizr/tags.rb
159
+ - lib/structurizr/version.rb
160
+ - lib/structurizr/workspace.rb
161
+ - structurizr.gemspec
162
+ homepage: https://github.com/Morozzzko/structurizr-ruby
163
+ licenses: []
164
+ metadata:
165
+ homepage_uri: https://github.com/Morozzzko/structurizr-ruby
166
+ source_code_uri: https://github.com/Morozzzko/structurizr-ruby
167
+ changelog_uri: https://github.com/Morozzzko/structurizr-ruby/blob/master/CHANGELOG.md
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 2.3.0
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements:
183
+ - jar com.structurizr, structurizr-core, 1.26.1
184
+ - jar com.structurizr, structurizr-client, 1.26.1
185
+ - jar com.structurizr, structurizr-documentation, 1.1.1
186
+ - jar com.structurizr, structurizr-graphviz, 2.2.1
187
+ - jar com.structurizr, structurizr-export, 1.16.1
188
+ - jar com.structurizr, structurizr-import, 1.5.0
189
+ - jar com.structurizr, structurizr-dsl, 1.32.0
190
+ rubygems_version: 3.3.26
191
+ signing_key:
192
+ specification_version: 4
193
+ summary: C4 model in Ruby. Wrapper for Structurizr API
194
+ test_files: []