-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample.container
118 lines (92 loc) · 2.05 KB
/
example.container
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import andromeda/companies
use Andromeda\SpaceShip\(Ship, Engine)
## The Car service
@ship.destroyer: Ship(@engine.hyperdrive, @engine.pulsedrive)
- producer: @producer.massive
## The Engine (the '?' marks the service as NOT shared)
@engine.hyperdrive?: Engine
- setPower(34000)
= tag: "james"
@engine.pulsedrive?: Engine
- setPower(20)
# Producer
:producer.default_name: 'Massive Industries'
@producer.massive: \Andromeda\Companies\Company(:producer.default_name)
override @producer.massive: \Andromeda\Companies\Company('Other Company')
@engine.pulsedriver
= tag: "engines", "space"
= route: 'GET', '/something/else'
@human.ray: Human('Ray')
- setAge(23)
- age: 26
<- addAlias('Mary')
@human.ray
- setAge(27)
<- addAlias('Awesome')
==== @human.ray.age === 23, 26
@human.ray
- age: 27
==== @human.ray.age === 27
/**
* Auto wiring
*/
using \ContainerAwareTrait
- setContainer(@container)
/**
* Check for interface
*/
implementing \ContainerAwareInterface
- setContainer(@container)
/**
* Check for interface
*/
implementing \RoutableInterface
<= tag: "route"
/**
* Looping
*/
for class in ['File', 'MySQL', 'MongoDB']
{
define(class.lower)
}
/***
* Prefixing
*/
prefix log.
{
use Logger\(
Adapter\(
File,
MySQL,
MongoDB
),
Manager
)
@file.adapter: File // results in log.file.adapter
@mysql.adapter: MySQL
@mongo.adapter: MongoDB
}
macro ControllerAction(name, service_class)
{
@action.{name}: {service_class}(@payload)
=> tags: "Action"
- setContainer(@container)
}
ControllerAction(login, Actions/Auth/Login)
when using DBTrait
- setMysql(@mysql)
when instanceof Controller
- setContainer(@container)
=> tags: "controller"
@mysql: factory Service\HydrahonFactory
namespace request
{
@handler: TiBot\PuppetMaster\RequestHandler(@container)
namespace handler
{
// Create server handler
@create_server: TiBot\PuppetMaster\RequestHandlers\CreateServerHandler(@puppet.manager, @puppet.actions)
// Proxy handler
@proxy: TiBot\PuppetMaster\RequestHandlers\ProxyHandler(@puppet.manager, @puppet.actions)
}
}