pwss 0.0.2 → 0.0.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/lib/pwss/entry.rb +17 -10
- data/lib/pwss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55b89de23284b460cea7b8ecae62a0c4e668e98f
|
4
|
+
data.tar.gz: 350e6f23afa3abea664808989b0f356cb6ca42a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df29869f6f101c103cde9bd8c0326cbbdf22572fb1a13c1567b26445a79d4b163e5b0897573f3cc1ecafb8c2ae21f0fd93027cc72189053fd6c3ec30f04e4226
|
7
|
+
data.tar.gz: 84f87ffd3efa46fe0566458edba2c6750e754ae592fe7190865f5d0a884c25aeab75326e5bc08f3e47fa5797cf4dcdf15ceae6eb765e3c3307e2a21bd49881a9
|
data/lib/pwss/entry.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'readline'
|
2
|
+
|
1
3
|
module Pwss
|
2
4
|
#
|
3
5
|
# Entry manages an entry in the password safe
|
@@ -8,14 +10,14 @@ module Pwss
|
|
8
10
|
DEFAULT=1
|
9
11
|
PROMPT=2
|
10
12
|
|
11
|
-
# the fields of an entry, together with the function to ask the
|
13
|
+
# the fields of an entry, together with the function to ask the and default value
|
12
14
|
FIELDS = {
|
13
|
-
"title" => ["
|
14
|
-
"username" => ["
|
15
|
-
"password" => ["Cipher.check_password('password for entry: ')", "''"
|
16
|
-
"added" => ["", "Date.today.to_s"
|
17
|
-
"url" => ["
|
18
|
-
"description" => ["get_lines", "''"
|
15
|
+
"title" => ["Readline.readline('title: ')", "'title'"],
|
16
|
+
"username" => ["Readline.readline('username: ')", "''"],
|
17
|
+
"password" => ["Cipher.check_password('password for entry: ')", "''"],
|
18
|
+
"added" => ["", "Date.today.to_s"],
|
19
|
+
"url" => ["Readline.readline('url: ')", "''"],
|
20
|
+
"description" => ["get_lines", "''"]
|
19
21
|
}
|
20
22
|
|
21
23
|
# the values (a Hash) of this issue
|
@@ -28,7 +30,6 @@ module Pwss
|
|
28
30
|
# interactively ask from command line all fields specified in FIELDS
|
29
31
|
def ask
|
30
32
|
FIELDS.keys.each do |key|
|
31
|
-
printf "#{FIELDS[key][PROMPT]}" if FIELDS[key][PROMPT] != ""
|
32
33
|
@entry[key] = (eval FIELDS[key][INPUT_F]) || (eval FIELDS[key][DEFAULT])
|
33
34
|
end
|
34
35
|
end
|
@@ -44,8 +45,14 @@ module Pwss
|
|
44
45
|
|
45
46
|
# read n-lines (terminated by a ".")
|
46
47
|
def get_lines
|
47
|
-
|
48
|
-
|
48
|
+
puts "description (terminate with '.'):"
|
49
|
+
lines = []
|
50
|
+
line = ""
|
51
|
+
until line == "."
|
52
|
+
line = Readline.readline
|
53
|
+
lines << line
|
54
|
+
end
|
55
|
+
lines.join("\n")
|
49
56
|
end
|
50
57
|
|
51
58
|
end
|
data/lib/pwss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adolfo Villafiorita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|