pwss 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pwss/entry.rb +17 -10
  3. data/lib/pwss/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8f78fcbff78980c4edaffd950cdab7ac876c2f1
4
- data.tar.gz: c879c1fe675758b9933c74407d22eaec423e2778
3
+ metadata.gz: 55b89de23284b460cea7b8ecae62a0c4e668e98f
4
+ data.tar.gz: 350e6f23afa3abea664808989b0f356cb6ca42a4
5
5
  SHA512:
6
- metadata.gz: 3fb10913eda71dd03f138e5355735657a5b0bfe234932405522474bd5ad94bc4545ac6ce14b6b30e8c78496e6afc83f435d40888ba1d64703fced8d4372f8f24
7
- data.tar.gz: dd675b3508cc93830808818e97cb21282120b83412a3b86f9c8f8ae4f51a9a9acb0c799d37765e405072e828d3eda0bdb9bac183cd6ac200d3460dd4777ac58f
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, default value, and prompt
13
+ # the fields of an entry, together with the function to ask the and default value
12
14
  FIELDS = {
13
- "title" => ["gets.chomp", "'title'", "title: "],
14
- "username" => ["gets.chomp", "''", "username: "],
15
- "password" => ["Cipher.check_password('password for entry: ')", "''", ""],
16
- "added" => ["", "Date.today.to_s", ""],
17
- "url" => ["gets.chomp", "''", "url: "],
18
- "description" => ["get_lines", "''", "description (terminate with '.'):\n"]
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
- $/ = "\n.\n"
48
- STDIN.gets.chomp("\n.\n")
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
@@ -1,3 +1,3 @@
1
1
  module Pwss
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-06-13 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler