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,203 @@
1
+ # --
2
+ # -- [MIXIN] magic is deployed to hand out DevOps quality logging
3
+ # -- features to any class that includes the logging module.
4
+ # --
5
+ # -- When logging facilities are not ready we need to log just to
6
+ # -- stdout but when they are we need to use them.
7
+ # --
8
+ # -- mixin power enables one class to give the logfile path and all
9
+ # -- classes will suddenly retrieve a another logger and use that.
10
+ # --
11
+ # -- include Logging
12
+ # -- def doImportant
13
+ # -- log.warn(ere) "unhappy about doing this"
14
+ # -- do_anyway
15
+ # -- log.debug(ere) "all good it was okay"
16
+ # -- end
17
+ # --
18
+ # -- -----------------------
19
+ # -- What are Mixins?
20
+ # -- -----------------------
21
+ # --
22
+ # -- Refer to the below link for excellent coverage of mixins.
23
+ # -- http://ruby-doc.com/docs/ProgrammingRuby/html/tut_modules.html
24
+ # --
25
+ module Logging
26
+
27
+ @@log_path = nil
28
+ @@log_class = nil
29
+
30
+ # --
31
+ # -- Classes that include (MIXIN) this logging module will
32
+ # -- have access to this logger method.
33
+ # --
34
+ # -- [memoization] is implemented here for performance and
35
+ # -- will only initiate a logger under 2 circumstances
36
+ # --
37
+ # -- [1] - the first call (returns a STDOUT logger)
38
+ # -- [2] - the call after the logfile path is set
39
+ # -- (returns a more sophisticated logger)
40
+ # --
41
+ def log
42
+
43
+ @@log_class ||= get_logger
44
+
45
+ end
46
+
47
+
48
+ # --
49
+ # -- log.info(ere) {i woz ere}
50
+ # --
51
+ # -- [ere] is borrowed from the common graffiti phrase (i woz ere)
52
+ # --
53
+ # -- In software terms it allows the logger to print 3 crucial
54
+ # -- pieces of information for the troubleshooter (detective) to
55
+ # -- determine who called the logger (who was here). The
56
+ # --
57
+ # -- [1] - [module name] of the caller
58
+ # -- [2] - [method name] the call came from
59
+ # -- [3] - [line number] of the call
60
+ # --
61
+ # --
62
+ def ere
63
+
64
+ module_name = File.basename caller_locations(1,1).first.absolute_path, ".rb"
65
+ method_name = caller_locations(1,1).first.base_label
66
+ line_number = caller_locations(1,1).first.lineno
67
+
68
+ "#{module_name} | #{method_name} | (line #{line_number}) "
69
+
70
+ end
71
+
72
+ # --
73
+ # -- If logger is used at the [BEGINNING] when
74
+ # -- the runtime logfile path has not yet been
75
+ # -- ascertained then STDOUT is used.
76
+ # --
77
+ # -- However if we have been informed (via the
78
+ # -- set_logfile_path) that the logfile path is
79
+ # -- now known the logger returned will be set
80
+ # -- to log to the specified file.
81
+ # --
82
+ # -- [memoization] should be used so that this
83
+ # -- method gets called only [TWICE].
84
+ # --
85
+ # -- [1] - at the [beginning] when the logfile path is not known
86
+ # -- [2] - just [after] the logfile dir is evaluated and created
87
+ # --
88
+ def get_logger
89
+
90
+ expensive_initializr = "EXPENSIVE(x2) => This log message should only appear [TWICE]."
91
+ Logger.new(STDOUT).warn "#{expensive_initializr}"
92
+
93
+ return get_stdout_logger if @@log_path.nil?
94
+
95
+ file_logger = Logger.new( Logging.initializr_str )
96
+ original_formatter = Logger::Formatter.new
97
+
98
+ file_logger.formatter = proc { |severity, datetime, progname, msg|
99
+ ######## original_formatter.call(severity, datetime, progname, msg.dump.chomp.strip.delete("\"\\"))
100
+ original_formatter.call( severity, datetime, progname, msg.dump.chomp.strip )
101
+ }
102
+
103
+ if CmdLine.has? "--debug" then
104
+ file_logger.level = Logger::DEBUG
105
+ else
106
+ file_logger.level = Logger::INFO
107
+ end
108
+
109
+ return file_logger
110
+
111
+ end
112
+
113
+
114
+ # --
115
+ # -- Get the logger class initiaze string.
116
+ # -- The OS platform "Windows" vs "Linux" dictates
117
+ # -- what is returned as the "tee" command used to
118
+ # -- redirect logging output bot the console and a
119
+ # -- standard log file is not available on Windows.
120
+ # --
121
+ # -- Return the initializer for the logging statement.
122
+ # --
123
+ # -- ------------
124
+ # -- Windows
125
+ # -- ------------
126
+ # --
127
+ # -- Continue logging solely to STANDARD OUT.
128
+ # -- We could log to a file but not to both.
129
+ # --
130
+ # -- ------------
131
+ # -- Linux
132
+ # -- ------------
133
+ # --
134
+ # -- Send back TEE command so that logs pipe to
135
+ # -- both standard out and the designated logfile.
136
+ # --
137
+ def self.initializr_str
138
+
139
+ return STDOUT if Gem.win_platform?
140
+ return "| tee #{@@log_path}"
141
+
142
+ end
143
+
144
+
145
+ # --
146
+ # -- Get a simple STDOUT logger using the
147
+ # -- designated log level.
148
+ # --
149
+ # -- As the early stage when we do not have a
150
+ # -- log file destination the logs are set to
151
+ # -- the DEBUG (max) level.
152
+ # --
153
+ # -- If you need just INFO level logs right
154
+ # -- from the get go - go amend this method.
155
+ # --
156
+ def get_stdout_logger
157
+
158
+ stdout_logger = Logger.new(STDOUT)
159
+ stdout_logger.level = Logger::DEBUG
160
+ return stdout_logger
161
+
162
+ end
163
+
164
+
165
+ #--
166
+ #-- Set logfile path and [INVALIDATE] the
167
+ #-- cache so that memoization reads the new
168
+ #-- @log_class object.
169
+ #--
170
+ def set_logfile_path path_to_set
171
+
172
+ @@log_path = path_to_set
173
+ @@log_class = nil
174
+
175
+ end
176
+
177
+
178
+ #--
179
+ #-- Return the filename and its two immediate
180
+ #-- parent folders (parent and grandparent).
181
+ #--
182
+ #-- When this is not possible when the filepath
183
+ #-- is near the filesystem's root - it returns
184
+ #-- whatever is possible.
185
+ #--
186
+ #-- IMPLEMENT ABOVE FUNCTIONALITY WHEN NEEDED.
187
+ #-- CURRENTLY IT JUST BLUNDERS IN WITH NEITHER
188
+ #-- RHYME NOR REASON.
189
+ #--
190
+ def nickname object_path
191
+
192
+ object_name = File.basename object_path
193
+ parent_folder = File.dirname object_path
194
+ parent_name = File.basename parent_folder
195
+ granny_folder = File.dirname parent_folder
196
+ granny_name = File.basename granny_folder
197
+
198
+ return [granny_name,parent_name,object_name].join("/")
199
+
200
+ end
201
+
202
+
203
+ end
@@ -0,0 +1,425 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # -- ----------------------------------------------------------------- -- #
4
+ # -- the eco stamp -- #
5
+ # -- ---------------------------------------------------------- -- #
6
+ # -- -- #
7
+ # -- The eco-system stamp is at the centre of a fundamental iaas pattern. -- #
8
+ # -- known as the "infrastructure provisioning reference pattern (iprp)". -- #
9
+ # -- The central idea behind the pattern is to link every infrastructure -- #
10
+ # -- object created for an eco-system with an embedded reference that -- #
11
+ # -- contains a "minute accurate" time. -- #
12
+ # -- -- #
13
+ # -- ---------------------------------------------------------- -- #
14
+ # -- which infrastructure [objects] are eco-stamped? -- #
15
+ # -- ---------------------------------------------------------- -- #
16
+ # -- eco-system stamps are used when referencing provisioned -- #
17
+ # -- - files and folders -- #
18
+ # -- - database user names -- #
19
+ # -- - Docker containers -- #
20
+ # -- - virtual machines -- #
21
+ # -- - s3 buckets and their contents -- #
22
+ # -- - aws ec2 machines -- #
23
+ # -- - aws acl lists -- #
24
+ # -- - hostnames and urls -- #
25
+ # --
26
+ # -- --------------------------
27
+ # -- the eco-stamp [segments]
28
+ # -- --------------------------
29
+ # --
30
+ # -- Typical eco-system stamps comprise of a few of the [segments] that
31
+ # -- are listed below. Periods (and at times underscores) are used to
32
+ # -- delineate each segment.
33
+ # --
34
+ # -- | mo | months index | from 01 to 12 | 2 |
35
+ # -- | mmm | abbrv month name | eg feb | 3 |
36
+ # -- | ddd | abbrv day of week | eg tue | 3 |
37
+ # -- | yy | two digit year | eg 19 for 2019 | 2 |
38
+ # -- | jjj | julian day | from 001 to 366 | 3 |
39
+ # -- | hh | hour of day | from 001 to 366 | 2 |
40
+ # -- | mm | minute of hour | from 00 to 59 | 2 |
41
+ # --
42
+ # -- -----------------------------------
43
+ # -- eco-stamp [prefix] and [postfix]
44
+ # -- -----------------------------------
45
+ # --
46
+ # -- eco stamps are not just about time. Yes time is at the core but
47
+ # -- the eco reference will usually be pre or post-fixed with
48
+ # --
49
+ # -- - an eco plugin descriptor
50
+ # -- - a repository [revision]
51
+ # -- - the executors [username]
52
+ # -- - the machine's [hostname]
53
+ # -- - middleware service name
54
+ # --
55
+ class Stamp
56
+ include Singleton
57
+
58
+ attr_reader :time_now
59
+
60
+ # --
61
+ # -- Return two digit [mo] month index from [01] to [12].
62
+ # --
63
+ def self.mo
64
+ return Stamp.instance.time_now.strftime "%m"
65
+ end
66
+
67
+
68
+ # -- ------------------------------------------------------- -- #
69
+ # -- Return three character abbreviated month name (eg feb). -- #
70
+ # -- ------------------------------------------------------- -- #
71
+ def self.mmm
72
+ return Stamp.instance.time_now.strftime( "%b" ).downcase
73
+ end
74
+
75
+
76
+ # -- -------------------------------------------------------- -- #
77
+ # -- Return three character abbreviated day of week (eg wed). -- #
78
+ # -- -------------------------------------------------------- -- #
79
+ def self.ddd
80
+ return Stamp.instance.time_now.strftime( "%a" ).downcase
81
+ end
82
+
83
+
84
+ # --
85
+ # -- Return two digit hour of day from [00] to [23].
86
+ # --
87
+ def self.hh
88
+ return Stamp.instance.time_now.strftime "%H"
89
+ end
90
+
91
+
92
+ # --
93
+ # -- Return two digit minute of hour from [00] to [59].
94
+ # --
95
+ def self.mm
96
+ return Stamp.instance.time_now.strftime "%M"
97
+ end
98
+
99
+
100
+ # --
101
+ # -- Return two digit second of minute from [00] to [59].
102
+ # --
103
+ def self.ss
104
+ return Stamp.instance.time_now.strftime "%S"
105
+ end
106
+
107
+
108
+ # --
109
+ # -- Return a [3 digit] second and tenth of second
110
+ # -- representation.
111
+ # --
112
+ # -- The final digit is derived from the 1000 sliced
113
+ # -- millisecond of second running from 000 to 999.
114
+ # --
115
+ # -- ---------------------------
116
+ # -- Truncation (Not Rounding)
117
+ # -- ---------------------------
118
+ # --
119
+ # -- The [final] digit is acquired by TRUNCATING
120
+ # -- (chopping off) the last 2 of the 3 millisecond
121
+ # -- digits. No rounding is applied.
122
+ # --
123
+ # -- The 3 returned digits comprise of the
124
+ # --
125
+ # -- - second of minute => 2 digits | [00] to [59] (and)
126
+ # -- - tenth of second => 1 digit from [0] to [9]
127
+ # --
128
+ # -- ---------
129
+ # -- Example
130
+ # -- ---------
131
+ # -- => The time at the 562nd millisecond of the 49th
132
+ # -- second of the minute.
133
+ # --
134
+ # -- => 3 chars
135
+ # -- => 495
136
+ # --
137
+ # --
138
+ def self.sst
139
+ millisec_string = Stamp.instance.time_now.strftime "%L"
140
+ return "#{ss}#{millisec_string[0]}"
141
+ end
142
+
143
+
144
+ # --
145
+ # -- Return the [two] digit year (eg 19 for 2019).
146
+ # -- that we are currently in.
147
+ # --
148
+ def self.yy
149
+ return Stamp.instance.time_now.strftime("%Y")[2..-1]
150
+ end
151
+
152
+
153
+ # --
154
+ # -- Return the [four] digit year (eg 2019)
155
+ # -- that we are currently in.
156
+ # --
157
+ def self.yyyy
158
+ return Stamp.instance.time_now.strftime("%Y")
159
+ end
160
+
161
+
162
+ # -- ------------------------------------------------- -- #
163
+ # -- Return 3 digit julian day of year [001] to [366]. -- #
164
+ # -- ------------------------------------------------- -- #
165
+ def self.jjj
166
+ return Stamp.instance.time_now.strftime "%j"
167
+ end
168
+
169
+
170
+ # --
171
+ # -- [yymo_mmm] returns an amalgam of
172
+ # --
173
+ # -- => the two-digit year
174
+ # -- => the two-digit month index (starting at 01)
175
+ # -- => a period (separator)
176
+ # -- => the abbreviated month name
177
+ # --
178
+ # -- ---------
179
+ # -- Example
180
+ # -- ---------
181
+ # -- => 1908.aug
182
+ # -- => for August 2019
183
+ # --
184
+ def self.yymo_mmm
185
+ return "#{yy}#{mo}.#{mmm}"
186
+ end
187
+
188
+
189
+ # --
190
+ # -- Given two integer parameters (month index and 4 digit year) representing
191
+ # -- the month in question this method returns the [PREVIOUS MONTHS] character
192
+ # -- amalgam in the format [yymo_mmm] where
193
+ # --
194
+ # -- => yy | previous month's two-digit year
195
+ # -- => mo | previous month's two-digit month index
196
+ # -- => . | a period (separator)
197
+ # -- => mmm | previous month's abbreviated month name
198
+ # --
199
+ # -- -------------------
200
+ # -- Example 1 (Simple)
201
+ # -- -------------------
202
+ # --
203
+ # -- returns char => 1907.jul
204
+ # -- 4 parameters => 8, 2019
205
+ # -- representing => August, 2019
206
+ # --
207
+ # -- ----------------------
208
+ # -- Example 2 (Last Year)
209
+ # -- ----------------------
210
+ # --
211
+ # -- returns char => 1812.dec
212
+ # -- 4 parameters => 1, 2019
213
+ # -- representing => January, 2019
214
+ # --
215
+ def self.previous_month_chars this_month_index, this_4digit_year
216
+
217
+ prev_month_index = this_month_index == 1 ? 12 : ( this_month_index - 1 )
218
+ prev_2dig_mn_pad = sprintf '%02d', prev_month_index
219
+ prev_4digit_year = this_month_index == 1 ? ( this_4digit_year - 1 ) : this_4digit_year
220
+ prev_twodigit_yr = "#{prev_4digit_year.to_s}"[2..-1]
221
+ prev_months_name = Date::ABBR_MONTHNAMES[prev_month_index].downcase
222
+
223
+ return "#{prev_twodigit_yr}#{prev_2dig_mn_pad}.#{prev_months_name}"
224
+
225
+ end
226
+
227
+ # --
228
+ # -- Using the current class time this method returns
229
+ # -- the character amalgam for the [PREVIOUS MONTH] in
230
+ # -- the format [yymo_mmm] where
231
+ # --
232
+ # -- => yy | last month's two-digit year
233
+ # -- => mo | last month's two-digit month index
234
+ # -- => . | a period (separator)
235
+ # -- => mmm | last month's abbreviated month name
236
+ # --
237
+ # -- -------------------
238
+ # -- Example 1 (Simple)
239
+ # -- -------------------
240
+ # --
241
+ # -- returns => 1907.jul
242
+ # -- if this month is => August 2019
243
+ # --
244
+ # -- ----------------------
245
+ # -- Example 2 (Last Year)
246
+ # -- ----------------------
247
+ # --
248
+ # -- returns => 1812.dec
249
+ # -- if this month is => January 2019
250
+ # --
251
+ def self.yymo_mmm_prev
252
+ return previous_month_chars mo.to_i, yyyy.to_i
253
+ end
254
+
255
+
256
+ # -- ---------------------------------------------- -- #
257
+ # -- Return 5 digit amalgam of year and julian day. -- #
258
+ # -- eg [19003] for [January 3rd 2019] -- #
259
+ # -- ---------------------------------------------- -- #
260
+ def self.yyjjj
261
+ return "#{yy}#{jjj}"
262
+ end
263
+
264
+
265
+ # --
266
+ # -- Return the 4 digit amalgam of the hour and minute
267
+ # -- using the 24 hour clock.
268
+ # --
269
+ # -- ---------
270
+ # -- Example
271
+ # -- ---------
272
+ # -- => 1525
273
+ # -- => 03:25 pm
274
+ # --
275
+ def self.hhmm
276
+ return "#{hh}#{mm}"
277
+ end
278
+
279
+
280
+ # --
281
+ # -- Return the time of day to a TENTH of a second accuracy.
282
+ # -- [8] characters will always be returned with the 5th one
283
+ # -- being the (period) separator.
284
+ # --
285
+ # -- The first (separated) segment delivers a hhmm 24 hour
286
+ # -- clock representation of the stamped time.
287
+ # --
288
+ # -- The 3 digits of the second segment comprise of
289
+ # --
290
+ # -- second of minute => 2 digits | [00] to [59]
291
+ # -- tenth of second => 1 digit from [0] to [9]
292
+ # --
293
+ # -- ---------
294
+ # -- Example
295
+ # -- ---------
296
+ # -- => The time at the 562nd millisecond of the 49th
297
+ # -- second of the 23rd minute of the 17th hour of
298
+ # -- the day ( 17:23:49.562 )
299
+ # --
300
+ # -- => 8 chars
301
+ # -- => 1723.495
302
+ # --
303
+ def self.hhmm_sst
304
+ return "#{hhmm}.#{sst}"
305
+ end
306
+
307
+
308
+ # --
309
+ # -- Return a period separated amalgam of the
310
+ # --
311
+ # -- => 2 digit year and 3 digit julian day
312
+ # -- => 4 digit hour/minute
313
+ # --
314
+ # -- ---------
315
+ # -- Example
316
+ # -- ---------
317
+ # -- => 19003.1025
318
+ # -- => 10:25 am on January 3rd 2019
319
+ # --
320
+ # --
321
+ # -- Return the time of day to a TENTH of a second accuracy.
322
+ # -- [8] characters will always be returned with the 5th one
323
+ # -- being the (period) separator.
324
+ # --
325
+ # -- The first (separated) segment delivers a hhmm 24 hour
326
+ # -- clock representation of the stamped time.
327
+ # --
328
+ # -- The 3 digits of the second segment comprise of
329
+ # --
330
+ # -- second of minute => 2 digits | [00] to [59]
331
+ # -- tenth of second => 1 digit from [0] to [9]
332
+ # --
333
+ # -- ---------
334
+ # -- Example
335
+ # -- ---------
336
+ # -- => The time at the 562nd millisecond of the 49th
337
+ # -- second of the 23rd minute of the 17th hour of
338
+ # -- the day ( 17:23:49.562 )
339
+ # --
340
+ # -- => 8 chars
341
+ # -- => 1723.495
342
+ # --
343
+ def self.yyjjj_hhmm_sst
344
+ return "#{yyjjj}.#{hhmm}.#{sst}"
345
+ end
346
+
347
+
348
+ # -- ----------------------------------------- -- #
349
+ # -- Return the Rubyfied time zone being used. -- #
350
+ # -- ----------------------------------------- -- #
351
+ def self.zone
352
+ return Stamp.instance.time_now.zone
353
+ end
354
+
355
+
356
+ # -- -------------------------------------------------- -- #
357
+ # -- Log segments of time pertaining to the time stamp. -- #
358
+ # -- -------------------------------------------------- -- #
359
+ def self.log_instance_time
360
+
361
+ log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
362
+ log.info(ere) { "[stamp] eco time stamp => [#{Stamp.instance.time_now.ctime}]" }
363
+ log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
364
+ log.info(ere) { "[stamp] Univ Time Zone => #{zone}" }
365
+ log.info(ere) { "[stamp] Month Index is => #{mo}" }
366
+ log.info(ere) { "[stamp] Month Name is => #{mmm}" }
367
+ log.info(ere) { "[stamp] Day Of Week is => #{ddd}" }
368
+ log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
369
+ log.info(ere) { "[stamp] Two Digit Year => #{yy}" }
370
+ log.info(ere) { "[stamp] Julian Cal Day => #{jjj}" }
371
+ log.info(ere) { "[stamp] Yr and Jul Day => #{yyjjj}" }
372
+ log.info(ere) { "[stamp] Hour of Theday => #{hh}" }
373
+ log.info(ere) { "[stamp] Minute of Hour => #{mm}" }
374
+ log.info(ere) { "[stamp] Hour + Minute => #{hhmm}" }
375
+ log.info(ere) { "[stamp] Second of Min => #{ss}" }
376
+ log.info(ere) { "[stamp] 600 Min Slices => #{sst}" }
377
+ log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
378
+ log.info(ere) { "[stamp] The Time Stamp => #{yyjjj_hhmm_sst}" }
379
+ log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
380
+
381
+ end
382
+
383
+
384
+ # -- ------------------------------------------------------------ -- #
385
+ # -- This singleton (one instance) class sets the time just once. -- #
386
+ # -- ------------------------------------------------------------ -- #
387
+ def initialize
388
+
389
+ @time_now = Time.now;
390
+
391
+ end
392
+
393
+
394
+ # --
395
+ # -- This method tests the previous month behaviour.
396
+ # -- Simply set the year index to the desired integer and roll.
397
+ # --
398
+ # -- Example Call
399
+ # --
400
+ # -- Stamp.test_previous_month 2015
401
+ # --
402
+ def self.test_previous_month year_index
403
+
404
+ month_index = 1
405
+
406
+ log.info(ere) { "This Month Char Amalgam => #{yymo_mmm}" }
407
+ log.info(ere) { "Prev Month Char Amalgam => #{yymo_mmm_prev}" }
408
+
409
+ until month_index == 13 do
410
+ prev_month_chars = Stamp.previous_month_chars month_index, year_index
411
+ log.info(ere) { "Char Amalgam | #{prev_month_chars} => month #{month_index} | year #{year_index}" }
412
+ month_index +=1
413
+ end
414
+
415
+ end
416
+
417
+
418
+ # -- -------------------------------------------------------------------- -- #
419
+ # -- [Cold Call Pattern] - If class has no [internal] dependencies it can -- #
420
+ # -- initialize itself ignoring any require [order] -- #
421
+ # -- -------------------------------------------------------------------- -- #
422
+ Stamp.log_instance_time
423
+ Stamp.test_previous_month yyyy.to_i
424
+
425
+ end