nub 0.0.47 → 0.0.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nub/config.rb +6 -0
- data/lib/nub/sys.rb +9 -0
- 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: dd4f2a86566eb5437068e162cc7ac20c109ea8b84eb64a78441ba5e1d803d9ec
|
4
|
+
data.tar.gz: e96f44af477ecb179665d809dd24d982d9ec18df6f050f34e9b1354b77a8fc59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 896c9795ecb976b6694a061068c085b1131bd6a74284e14d0d624e41306ec7b310bee8a1cc9a4dc1ffd7f76a5231986d91f1b430438700a5779fca73e4040057
|
7
|
+
data.tar.gz: fa150deaf63ab606d815cb0ead6b81e167856656e60e41e2373821459fa0752803db845625a0c2877e5661427170ed8c4b57ec67cbda83167562111284f717c3
|
data/lib/nub/config.rb
CHANGED
@@ -72,6 +72,12 @@ module Config
|
|
72
72
|
return @@_yml[key] = val
|
73
73
|
end
|
74
74
|
|
75
|
+
# Get the given key and raise an error if it doesn't exist
|
76
|
+
def get!(key)
|
77
|
+
Log.die("couldn't find '#{key}' in config") if !@@_yml.key?(key)
|
78
|
+
return @@_yml[key]
|
79
|
+
end
|
80
|
+
|
75
81
|
# Save the config file
|
76
82
|
def save
|
77
83
|
File.write(@path, @@_yml.to_yaml) if @@_yml
|
data/lib/nub/sys.rb
CHANGED
@@ -69,6 +69,15 @@ module Sys
|
|
69
69
|
|
70
70
|
return OpenStruct.new(result: result, stdout: stdout.string, stderr: stderr.string)
|
71
71
|
end
|
72
|
+
|
73
|
+
# Read a password from stdin without echoing
|
74
|
+
# @returns pass [String] the password read in
|
75
|
+
def getpass
|
76
|
+
print("Enter Password: ")
|
77
|
+
pass = STDIN.noecho(&:gets).strip
|
78
|
+
puts
|
79
|
+
return pass
|
80
|
+
end
|
72
81
|
end
|
73
82
|
|
74
83
|
# vim: ft=ruby:ts=2:sw=2:sts=2
|