opensecret 0.0.2 → 0.0.4

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -0
  3. data/README.md +2 -2
  4. data/bin/opensecret +3 -6
  5. data/lib/opensecret-domain.ini +23 -0
  6. data/lib/opensecret.rb +30 -2
  7. data/lib/opensecret/additions/array.rb +117 -0
  8. data/lib/opensecret/additions/dir.rb +35 -0
  9. data/lib/opensecret/additions/string.rb +312 -0
  10. data/lib/opensecret/commons/eco.cmdline.rb +446 -0
  11. data/lib/opensecret/commons/eco.faculty.rb +364 -0
  12. data/lib/opensecret/commons/eco.system.rb +437 -0
  13. data/lib/opensecret/commons/eco.systems.rb +98 -0
  14. data/lib/opensecret/{safe.rb → delegate.rb} +4 -2
  15. data/lib/opensecret/eco.do.rb +46 -0
  16. data/lib/opensecret/executors/crypt.keys/crypt.keys.ini +79 -0
  17. data/lib/opensecret/executors/crypt.keys/crypt.keys.rb +68 -0
  18. data/lib/opensecret/executors/decrypt/decrypt.ini +64 -0
  19. data/lib/opensecret/executors/decrypt/decrypt.rb +49 -0
  20. data/lib/opensecret/executors/encrypt/encrypt.ini +55 -0
  21. data/lib/opensecret/executors/encrypt/encrypt.rb +82 -0
  22. data/lib/opensecret/factbase/hub-runtime.ini +123 -0
  23. data/lib/opensecret/factbase/known-hosts.ini +75 -0
  24. data/lib/opensecret/factbase/published.facts/blobbolicious-facts.ini +553 -0
  25. data/lib/opensecret/factbase/published.facts/credential-facts.ini +40 -0
  26. data/lib/opensecret/factbase/published.facts/infrastructure-facts.ini +63 -0
  27. data/lib/opensecret/factbase/readme.md +24 -0
  28. data/lib/opensecret/factbase/retired.facts/maven.database.ide.facts.ini +127 -0
  29. data/lib/opensecret/factbase/retired.facts/s3-upload-block-facts.ini +17 -0
  30. data/lib/opensecret/plugins.io/cipher/crypto.rb +174 -0
  31. data/lib/opensecret/plugins.io/error/eco.exceptions.rb +24 -0
  32. data/lib/opensecret/plugins.io/facts/fact.chars.rb +66 -0
  33. data/lib/opensecret/plugins.io/facts/fact.factor.rb +156 -0
  34. data/lib/opensecret/plugins.io/facts/fact.locator.rb +105 -0
  35. data/lib/opensecret/plugins.io/facts/fact.reader.rb +137 -0
  36. data/lib/opensecret/plugins.io/facts/fact.tree.rb +661 -0
  37. data/lib/opensecret/plugins.io/file/file.rb +483 -0
  38. data/lib/opensecret/plugins.io/git/git.flow.rb +388 -0
  39. data/lib/opensecret/plugins.io/logs/log.object.rb +89 -0
  40. data/lib/opensecret/plugins.io/logs/logging.rb +203 -0
  41. data/lib/opensecret/plugins.io/time/time.stamp.rb +425 -0
  42. data/lib/opensecret/version.rb +2 -2
  43. data/opensecret.gemspec +8 -13
  44. metadata +68 -18
