-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
199 lines (143 loc) · 11.7 KB
/
Makefile
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
.PHONY: help
COLOR_RESET = \033[0m
COLOR_INFO = \033[32m
COLOR_COMMENT = \033[33m
COLOR_TITLE = \033[0;31m
help:
@echo " ${COLOR_TITLE}> GENERAL COMMANDS:${COLOR_RESET}"
@echo " ${COLOR_COMMENT}# make${COLOR_RESET} ${COLOR_INFO}build${COLOR_RESET} (Docker command)"
@echo " ${COLOR_TITLE}> LIST OF DESIGN PATTERNS AVAILABLE WITH HELP COMMANDS:${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Abstract Factory:${COLOR_RESET} ${COLOR_INFO}# make abstract-factory${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make abstract-factory-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Adapter:${COLOR_RESET} ${COLOR_INFO}# make adapter${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make adapter-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Builder:${COLOR_RESET} ${COLOR_INFO}# make builder${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make builder-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Composite:${COLOR_RESET} ${COLOR_INFO}# make composite${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make composite-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Decorator:${COLOR_RESET} ${COLOR_INFO}# make decorator${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make decorator-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Facade:${COLOR_RESET} ${COLOR_INFO}# make facade${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make facade-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Factory Method:${COLOR_RESET} ${COLOR_INFO}# make factory-method${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make factory-method-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Flyweight:${COLOR_RESET} ${COLOR_INFO}# make flyweight${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make flyweight-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Iterator:${COLOR_RESET} ${COLOR_INFO}# make iterator${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make iterator-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Memento:${COLOR_RESET} ${COLOR_INFO}# make memento${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make memento-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Money:${COLOR_RESET} ${COLOR_INFO}# make money${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make money-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Null Object:${COLOR_RESET} ${COLOR_INFO}# make null-object${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make null-object-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Observer:${COLOR_RESET} ${COLOR_INFO}# make observer${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make observer-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Prototype:${COLOR_RESET} ${COLOR_INFO}# make prototype${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make prototype-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Proxy:${COLOR_RESET} ${COLOR_INFO}# make proxy${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make proxy-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Singleton:${COLOR_RESET} ${COLOR_INFO}# make singleton${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make singleton-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}State:${COLOR_RESET} ${COLOR_INFO}# make state${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make state-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Strategy:${COLOR_RESET} ${COLOR_INFO}# make strategy${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make strategy-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Template Method:${COLOR_RESET} ${COLOR_INFO}# make template-method${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make template-method-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Command:${COLOR_RESET} ${COLOR_INFO}# make command${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make command-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Interpreter:${COLOR_RESET} ${COLOR_INFO}# make interpreter${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make interpreter-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Bridge:${COLOR_RESET} ${COLOR_INFO}# make bridge${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make bridge-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Visitor:${COLOR_RESET} ${COLOR_INFO}# make visitor${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make visitor-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Mediator:${COLOR_RESET} ${COLOR_INFO}# make mediator${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make mediator-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Object Pool:${COLOR_RESET} ${COLOR_INFO}# make object-pool${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make object-pool-help${COLOR_RESET}"
@echo " ${COLOR_COMMENT}Chain of Responsibility:${COLOR_RESET} ${COLOR_INFO}# make chain-of-responsibility${COLOR_RESET} ${COLOR_COMMENT}OR${COLOR_RESET} ${COLOR_INFO}# make chain-of-responsibility-help${COLOR_RESET}"
# Design Patterns Section
build:
docker build -t design-patterns .
strategy:
docker run -it design-patterns php /app/example/strategy.php
template-method:
docker run -it design-patterns php /app/example/template_method.php
adapter:
docker run -it design-patterns php /app/example/adapter.php
null-object:
docker run -it design-patterns php /app/example/null_object.php
facade:
docker run -it design-patterns php /app/example/facade.php
builder:
docker run -it design-patterns php /app/example/builder.php
observer:
docker run -it design-patterns php /app/example/observer.php
decorator:
docker run -it design-patterns php /app/example/decorator.php
money:
docker run -it design-patterns php /app/example/money.php
factory-method:
docker run -it design-patterns php /app/example/factory_method.php
abstract-factory:
docker run -it design-patterns php /app/example/abstract_factory.php
proxy:
docker run -it design-patterns php /app/example/proxy.php
singleton:
docker run -it design-patterns php /app/example/singleton.php
memento:
docker run -it design-patterns php /app/example/memento.php
flyweight:
docker run -it design-patterns php /app/example/flyweight.php
composite:
docker run -it design-patterns php /app/example/composite.php
state:
docker run -it design-patterns php /app/example/state.php
prototype:
docker run -it design-patterns php /app/example/prototype.php
iterator:
docker run -it design-patterns php /app/example/iterator.php
command:
docker run -it design-patterns php /app/example/command.php
interpreter:
docker run -it design-patterns php /app/example/interpreter.php
bridge:
docker run -it design-patterns php /app/example/bridge.php
visitor:
docker run -it design-patterns php /app/example/visitor.php
mediator:
docker run -it design-patterns php /app/example/mediator.php
object-pool:
docker run -it design-patterns php /app/example/object_pool.php
chain-of-responsibility:
docker run -it design-patterns php /app/example/chain_of_responsibility.php
# Help Section
abstract-factory-help:
@echo "${COLOR_INFO}\n\t> The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme.${COLOR_RESET}\n"
adapter-help:
@echo "${COLOR_INFO}\n\t> The Adapter pattern converts the interface of a class into another interface the clients expect.${COLOR_RESET}\n"
builder-help:
@echo "${COLOR_INFO}\n\t> The Builder pattern separates the construction of a complex object from its representation.${COLOR_RESET}\n"
composite-help:
@echo "${COLOR_INFO}\n\t> The Composite pattern composes objects into tree structures to represent part-whole hierarchies.${COLOR_RESET}\n"
decorator-help:
@echo "${COLOR_INFO}\n\t> The Decorator pattern dynamically adds/overrides behaviour in an existing method of an object.${COLOR_RESET}\n"
facade-help:
@echo "${COLOR_INFO}\n\t> The Facade pattern provides a simplified interface to a larger body of code.${COLOR_RESET}\n"
factory-method-help:
@echo "${COLOR_INFO}\n\t> The Factory Method pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate.${COLOR_RESET}\n"
flyweight-help:
@echo "${COLOR_INFO}\n\t> The Flyweight pattern minimizes memory use by sharing as much data as possible with other similar objects.${COLOR_RESET}\n"
iterator-help:
@echo "${COLOR_INFO}\n\t> The Iterator pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.${COLOR_RESET}\n"
memento-help:
@echo "${COLOR_INFO}\n\t> The Memento pattern provides the ability to restore an object to its previous state.${COLOR_RESET}\n"
money-help:
@echo "${COLOR_INFO}\n\t> The Money pattern helps in avoiding floating point arithmetic issues when dealing with money.${COLOR_RESET}\n"
null-object-help:
@echo "${COLOR_INFO}\n\t> The Null Object pattern provides an object as a surrogate for the lack of an object of a given type.${COLOR_RESET}\n"
observer-help:
@echo "${COLOR_INFO}\n\t> The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified.${COLOR_RESET}\n"
prototype-help:
@echo "${COLOR_INFO}\n\t> The Prototype pattern specifies the kind of object to create using a prototypical instance and creates new objects by copying this prototype.${COLOR_RESET}\n"
proxy-help:
@echo "${COLOR_INFO}\n\t> The Proxy pattern provides a surrogate or placeholder for another object to control access to it.${COLOR_RESET}\n"
singleton-help:
@echo "${COLOR_INFO}\n\t> The Singleton pattern ensures a class only has one instance, and provides a global point of access to it.${COLOR_RESET}\n"
state-help:
@echo "${COLOR_INFO}\n\t> The State pattern allows an object to alter its behavior when its internal state changes.${COLOR_RESET}\n"
strategy-help:
@echo "${COLOR_INFO}\n\t> The Strategy pattern defines a family of algorithms, encapsulate each one, and make them interchangeable.${COLOR_RESET}\n"
template-method-help:
@echo "${COLOR_INFO}\n\t> The Template Method pattern defines the skeleton of an algorithm in an operation, deferring some steps to subclasses.${COLOR_RESET}\n"
command-help:
@echo "${COLOR_INFO}\n\t> The Command pattern encapsulates a request as an object, thereby allowing users to parameterize other objects with queues, requests, and operations.${COLOR_RESET}\n"
interpreter-help:
@echo "${COLOR_INFO}\n\t> The Interpreter pattern implements a specialized language.${COLOR_RESET}\n"
bridge-help:
@echo "${COLOR_INFO}\n\t> The Bridge pattern decouples an abstraction from its implementation so that the two can vary independently. It promotes composition over inheritance.${COLOR_RESET}\n"
visitor-help:
@echo "${COLOR_INFO}\n\t> The Visitor pattern defines a new operation to a class without change.${COLOR_RESET}\n"
mediator-help:
@echo "${COLOR_INFO}\n\t> The Mediator pattern defines an object that encapsulates how a set of objects interact. It promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.${COLOR_RESET}\n"
object-pool-help:
@echo "${COLOR_INFO}\n\t> The Object Pool pattern avoids expensive acquisition and release of resources by recycling objects that are no longer in use.${COLOR_RESET}\n"
chain-of-responsibility-help:
@echo "${COLOR_INFO}\n\t> The Chain of Responsibility pattern avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.${COLOR_RESET}\n"