axr 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07cc36c3d0e6ff1efe1a1519a68cf8c9dacdf0ac8f61c73fdda1e69da7fc179c
4
- data.tar.gz: aaca58deb866a1709cba78aeac7f264e3faa15476cefb1e24f761419aba15381
3
+ metadata.gz: 14c21dbe89798e76d232c029d5cae8843e1a25bc313453abbdb9ff6e3a7feed7
4
+ data.tar.gz: 14771453a1f39e857f5cb0edee0670ed332dfd71f90db6ae5e40579703037911
5
5
  SHA512:
6
- metadata.gz: 76674bdd4990df3982fb13c4061e5494e55578bf2c612f1d27c6f0b04206adc1dc9e6879b3bb405155b989fa2b44d002f8b004f995cae1064e25d9b9236e5b63
7
- data.tar.gz: 1473e443635bd793f7a7dfc9e261493d8076d0cbfad011e128ba0caf9ba622c20d1e2d07dd5e5f3d63bb7578fce564b5e7c55efc14312ff84637d5b00024505f
6
+ metadata.gz: d04a46e35c7ab0c314ae88dc431ceb373822074b146c92864a6c992df352bb1d53f3e3ee3d13130e23dda6de0463cf3a1455da26caf60b5ef4be29ba7d0824bb
7
+ data.tar.gz: 7d586e920c1b053fae07373a41a496a9c4a4a8b1e7de661a3c902ea461d9a8080dafc97b625ab40290e0f3ca5b3912f0d43a38057a41815d37c011b0d6b32fac
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AXR
2
2
 
3
- ### Ruby applications architecture for simplicity and team adoption
3
+ **Ruby architecture for simplicity and team adoption**
4
4
 
5
5
  Architecture is hard. It’s very easy to build a complex system; much harder to build a simple and adaptable one. The code doesn't matter and coding for the sake of writing code is foolish.
6
6
 
@@ -8,24 +8,27 @@ Few of us get to write software that survives 5-10 years or longer. 90% of our w
8
8
 
9
9
  This is just reality.
10
10
 
11
- (c) Me
11
+ (c) Volodya Sveredyuk
12
12
 
13
- ### Setup
13
+ ## Setup
14
14
 
15
15
  ```sh
16
16
  gem install axr
17
17
  ```
18
18
 
19
- or in your Gemfile:
19
+ or in your Gemfile
20
20
  ```ruby
21
- gem 'axr', '~> 0.5'
21
+ gem 'axr'
22
22
  ```
23
23
 
24
+ in console
24
25
  ```sh
25
26
  bundle install
26
27
  ```
27
28
 
28
- Somewhere in your ruby app:
29
+ ## DSL
30
+
31
+ In your ruby app: (for rails app put it into `config/initializers`)
29
32
  ```ruby
30
33
  require 'axr'
31
34
 
@@ -36,6 +39,51 @@ AxR.app.define do
36
39
  end
37
40
  ```
38
41
 
42
+ By default, layers will get level from top to bottom.
43
+ ```
44
+ Api -> 0
45
+ YourBusinessLogic -> 1
46
+ Repo -> 2
47
+ ```
48
+
49
+ Layers with lower-level have less isolation.
50
+
51
+ - `Api` knows about `YourBusinessLogic` and `Repo`
52
+ - `YourBusinessLogic` knows about `Repo` but don't know anything about `Api`
53
+ - `Repo` fully isolated and don't familiar with `Api` and `YourBusinessLogic`
54
+
55
+ **Options**
56
+
57
+ ```ruby
58
+ require 'axr'
59
+
60
+ AxR.app.define do
61
+ layer 'A'
62
+ layer 'B', familiar_with: 'C'
63
+ layer 'C', familiar_with: 'B'
64
+ layer 'D', isolated: true
65
+ layer 'E', isolated: true
66
+ end
67
+ ```
68
+
69
+ ```ruby
70
+
71
+ # app.define options
72
+ AxR.app.define(isolated: true) # All layers will be isolated by default
73
+ AxR.app.define(familiar_with: ['D', 'E') # All layers will be familiar with D and E by default
74
+
75
+ # layer options
76
+ familiar_with: [...] # Can operate with other layers
77
+ isolated: true # 100% isolated and should not operate with other layers
78
+ isolated: true, familiar_with: [...] # Isolated from all except familiars
79
+ ```
80
+
81
+ Can organize knowledge structure like:
82
+
83
+ <img src="docs/images/abcde_example.png" alt="drawing" width="500"/>
84
+
85
+ ## CLI
86
+
39
87
  Run `AxR` checker in console
40
88
  ```sh
41
89
  axr check . --load path/to/you/app/autoload.rb
@@ -56,8 +104,27 @@ Run for a specific file
56
104
  axr lib/adapters/youtube.rb
57
105
  ```
58
106
 
59
- ### How it works
60
- ...TODO
107
+ ## More examples
108
+
109
+ **ERP system**
110
+
111
+ <img src="docs/images/erp_example.png" alt="drawing" width="500"/>
112
+
113
+ ```ruby
114
+ require 'axr'
115
+
116
+ AxR.app.define(isolated: true) do
117
+ layer 'Api', familiar_with: ['ERP']
118
+ layer 'UI', familiar_with: ['ERP']
119
+ layer 'ERP', familiar_with: %w[Inventory Sales Supply]
120
+ layer 'Sales', familiar_with: 'Inventory'
121
+ layer 'Supply', familiar_with: 'Inventory'
122
+ layer 'Repo'
123
+ layer 'Change'
124
+ layer 'Query'
125
+ end
126
+ ```
61
127
 
62
128
  ### TODO
63
129
  - Add sublayers
130
+ - Add `axr check --exit-on-warning` cli flag
@@ -37,7 +37,7 @@ module AxR
37
37
  dep = layers.find { |l| l.name.to_s == dependncy.to_s }
38
38
 
39
39
  return false unless ctx && dep
40
- return false if ctx.isolated?
40
+ return false if ctx.isolated? && ctx.familiar_with.empty?
41
41
  return true if ctx.familiar_with.map(&:to_s).include?(dependncy.to_s)
42
42
 
43
43
  ctx.level < dep.level
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxR
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodya Sveredyuk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-30 00:00:00.000000000 Z
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -145,6 +145,8 @@ files:
145
145
  - axr.gemspec
146
146
  - bin/console
147
147
  - bin/setup
148
+ - docs/images/abcde_example.png
149
+ - docs/images/erp_example.png
148
150
  - exe/axr
149
151
  - lib/axr.rb
150
152
  - lib/axr/app.rb