toolrack 0.9.2 → 0.9.3
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.
- checksums.yaml +4 -4
- data/README.md +54 -4
- data/lib/toolrack/version.rb +1 -1
- data/lib/toolrack.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42fd35a5442e9aaae8d559536346c0de0228db4d93aa40d1d4720eeacf5c7c31
|
4
|
+
data.tar.gz: 02efc3e79b36480a037174d7005cbcbfddc217688e71b2ebc7b41e0d66bfe12b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54354902f0f97ca0c7c0295ec8ca9b7e25912fcb69954f4d290793ed5a4732e7ec5806ef35c4a5a08e8cc6e68552ce9744023680c5d14d960bfcef09931b0f62
|
7
|
+
data.tar.gz: 861b791fa8f1396d111f13f21cb91a4375ef9a5c565bcd7c842dca1cae1550d6919a14daf6d8d393009ff3bf44502d8d4b64bd678d813412f89d9e4167b2f686
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Toolrack
|
2
2
|
|
3
|
-
Toolrack just the collection of utilities that helps in my code clarity
|
3
|
+
Toolrack just the collection of utilities that helps in my code clarity and assistance since those utils too small to be a gem on its own.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -40,10 +40,21 @@ class EditController
|
|
40
40
|
# enable instance method to access those uitilities
|
41
41
|
include ToolRack::ConditionUtils
|
42
42
|
include ToolRack::ExceptionUtils
|
43
|
+
include ToolRack::PasswordUtils
|
44
|
+
include ToolRack::RuntimeUtils
|
45
|
+
include ToolRack::DataConversionUtils
|
46
|
+
|
47
|
+
# there is also shortcut since I write it so often
|
48
|
+
include TR::CondUtils
|
49
|
+
include TR::ExpUtils
|
50
|
+
include TR::PassUtils
|
51
|
+
include TR::RTUtils
|
52
|
+
include TR::DataConvUtils
|
43
53
|
end
|
44
54
|
```
|
45
55
|
|
46
|
-
Currently it has
|
56
|
+
Currently it has 5 modules:
|
57
|
+
|
47
58
|
* Condition Utilities
|
48
59
|
* is\_empty?(obj) - I found that I've type the condition if not (x.nil? and x.empty?) too frequent that I think this is very best to turn this into a function. The empty test shall take the following test in sequence:
|
49
60
|
* First test is x.nil?. If it is return true
|
@@ -77,6 +88,45 @@ Currently it has 3 modules:
|
|
77
88
|
* raise\_if\_false(obj, message, error) - As the name implied
|
78
89
|
* raise\_if\_true(obj, message, error) - As the name implied
|
79
90
|
|
80
|
-
|
81
|
-
|
91
|
+
* Runtime utils - Tired rewriting this in other project. Detect if the running system is on which operating system / runtime. The function is pretty self descriptive
|
92
|
+
* RuntimeUtils.on\_windows?
|
93
|
+
* RuntimeUtils.on\_mac?
|
94
|
+
* RuntimeUtils.on\_linux?
|
95
|
+
* RuntimeUtils.on\_ruby?
|
96
|
+
* RuntimeUtils.on\_jruby?
|
97
|
+
|
98
|
+
* Password utils - Generate random password with designated complexity
|
99
|
+
* generate\_random\_password(length, options = { complexity: \<value\>, enforce\_quality: \<true/false\> })
|
100
|
+
* length - length of the required generated password
|
101
|
+
* options[:complexity]:
|
102
|
+
* 1 - lowercase alphabet
|
103
|
+
* 2 - lower + upper case alphabet [alpha]
|
104
|
+
* 3 - lower + upper + number [alpha numeric]
|
105
|
+
* 4 - lower + upper + number + symbol
|
106
|
+
* options[:enforce\_quality]
|
107
|
+
* true - generated password is guaranteed to contain the required complexity. E.g. if complexity 4 is required, the password MUST contain lower, upper, number and symbol as its output or a new password that comply to the complexity shall be regenerated. This process is repeated until the required complexity is achieved
|
108
|
+
* false - The rules of the complexity is relexed. E.g. if complexity 4 is requested, the output might not have symbol in it.
|
109
|
+
* gen\_rand\_pass(length, options = { }) & gen\_pass(length, options = { })
|
110
|
+
* Alias for method generate\_random\_password
|
111
|
+
|
112
|
+
* all\_lowercase\_alpha?(str)
|
113
|
+
* all\_uppercase\_alpha?(str)
|
114
|
+
* all\_alpha?(str)
|
115
|
+
* all\_number?(str)
|
116
|
+
* all\_symbol?(str)
|
117
|
+
* all\_alpha\_numeric?(str)
|
118
|
+
* all\_alpha\_numeric\_and\_symbol?(str)
|
119
|
+
* All methods above starts with all_\* is to check for strict compliance to the required output. E.g. if all\_alpha?(str) is used, the input str MUST be all alpha to get a true status
|
120
|
+
|
121
|
+
* has\_lowercase\_alpha?(str)
|
122
|
+
* has\_uppercase\_alpha?(str)
|
123
|
+
* has\_alpha?(str)
|
124
|
+
* has\_number?(str)
|
125
|
+
* has\_symbol?(str)
|
126
|
+
* has\_alpha\_numeric?(str)
|
127
|
+
* has\_alpha\_numeric\_or\_symbol?(str)
|
128
|
+
* All methods above start with has_\* is just to check if the given str contains the required specification. E.g string 'abcdE' will still get true status if pass to has\_lowercase\_alpha?(str). But value 1234 or '1234' or '$%^&' pass to has\_lowercase\_alpha?(str) shall return false.
|
129
|
+
|
130
|
+
|
131
|
+
Check out the rspec folder for usage
|
82
132
|
|
data/lib/toolrack/version.rb
CHANGED
data/lib/toolrack.rb
CHANGED
@@ -22,8 +22,20 @@ module Antrapol
|
|
22
22
|
end
|
23
23
|
|
24
24
|
ToolRack = Antrapol::ToolRack
|
25
|
-
|
25
|
+
TR = ToolRack
|
26
|
+
|
27
|
+
ToolRack::DataConvUtils = Antrapol::ToolRack::DataConversionUtils
|
28
|
+
TR::DataConvUtils = ToolRack::DataConvUtils
|
29
|
+
|
26
30
|
ToolRack::CondUtils = ToolRack::ConditionUtils
|
31
|
+
TR::CondUtils = ToolRack::ConditionUtils
|
32
|
+
|
27
33
|
ToolRack::PassUtils = ToolRack::PasswordUtils
|
34
|
+
TR::PassUtils = ToolRack::PasswordUtils
|
35
|
+
|
36
|
+
ToolRack::ExpUtils = ToolRack::ExceptionUtils
|
37
|
+
TR::ExpUtils = ToolRack::ExpUtils
|
28
38
|
|
39
|
+
ToolRack::RTUtils = ToolRack::RuntimeUtils
|
40
|
+
TR::RTUtils = ToolRack::RTUtils
|
29
41
|
|