archspec 0.5.0 → 1.0.0
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 +4 -4
- data/README.md +26 -8
- data/lib/archspec/analyzer.rb +97 -53
- data/lib/archspec/architectures.rb +88 -84
- data/lib/archspec/cli.rb +114 -34
- data/lib/archspec/diagnostic.rb +2 -0
- data/lib/archspec/dsl.rb +16 -0
- data/lib/archspec/error.rb +7 -0
- data/lib/archspec/evaluator.rb +6 -8
- data/lib/archspec/formatters/explanation.rb +68 -38
- data/lib/archspec/formatters/style.rb +39 -0
- data/lib/archspec/formatters/text.rb +92 -8
- data/lib/archspec/model.rb +119 -36
- data/lib/archspec/rules/component_rules.rb +1 -1
- data/lib/archspec/rules/concern_rules.rb +3 -3
- data/lib/archspec/rules/cycle_rule.rb +2 -2
- data/lib/archspec/rules/dependency_rules.rb +10 -18
- data/lib/archspec/rules/naming_rules.rb +31 -3
- data/lib/archspec/rules/privacy_rule.rb +3 -3
- data/lib/archspec/rules/protocol_rules.rb +9 -6
- data/lib/archspec/source_location.rb +8 -2
- data/lib/archspec/todo.rb +17 -2
- data/lib/archspec/value_object.rb +4 -0
- data/lib/archspec/version.rb +1 -1
- data/lib/archspec.rb +8 -13
- metadata +4 -2
data/lib/archspec.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative 'archspec/error'
|
|
3
4
|
require_relative 'archspec/version'
|
|
4
5
|
require_relative 'archspec/value_object'
|
|
5
6
|
require_relative 'archspec/source_location'
|
|
@@ -19,6 +20,7 @@ require_relative 'archspec/rules/naming_rules'
|
|
|
19
20
|
require_relative 'archspec/rules/privacy_rule'
|
|
20
21
|
require_relative 'archspec/rules/protocol_rules'
|
|
21
22
|
require_relative 'archspec/rules/cycle_rule'
|
|
23
|
+
require_relative 'archspec/formatters/style'
|
|
22
24
|
require_relative 'archspec/formatters/text'
|
|
23
25
|
require_relative 'archspec/formatters/json'
|
|
24
26
|
require_relative 'archspec/formatters/explanation'
|
|
@@ -43,15 +45,7 @@ require_relative 'archspec/cli'
|
|
|
43
45
|
#
|
|
44
46
|
# You can also build a definition in plain Ruby with ArchSpec.define.
|
|
45
47
|
module ArchSpec
|
|
46
|
-
# Raised for configuration and usage errors, such as an unknown architecture
|
|
47
|
-
# name or a malformed rule option.
|
|
48
|
-
class Error < StandardError; end
|
|
49
|
-
|
|
50
48
|
class << self
|
|
51
|
-
# The definition produced by the most recent ArchSpec.define call, or by
|
|
52
|
-
# evaluating an +Archspec.rb+ file. The CLI reads this after loading config.
|
|
53
|
-
attr_accessor :last_definition
|
|
54
|
-
|
|
55
49
|
# Builds an architecture definition from a block of DSL calls.
|
|
56
50
|
#
|
|
57
51
|
# ArchSpec.define do
|
|
@@ -60,16 +54,17 @@ module ArchSpec
|
|
|
60
54
|
# models.cannot_use :controllers
|
|
61
55
|
# end
|
|
62
56
|
#
|
|
63
|
-
# An +Archspec.rb+ file
|
|
64
|
-
# the DSL, so bare +component+ and +architecture+ calls work
|
|
65
|
-
# +define+ when constructing a definition from Ruby, such as
|
|
57
|
+
# An +Archspec.rb+ file is not written with this wrapper. Its top level is
|
|
58
|
+
# already the DSL, so bare +component+ and +architecture+ calls work
|
|
59
|
+
# directly. Use +define+ when constructing a definition from Ruby, such as
|
|
60
|
+
# in a test.
|
|
66
61
|
#
|
|
67
|
-
# Returns the ArchSpec::Definition
|
|
62
|
+
# Returns the ArchSpec::Definition.
|
|
68
63
|
def define(name = nil, &block)
|
|
69
64
|
definition = Definition.new(name)
|
|
70
65
|
definition.extend(DSL::Context)
|
|
71
66
|
definition.instance_eval(&block) if block
|
|
72
|
-
|
|
67
|
+
definition
|
|
73
68
|
end
|
|
74
69
|
end
|
|
75
70
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: archspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carmine Paolino
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: prism
|
|
@@ -93,9 +93,11 @@ files:
|
|
|
93
93
|
- lib/archspec/definition.rb
|
|
94
94
|
- lib/archspec/diagnostic.rb
|
|
95
95
|
- lib/archspec/dsl.rb
|
|
96
|
+
- lib/archspec/error.rb
|
|
96
97
|
- lib/archspec/evaluator.rb
|
|
97
98
|
- lib/archspec/formatters/explanation.rb
|
|
98
99
|
- lib/archspec/formatters/json.rb
|
|
100
|
+
- lib/archspec/formatters/style.rb
|
|
99
101
|
- lib/archspec/formatters/text.rb
|
|
100
102
|
- lib/archspec/model.rb
|
|
101
103
|
- lib/archspec/rules/component_rules.rb
|