@@ -0,0 +1,123 @@
1
+ #--
2
+ #-- This fact base holds the [keyinstance facts] for the
3
+ #-- eco-system (hub) being created.
4
+ #--
5
+ #-- ---------------------
6
+ #-- [Fact Assimilation]
7
+ #-- ---------------------
8
+ #--
9
+ #-- This core factfile is always parsed and its constituent
10
+ #-- facts are assimilated. These facts are also guaranteed
11
+ #-- to be assimilated [FIRST].
12
+ #--
13
+ #-- ----------------
14
+ #-- [Dependencies]
15
+ #-- ----------------
16
+ #--
17
+ #-- As these facts are assimilated [first], they cannot be
18
+ #-- beholden to (dependent on) any other fact files.
19
+ #--
20
+
21
+ [this]
22
+ host = e>> NetDns.instance.host_name
23
+ user = e>> Home.usr
24
+ home.dir = e>> Home.dir
25
+ host.user = e>> @f[:this][:host] + Do.t + @f[:this][:user]
26
+
27
+ ## ---------------------------
28
+ ## start refactor
29
+ ## @todo => drive belongs to the workstation fact cluster
30
+ ## @todo => archive belongs to the workstation fact cluster
31
+ drive = e>> File.join Home.dir, "com.laundry4j.drive"
32
+ archive = e>> File.join @f[:this][:drive], "library.packaged.software"
33
+ ## end refactor
34
+ ## ---------------------------
35
+
36
+ [time]
37
+ stamp = e>> Stamp.yyjjj_hhmm_sst
38
+ now = @todo
39
+
40
+ today = @todo
41
+ yesterday = @todo
42
+ tomorrow = @todo
43
+
44
+ this.week = @todo
45
+ last.week = @todo
46
+ next.week = @todo
47
+
48
+ this.month = @todo
49
+ last.month = @todo
50
+ next.month = @todo
51
+
52
+ this.year = @todo
53
+ last.year = @todo
54
+ next.year = @todo
55
+
56
+ # @todo -- refactor - change FROM [eco] TO [hub]
57
+ # @todo -- refactor - change FROM [eco] TO [hub]
58
+ # @todo -- refactor - change FROM [eco] TO [hub]
59
+ # @todo -- refactor - change FROM [eco] TO [hub]
60
+ # @todo -- refactor - change FROM [eco] TO [hub]
61
+ # @todo -- refactor - change FROM [eco] TO [hub]
62
+ # @todo -- refactor - change FROM [eco] TO [hub]
63
+ # @todo -- refactor - change FROM [eco] TO [hub]
64
+ # @todo -- refactor - change FROM [eco] TO [hub]
65
+ # @todo -- refactor - change FROM [eco] TO [hub]
66
+ # @todo -- refactor - change FROM [eco] TO [hub]
67
+ [eco]
68
+ id = e>> @i[:plugin]
69
+ sym = e>> @i[:plugin].to_sym
70
+ url = eco-platform.co.uk
71
+ box = eco-platform.archive
72
+ src = eco-platform.station
73
+ dst = eco-platform.uploads
74
+ vms = eco-platform.cluster
75
+ ip.url = https://www.eco-platform.co.uk/commons/eco-platform.git
76
+
77
+
78
+ ## decommission and remove the plugin month spanning facts
79
+ ## decommission and remove the plugin month spanning facts
80
+ ## decommission and remove the plugin month spanning facts
81
+ ## decommission and remove the plugin month spanning facts
82
+ ## decommission and remove the plugin month spanning facts
83
+ [plugin]
84
+ month.span = e>> @i[:plugin] + Do.t + Stamp.yymo_mmm
85
+ month.span.b4 = e>> @i[:plugin] + Do.t + Stamp.yymo_mmm_prev
86
+ month.stamp = e>> "eco." + @s[:month_span]
87
+ month.stamp.b4 = e>> "eco." + @s[:month_span_b4]
88
+
89
+
90
+ ## @todo - Change to (1) [hub][dir] (2) [hub][name] and (3) [hub][path] - THEN MOVE UP (where eco is now)
91
+ ## @todo - Change to (1) [hub][dir] (2) [hub][name] and (3) [hub][path] - THEN MOVE UP (where eco is now)
92
+ ## @todo - Change to (1) [hub][dir] (2) [hub][name] and (3) [hub][path] - THEN MOVE UP (where eco is now)
93
+ ## @todo - Change to (1) [hub][dir] (2) [hub][name] and (3) [hub][path] - THEN MOVE UP (where eco is now)
94
+ ## @todo - Change to (1) [hub][dir] (2) [hub][name] and (3) [hub][path] - THEN MOVE UP (where eco is now)
95
+ [runtime]
96
+ dirname = e>> @i[:plugin] + Do.t + @f[:time][:stamp] + Do.t + @f[:this][:user] + "." + @f[:this][:host]
97
+
98
+
99
+ dstname = e>> @f[:eco][:dst]
100
+ dstpath = e>> File.join @f[:runtime][:dstname], @f[:runtime][:dirname]
101
+
102
+ station.1.dir = e>> File.join Home.dir, @f[:eco][:src]
103
+ station.2.dir = e>> File.join @f[:runtime][:station_1_dir], @f[:plugin][:month_stamp]
104
+ station.3.dir = e>> File.join @f[:runtime][:station_2_dir], @f[:runtime][:dirname]
105
+
106
+ dir = e>> @f[:runtime][:station_3_dir]
107
+ archive = e>> File.join Home.dir, @f[:eco][:box]
108
+
109
+
110
+ ## DELETE all the below facts
111
+ ## DELETE all the below facts
112
+ ## DELETE all the below facts
113
+ ## DELETE all the below facts
114
+ ## DELETE all the below facts
115
+ ## DELETE all the below facts
116
+ ## DELETE all the below facts
117
+ [stamp]
118
+ mini = e>> @i[:plugin] + Do.t + Stamp.yyjjj_hhmm_sst + Do.t + @f[:this][:user]
119
+ midi = e>> @f[:stamp][:mini] + "." + @f[:this][:host]
120
+ mini.2 = e>> (@f[:stamp][:mini]).gsub ".", "-"
121
+ flat = e>> Stamp.yyjjj_hhmm_sst.gsub ".", ""
122
+ time = e>> Stamp.yyjjj_hhmm_sst
123
+
@@ -0,0 +1,75 @@
1
+
2
+ # --
3
+ # -- Fact File => known.hosts.ini
4
+ # -- Directory => project-root/reusable.facts
5
+ # -- Purpose => Bonds workstations with the known accessible hosts
6
+ # -- that the plugins build eco-systems on top of.
7
+ # --
8
+ # -- ---------------------
9
+ # -- The LapTop Use Case
10
+ # -- ---------------------
11
+ # --
12
+ # -- A laptop in the office may carry the IP of 192.168.5.xxx
13
+ # -- The same laptop at home may connect using 192.168.0.xxx
14
+ # --
15
+ # -- Create two fact groups like [laptop.work] and [laptop.home]
16
+ # --
17
+ # -- [laptop.work] contains => wiki.dev.host = office.giant
18
+ # -- (and)
19
+ # -- [laptop.home] contains => wiki.dev.host = kitchen.pc
20
+ # --
21
+ # -- At work the wiki.dev plugins creates the wiki on [office.giant]
22
+ # -- (whilst)
23
+ # -- at home the same wiki.dev plugin puts the wiki on [kitchen.pc]
24
+ # --
25
+ # --
26
+
27
+
28
+ [inca.desktop]
29
+ username = apollo13
30
+ hostnames = e>> [ "balloon" ]
31
+ secrets.dir = I:/strings-cache
32
+ aws.creds.dir = I:/aws.iam.credentials
33
+ ssh.keydir = e>> File.join Home.dir, "com.laundry4j.drive/library.ssh.access.keys"
34
+ wiki.dev.host = inca.server
35
+
36
+
37
+ [inca.server]
38
+ username = apollo
39
+ hostnames = e>> [ "192.168.0.14", "warehouse" ]
40
+ net.bridge = enp6s0
41
+ secrets.dir = /media/usb_drive/cryptography.keys
42
+ aws.creds.dir = e>> File.join Home.dir, "devops-hub.iam.creds"
43
+
44
+
45
+ [little.brain]
46
+ username = apollo
47
+ hostnames = e>> [ "192.168.75.240", "brain-pad" ]
48
+ net.bridge = enp0s31f6
49
+ secrets.dir = /media/apollo/02E4-1244/cryptography.keys
50
+ aws.creds.dir = /media/apollo/02E4-1244/aws.iam.credentials
51
+ ssh.keydir = e>> File.join Home.dir, "eco-platform.credentials"
52
+ wiki.dev.host = little.brain
53
+
54
+
55
+ [wee.brain]
56
+ username = apollo
57
+ hostnames = e>> [ "192.168.82.92", "littlepc" ]
58
+ net.bridge = enp6s0
59
+
60
+
61
+ [gitlab.server]
62
+ root.domain = eco-platform.co.uk
63
+ username = ubuntu
64
+ hostnames = e>> Array.new
65
+ net.bridge = notapplicable
66
+ key.rel.path = eco-platform.station/eco.gitlab.hub.1712.dec/gitlab.hub.17359.0416.335.apollo13.balloon/keypair.gitlab.hub.17359.0416.335.apollo13.balloon.pem
67
+ ssh.key.path = e>> File.join Home.dir, @f[:gitlab_server][:key_rel_path]
68
+ host.server = e>> LinuxHost.existing_host( \
69
+ @f[:gitlab_server][:root_domain], \
70
+ @f[:gitlab_server][:username], \
71
+ @f[:gitlab_server][:ssh_key_path], \
72
+ @f[:gitlab_server][:net_bridge] \
73
+ )
74
+
75
+
@@ -0,0 +1,553 @@
1
+ # ###############################################################################
2
+ # ###############################################################################
3
+
4
+ # --
5
+ # -- The group names are the name of a mirrored resource file tree.
6
+ # --
7
+ # -- They contain keys that specify the
8
+ # --
9
+ # -- [1] - S3 bucket name at the cloud endpoint of the mirror
10
+ # -- [2] - offset to root folder within S3 bucket (can be empty)
11
+ # -- [3] - IAM user with permissions to read/write within S3
12
+ # -- [4] - path to the local mirrrored folder (created if necessary)
13
+ # -- [5] - sync options (typically --delete and --size-only)
14
+ # --
15
+ # -- Currently it is assumed that the user running the eco script
16
+ # -- is the local user with the necessary permissions for accessing
17
+ # -- and interacting with the mirror.
18
+ # --
19
+
20
+ [books]
21
+
22
+ s3.bucket = devops.books
23
+ buket.offset = e>> ""
24
+ iam.s3.user = devops.librarian
25
+ path.offset = e>> File.join Home.dir, "mirror.books"
26
+ sync.options = e>> Array.new.push("--delete").push("--size-only")
27
+
28
+ # ###############################################################################
29
+ # ###############################################################################
30
+
31
+ # ---
32
+ # --- Note that (AND) is the operator employed
33
+ # --- when more than one fact directive lives in
34
+ # --- a chunk.
35
+ # ---
36
+ # --- To implement and (OR) type operator use
37
+ # --- two (or more chunks).
38
+ # ---
39
+ # --- The Ruby eql? method is used to compare so
40
+ # --- you can compare strings, ints, objects ...
41
+ # ---
42
+ # --- String comparisons are case insensitive.
43
+ # ---
44
+
45
+
46
+ ## @@@ @@@@@@@@@@@@@@@@@ @@ ##
47
+ ## @@@ Project Namespace @@ ##
48
+ ## @@@ @@@@@@@@@@@@@@@@@ @@ ##
49
+
50
+
51
+ [s3]
52
+ upload.prefix = s3put.
53
+ uploads.dir = e>> File.join @f[:runtime][:dir], "s3_uploads"
54
+
55
+ ### ===============================
56
+ ### refactor these fact names to
57
+ ### ===============================
58
+ ### [s3.bucket] = group
59
+ ### this.month = ...
60
+ ### next.month = ...
61
+ ### last.month = ...
62
+ ### ===============================
63
+
64
+ month.bucket = e>> @f[:plugin][:month_stamp]
65
+ month.bucket.b4 = e>> @f[:plugin][:month_stamp_b4]
66
+ monthwide.url = e>> "s3://" + @f[:plugin][:month_stamp]
67
+
68
+ bucket.name = e>> @f[:plugin][:month_stamp] # a [deprecated] fact
69
+
70
+
71
+ [gitlab]
72
+ backups.dir = /var/opt/gitlab/backups
73
+ backups.cache = e>> @f[:plugin][:month_stamp]
74
+ backups.s3.dir = e>> "s3://" + @f[:plugin][:month_stamp]
75
+ clone.suffix = _gitlab_backup.tar
76
+
77
+
78
+ [docker]
79
+ cmd.pre = e>> "sudo docker exec --user=" + Ch.dq + "mongodb" + Ch.dq + " -i container.mongodb bash -c " + Ch.dq
80
+ no.cache = e>> if CmdLine.has? "--no-cache" then return "--no-cache" else return "" end
81
+ rm.image.cmd = e>> if CmdLine.has? "--no-cache" then return "sudo docker rmi img." + @f[:eco][:id] else return "" end
82
+
83
+
84
+ [certbot]
85
+ cert.name = hub-certificates
86
+ email.address = apolloakora@gmail.com
87
+
88
+
89
+ [gollum]
90
+ template.dir = templates
91
+ git.mirror = e>> "wiki." + Stamp.yyjjj_hhmm_sst
92
+
93
+
94
+ [vagrant]
95
+ ip.addr.file = vm-ip-addresses.txt
96
+ hostname = e>> Stamp.yyjjj_hhmm_sst.gsub(".", "-")
97
+
98
+ #--
99
+ #-- -------------------------------------------------------------
100
+ #-- @todo fact override missionary (trail-blazer)
101
+ #-- -------------------------------------------------------------
102
+ #-- [1] - change to ubuntu/xenial64 when overriding tech arrives
103
+ #-- [2] - Then in plugin facts add the override statement (see vm.cluster)
104
+ #-- [3] - Then in templates like below add the @ -- [vagrant|boxname] placeholder
105
+ #-- => vagrant/Vagrantfile.kube.master
106
+ #-- => vagrant/Vagrantfile.kube.worker
107
+ #--
108
+ boxname = geerlingguy/centos7
109
+ vm.name = e>> "vm." + @f[:stamp][:time]
110
+
111
+
112
+ [port]
113
+ jenkins = 42001:8081
114
+ gollum = 42006:4567
115
+
116
+
117
+ # --
118
+ # -- ---------- = ---------------------------------------- #
119
+ # -- The fact l = ayout format is [16 spaces] before the
120
+ # -- equals sig = n then [2 spaces] after.
121
+ # -- =
122
+ # -- 6789012345 = string value
123
+ # -- 6789012345 = e>> 3 + 4
124
+ # -- ---------- = ---------------------------------------- #
125
+ # --
126
+
127
+ [overwrite]
128
+ spec.filename = e>> @i[:plugin] + ".overwrite.spec.json"
129
+ spec.filepath = e>> File.join @f[:runtime][:dir], @f[:overwrite][:spec_filename]
130
+
131
+
132
+ # --
133
+ # -- The fact layout format is [16 spaces] before the
134
+ # -- equals sign and [2 spaces] after.
135
+ # --
136
+ # -- 6789012345 = string value
137
+ # -- 6789012345 = e>> 3 + 4
138
+ # --
139
+
140
+
141
+
142
+ # -- ---------- = ----------------------------------------- #
143
+ # -- The fact l = ayout format is [16 spaces] before the
144
+ # -- equals sig = n then [2 spaces] after.
145
+ # -- =
146
+ # -- 6789012345 = string value
147
+ # -- 6789012345 = e>> 3 + 4
148
+ # -- ---------- = ----------------------------------------- #
149
+
150
+ #-- -----------------------------
151
+ #-- Using "String" Umbrella Maps
152
+ #-- -----------------------------
153
+ #--
154
+ #-- String umbrella maps are for creating a string key and string value map.
155
+ #-- These maps are accessible using the [UMBRELLA] key @u
156
+ #--
157
+ #-- For example to import an inventory of
158
+ #-- key = source filename and
159
+ #-- value = destination filename
160
+ #--
161
+ #-- Group [u.inventory]
162
+ #-- Access key-value map with @u[:inventory]
163
+ #-- And you can say if exists( @u[:inventory] )
164
+ #--
165
+ #-- NOTE - umbrella sections can be continued in other files.
166
+ #-- - if when they are - key/values are appended to map.
167
+
168
+ #--
169
+ #-- -------------------------------------------------------
170
+ #-- Disallowed Group Names
171
+ #-- -------------------------------------------------------
172
+ #--
173
+ #-- Some group names are not allowed because they have been
174
+ #-- allocated for shorthand purposes.
175
+ #--
176
+ #-- For example [plugin]. This name is a shorthand for the
177
+ #-- plugin id.
178
+ #--
179
+ #-- So "@t[plugin|root.domain]" is replaced with "devops-hub.com"
180
+ #--
181
+ #-- Thus we cannot create a group called [plugin].
182
+ #--
183
+ #-- Curently disallowed group names are everything in the
184
+ #-- @i (identity) map ===== THINK aBOUT THIS SOME MORE.
185
+ #--
186
+ #--
187
+ #--
188
+ #-- -------------------------------------------------------
189
+ #-- Sibling Facs ( @s )
190
+ #-- -------------------------------------------------------
191
+ #--
192
+ #-- The @s[:length] is a "sibling" fact. @s is a one dimensional
193
+ #-- array containing all (sibling) key-pairs under the umbrella
194
+ #-- of a (parent) group - in this case [rectangle].
195
+ #--
196
+ #--
197
+ #-- [rectangle]
198
+ #--
199
+ #-- length,width = <<absract>>
200
+ #-- perimeter = e>> (@s[:length] * 2) + (@s[:width] * 2)
201
+ #-- area = e>> @s[:length] * @s[:width]
202
+ #--
203
+ #--
204
+ #-- -------------------------------------------------------
205
+ #-- The Advantage of Sibling Facts ( @s )
206
+ #-- -------------------------------------------------------
207
+ #--
208
+ #-- Sibling facts are a [shorthand] way to declare facts
209
+ #-- within an INI fact file. These 2 declarations produce
210
+ #-- the same value.
211
+ #--
212
+ #-- @f[:rectangle][:length]
213
+ #-- @s[:length]
214
+ #--
215
+ #-- The sibling fact must be declared in an INI fact file
216
+ #-- within the [auspices] of or under an [umbrella] that is
217
+ #-- the parent group.
218
+
219
+
220
+ #--
221
+ #-- Fact consumption can happen in five (5) different ways
222
+ #--
223
+ #-- -
224
+ #-- - @p (plugin related facts)
225
+ #-- - @l
226
+ #-- - @u (umbrella string maps)
227
+ #-- - @g
228
+ #-- - @i (identity core facts) - used and reused time and again
229
+ #-- - @n
230
+ #-- -
231
+ #-- - @f (file facts as 2D array) - using known facts to create new ones
232
+ #-- - @a (ancestral, anchored, family facts) == RELATIVE (Only in fact file)
233
+ #-- - @c (code facts) - with plugin (eco) claasss also p_fact(...) plugin fact
234
+ #-- - @t (template facts) - template facts which can also accomodate nesting == ONLY IN TEMPLATE
235
+ #-- - @s (sibling fact) - described above == RELATIVE (Only in fact file)
236
+ #-- -
237
+ #--
238
+
239
+ #--
240
+ #-- --------------------------------------------
241
+ #-- Harvesting Facts | A Fact Finding Mission
242
+ #-- --------------------------------------------
243
+ #--
244
+ #-- Many simple, useful, productive and powerful facts exist out there and
245
+ #-- this <<fact-hub>> ( register fact-hub.com )) can go on a fact finding
246
+ #-- (mining) mission when you give the word.
247
+ #--
248
+ #-- Facts can be harvested from
249
+ #--
250
+ #-- a) - environment variables
251
+ #-- b) - files (INI, json, csv, yml, properties, html)
252
+ #-- c) - REST API calls
253
+ #-- d) - shell commands
254
+ #-- e) - key-value stores (DynamoDB, etcd, Redis, memcached)
255
+ #-- f) - databases (MongoDb, MySQL, PostgreSQL, Oracle)
256
+ #-- g) - secret engines (Amazon KMS, Ansible Vault, CredStash)
257
+ #--
258
+ #-- The fact data can be hosted
259
+ #--
260
+ #-- 1) - on local, removal and networked storage
261
+ #-- 2) - in memory
262
+ #-- 3) - in Amazon S3, Google Drive and other clouds
263
+ #-- 4) - dropbox
264
+ #-- 5) - git and subversion repositories
265
+ #-- 6) -
266
+ #--
267
+
268
+
269
+
270
+
271
+
272
+ #--
273
+ #-- -------------------
274
+ #-- Fact Inheritance
275
+ #-- -------------------
276
+ #--
277
+ #-- Fact inheritance allows us to share most of the properties of
278
+ #-- a fact group that are either conceptually similar or derive from
279
+ #-- the same base class.
280
+ #--
281
+ #-- Separating Interface from Implementation
282
+ #-- --------------------------------------------
283
+ #-- Fact inheritance allows fact consumers to reference a parent and
284
+ #-- use say the polygon [interface] without knowing or caring about the
285
+ #-- specific [implementation].
286
+ #--
287
+ #--
288
+ #--
289
+ #-- -------------------------------------------------------
290
+ #-- Example Inheritance of Fact Implementation Behaviour
291
+ #-- -------------------------------------------------------
292
+ #--
293
+ #--
294
+ #-- [rectangle]
295
+ #--
296
+ #-- length,width = <<absract>>
297
+ #-- perimeter = e>> (@s[:length] * 2) + (@s[:width] * 2)
298
+ #-- area = e>> @s[:length] * @s[:width]
299
+ #--
300
+ #--
301
+ #-- [square < rectangle]
302
+ #--
303
+ #-- width = e>> @s[:length]
304
+ #--
305
+ #--
306
+ #-- [room < square]
307
+ #--
308
+ #-- length = 10
309
+ #--
310
+ #--
311
+ #--
312
+ #-- And now in a template somewhere there can be a statement
313
+ #-- saying a square of length @[room|length] will surely have
314
+ #-- an area of @[room|area] square metres.
315
+ #--
316
+ #--
317
+ #--
318
+ #-- -------------------------------------------------------
319
+ #-- Notes on square inheriting rectangle fact behaviour
320
+ #-- -------------------------------------------------------
321
+ #--
322
+ #-- Due to square declaring that it inherits from the rectangle
323
+ #-- group - other fact declarations can now use this.
324
+ #--
325
+ #-- Both the [room] and [square] fact groupings use the
326
+ #-- inheritance inherent in the [rectangle] declaration.
327
+ #--
328
+ #--
329
+
330
+
331
+
332
+ #--
333
+ #-- -------------------
334
+ #-- Overriding Facts
335
+ #-- -------------------
336
+ #--
337
+ #-- This futuristic fact override statement overrides and imposes
338
+ #-- a new value for the specified fact coordinate.
339
+ #--
340
+ #-- Notes
341
+ #--
342
+ #-- [1] - the first definition is just a string
343
+ #-- [2] - the second statement string is eval'd
344
+ #-- [3] - Every fact DEPENDENT on overriden fact will change
345
+ #--
346
+ #-- ---------------------------
347
+ #-- Overriding Facts | WARNING
348
+ #-- ---------------------------
349
+ #--
350
+ #-- When you override a fact's value - EVERY DEPENDENT FACT is then
351
+ #-- [RE-DERIVED] with the new value.
352
+ #--
353
+ #--
354
+ #-- It is important when the fact is used as a method or constructor
355
+ #-- parameter. If the class ignores the second call (for example
356
+ #-- singletons) - the new fact value does not fully propagae through
357
+ #-- the software's pipes and wires.
358
+ #--
359
+ #-- vagrant|boxname = {override} geerlingguy/centos7
360
+ #-- runtime|dirname = {override} e>> @f[:runtime][:dirname] + "-appended-xxx"
361
+
362
+ #--
363
+ #-- -------------------
364
+ #-- Documenting Facts
365
+ #-- -------------------
366
+ #--
367
+ #-- Fact doclet statements ARE themselves [facts].
368
+ #-- This means that all behaviour and constraints that apply to
369
+ #-- facts also apply to fact doclet definitions.
370
+ #--
371
+ #-- Fact documentation statements can appear anywhere but [always]
372
+ #-- under the [doclet] - (little documentation) - coordinate.
373
+ #--
374
+ #-- It is okay for the [doclet] tag to appear multiple times in a file.
375
+ #--
376
+ #-- Note that the @s[] sibling construct can be used when relating to
377
+ #-- facts under the same parent group. This is fine even when the facts
378
+ #-- appear in different areas and different files under the same url
379
+ #-- or email namespace eg (devops-hub.com) or (joe@devops-hub.com).
380
+ #--
381
+ #-- [doclet]
382
+ #-- vagrant|boxname = Used in Vagrantfile to specify base operating system of virtual machine.
383
+
384
+
385
+ #--
386
+ #-- ---------------------------
387
+ #-- Facts from REST API Calls
388
+ #-- ---------------------------
389
+ #--
390
+ #-- (use) rest>>
391
+ #-- (instead of) e>>
392
+ #--
393
+ #-- You can read facts directly from a REST API call without having
394
+ #-- to go through an intermediary Class/Method call.
395
+ #--
396
+ #-- ---------
397
+ #-- Examples
398
+ #-- ---------
399
+ #--
400
+ #-- england.time.now = rest>> https://api.devops-hub.com/world_time?country=gb
401
+ #-- america.time.now = rest>> https://api.devops-hub.com/world_time?country=us
402
+ #--
403
+ #--
404
+ #-- vagrant|boxname = {override} geerlingguy/centos7
405
+ #-- runtime|dirname = {override} e>> @f[:runtime][:dirname] + "-appended-xxx"
406
+
407
+ #--
408
+ #-- ------------------------------------------
409
+ #-- Fact Ordering (Files or Database Housing)
410
+ #-- ------------------------------------------
411
+ #--
412
+ #-- Facts can be declared in ANY order.
413
+ #--
414
+ #-- ------------------------------
415
+ #-- Fact Nesting (Templates)
416
+ #-- ------------------------------
417
+ #--
418
+ #-- Facts can be nested when placed in templates with placeholders.
419
+ #-- Nesting facts promotes re-use.
420
+ #--
421
+ #--
422
+ #-- ------------------
423
+ #-- Fact Value Types
424
+ #-- ------------------
425
+ #--
426
+ #-- Yes most fact values are POST (plain old strings), but there are a few more
427
+ #-- value types that add an expressive edge to devops facts. Fact values can be
428
+ #--
429
+ #-- e>> evaluated by Ruby's dynamic processing features
430
+ #-- e>> arrays, hashes, ints, booleans - indeed any class
431
+ #-- r>> regular expressions for use in finding matches
432
+ #-- d>> fact documentation that can appear almost anywhere
433
+ #--
434
+ #--
435
+
436
+ #--
437
+ #-- ------------------------------
438
+ #-- Iteration (Loop) Index Facts
439
+ #-- ------------------------------
440
+ #--
441
+
442
+
443
+ #--
444
+ #-- ------------------------------
445
+ #-- I.N.F.A.C.T.S (See Notepad)
446
+ #-- ------------------------------
447
+ #--
448
+ #-- Who is referencing the fact?
449
+ #-- Where (in what) is the fact referenced?
450
+ #--
451
+ #-- I - Insert, Inherit, Interface and Include snippets (or whole) from Code, Files etc
452
+ #-- N -
453
+ #-- F - File => appears in a file eg .ini, .json, .csv, .yml, .yaml etc
454
+ #-- A - API => rest call => https://api.devops-hub.com/fact/@a?class=vagrant+property=hostname
455
+ #-- C - Code => fact apppears either in commons or plugin code
456
+ #-- T - Template => fact appears in a config file or in Vagrantfile, Dockerfile etc
457
+ #-- S - Sibling => fact definition references a sibling in the same class
458
+ #--
459
+ #-- Note that the API referencing call accepts a shorthand version.
460
+ #-- https://api.devops-hub.com/fact/@a?c=vagrant+p=hostname
461
+ #-- (c) is for (c)lass
462
+ #-- (p) is for (p)roperty
463
+ #--
464
+ #-- Note that (A) types hide the underlying fact definition statement.
465
+ #-- This simple fact honours the "Uniform Access Principle" as stated
466
+ #-- by Bertrand Meyer ( Object Oriented Software Engineering ).
467
+ #--
468
+
469
+
470
+
471
+ #--
472
+ #-- ----------------------------------------------
473
+ #-- No Nil Fact Coordinates - No Nil Fact Values
474
+ #-- ----------------------------------------------
475
+ #--
476
+ #-- Neither fact coordinates nor value can be nil.
477
+ #--
478
+ #-- Failure occurs if any one of
479
+ #--
480
+ #-- the fact group coordinate OR
481
+ #-- the fact key coordinate OR
482
+ #-- the fact value
483
+ #--
484
+ #-- shows up as nil.
485
+ #--
486
+ #--
487
+
488
+
489
+
490
+
491
+ #-- ------------------------------------------
492
+ #-- Fact Constraints | What is not allowed?
493
+ #-- ------------------------------------------
494
+ #--
495
+ #-- @s (sibling facts) CAN be used in the FIRST LINE of a group declaration
496
+ #-- if that group has been defined in ANOTHER fact file.
497
+ #-- (currently will fail but won't once fact order parsing is implemented).
498
+ #--
499
+ #-- @s (sibling facts) CAN be used in the FIRST LINE of a group declaration
500
+ #-- if the reference appears lower down in the fact group or another fact file
501
+ #-- (currently will fail but won't once fact order parsing is implemented).
502
+ #--
503
+ #-- The fact compiler informs us if @s (sibling fact) is consumed and the
504
+ #-- fact declaration is not found within the set of included files/objects.
505
+ #--
506
+ #--
507
+ #--
508
+ #-- ==> duplicate keys is illegal = throw an error to state this
509
+ #-- ==> duplicate keys UNLESS one declared as <<abstract>> or inheritance or {override}
510
+ #--
511
+ ## @todo ==> throw duplicate key EXCEPTION unless
512
+ ##
513
+ ## (a) one declared as <<abstract>> OR
514
+ ## (b) one block inherits from (extends) the other
515
+ ## (c) fact annotated with {override} modifier
516
+ ## (d) one key denoted (if) and the other (unless)
517
+ ##
518
+ #--
519
+
520
+ ## ++++++++++++++++++++++++++++++++++++++++ ##
521
+ ## INVENTORY ==> Accessories After the Fact ##
522
+ ## ++++++++++++++++++++++++++++++++++++++++ ##
523
+ ##
524
+ ## Plugin [inventory] is made up of
525
+ ## ++ Facts (INI Files) == (middleware, platform, user, application)
526
+ ##
527
+ ## ++ (reusable) registry of facts
528
+ ## ++ (specific) plugin fact registry
529
+ ## ++ (reusable) collateral files
530
+ ## ++ (reusable) )runnable scripts
531
+ ## ++ (specific) mission critical content
532
+ ## ++ (reusable) commons behaviour
533
+ ## ++ (reusable) cross cutting concerns
534
+ ## ++++++++++++++++++++++++++++++++++++++++ ##
535
+
536
+
537
+
538
+ # ############################################################################################
539
+ # ####### End of the eco-platform.co.uk Fact Database ####################################
540
+ # ############################################################################################
541
+
542
+
543
+ # --
544
+ # -- -------------------------
545
+ # -- [[Stop Here]] Debug Tool
546
+ # -- -------------------------
547
+ # --
548
+ # -- Stop processing here to examine and evaluate the
549
+ # -- production values of the above facts.
550
+ # --
551
+ # -- stop.here = e>> exit
552
+ # --
553
+