structurizr 1.0.0.pre.alpha.1 → 1.0.0.pre.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/Makefile +11 -15
- data/exe/structurizr-repl +13 -0
- data/lib/structurizr/repl/commands.rb +55 -0
- data/lib/structurizr/repl.rb +91 -0
- data/lib/structurizr/version.rb +1 -1
- data/structurizr.gemspec +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe8a005a3c60de0672a5d97461b0ec492efc28cdd47b9ccce953adbb405b032a
|
4
|
+
data.tar.gz: 2c7e7fa0f87ac51bdc9a78adb68be7c640b2f1f04e01b93d28912031a18de16d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e3190211889b56a2a8721050c658253bcb6971a8a14ebf1baa7afecea7457437b8f964ed973678eccf84adad97dd8b50683433475056d201a0861b9836144d
|
7
|
+
data.tar.gz: 04dc35d206db7f33cee95cbe3adb8668e8bd4536e1d550f69e4118a1d2575f2d24f362d030c263ae3b6e31d29fb7cdf6b1843e00f6d13ba1654ea1a5c964ff02
|
data/.rubocop.yml
CHANGED
data/Makefile
CHANGED
@@ -1,15 +1,4 @@
|
|
1
|
-
.PHONY: download-jars
|
2
|
-
|
3
|
-
|
4
|
-
download-jars:
|
5
|
-
rm -f lib/structurizr/metal/jars/*.jar
|
6
|
-
mvn dependency:get -Dartifact=commons-logging:commons-logging:LATEST -Ddest=./lib/structurizr/metal/jars/
|
7
|
-
mvn dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-core:LATEST -Ddest=./lib/structurizr/metal/jars/
|
8
|
-
mvn dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-databind:LATEST -Ddest=./lib/structurizr/metal/jars/
|
9
|
-
mvn dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-annotations:LATEST -Ddest=./lib/structurizr/metal/jars/
|
10
|
-
mvn dependency:get -Dartifact=com.structurizr:structurizr-core:LATEST -Ddest=./lib/structurizr/metal/jars/
|
11
|
-
mvn dependency:get -Dartifact=com.structurizr:structurizr-graphviz:LATEST -Ddest=./lib/structurizr/metal/jars/
|
12
|
-
mvn dependency:get -Dartifact=com.structurizr:structurizr-client:LATEST -Ddest=./lib/structurizr/metal/jars/
|
1
|
+
.PHONY: test setup bundle lint console download-jars
|
13
2
|
|
14
3
|
test:
|
15
4
|
jruby -Itest -Ilib bin/test
|
@@ -24,8 +13,15 @@ bundle:
|
|
24
13
|
lint:
|
25
14
|
jruby -S bundle exec rubocop
|
26
15
|
|
27
|
-
build:
|
28
|
-
jruby -S gem build
|
29
|
-
|
30
16
|
console:
|
31
17
|
bin/console
|
18
|
+
|
19
|
+
download-jars:
|
20
|
+
rm -f lib/structurizr/metal/jars/*.jar
|
21
|
+
mvn dependency:get -Dartifact=commons-logging:commons-logging:LATEST -Ddest=./lib/structurizr/metal/jars/
|
22
|
+
mvn dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-core:LATEST -Ddest=./lib/structurizr/metal/jars/
|
23
|
+
mvn dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-databind:LATEST -Ddest=./lib/structurizr/metal/jars/
|
24
|
+
mvn dependency:get -Dartifact=com.fasterxml.jackson.core:jackson-annotations:LATEST -Ddest=./lib/structurizr/metal/jars/
|
25
|
+
mvn dependency:get -Dartifact=com.structurizr:structurizr-core:LATEST -Ddest=./lib/structurizr/metal/jars/
|
26
|
+
mvn dependency:get -Dartifact=com.structurizr:structurizr-graphviz:LATEST -Ddest=./lib/structurizr/metal/jars/
|
27
|
+
mvn dependency:get -Dartifact=com.structurizr:structurizr-client:LATEST -Ddest=./lib/structurizr/metal/jars/
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'structurizr'
|
5
|
+
require 'structurizr/repl'
|
6
|
+
|
7
|
+
application = Structurizr::REPL::Application.new
|
8
|
+
|
9
|
+
application.parse_workspace_path!
|
10
|
+
application.prepare_context!
|
11
|
+
application.setup_pry!
|
12
|
+
|
13
|
+
application.start
|
@@ -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
|
data/lib/structurizr/version.rb
CHANGED
data/structurizr.gemspec
CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
+
spec.add_dependency 'pry'
|
28
29
|
spec.add_development_dependency 'minitest'
|
29
|
-
spec.add_development_dependency 'pry'
|
30
30
|
spec.add_development_dependency 'rubocop'
|
31
31
|
spec.add_development_dependency 'rubocop-minitest'
|
32
32
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structurizr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.alpha.
|
4
|
+
version: 1.0.0.pre.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor S. Morozov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -16,9 +16,9 @@ dependencies:
|
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: '0'
|
19
|
-
name:
|
19
|
+
name: pry
|
20
20
|
prerelease: false
|
21
|
-
type: :
|
21
|
+
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
|
-
name:
|
33
|
+
name: minitest
|
34
34
|
prerelease: false
|
35
35
|
type: :development
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,7 +83,8 @@ dependencies:
|
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- igor@morozov.is
|
86
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- structurizr-repl
|
87
88
|
extensions: []
|
88
89
|
extra_rdoc_files: []
|
89
90
|
files:
|
@@ -98,6 +99,7 @@ files:
|
|
98
99
|
- README.md
|
99
100
|
- bin/console
|
100
101
|
- bin/test
|
102
|
+
- exe/structurizr-repl
|
101
103
|
- lib/structurizr.rb
|
102
104
|
- lib/structurizr/arc42_documentation_template.rb
|
103
105
|
- lib/structurizr/automatic_documentation_template.rb
|
@@ -127,6 +129,8 @@ files:
|
|
127
129
|
- lib/structurizr/paper_size.rb
|
128
130
|
- lib/structurizr/person.rb
|
129
131
|
- lib/structurizr/relationship.rb
|
132
|
+
- lib/structurizr/repl.rb
|
133
|
+
- lib/structurizr/repl/commands.rb
|
130
134
|
- lib/structurizr/routing.rb
|
131
135
|
- lib/structurizr/shape.rb
|
132
136
|
- lib/structurizr/software_system.rb
|