keybox 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -4
- data/README +3 -0
- data/bin/keybox +9 -3
- data/bin/kpg +9 -3
- data/lib/keybox.rb +8 -14
- data/lib/keybox/application/base.rb +8 -6
- data/lib/keybox/application/password_generator.rb +13 -11
- data/lib/keybox/application/password_safe.rb +31 -14
- data/lib/keybox/gemspec.rb +52 -0
- data/lib/keybox/highline_util.rb +1 -1
- data/lib/keybox/specification.rb +128 -0
- data/lib/keybox/storage/container.rb +0 -1
- data/lib/keybox/string_generator.rb +1 -1
- data/lib/keybox/version.rb +21 -0
- data/{data → resources}/chargrams.txt +0 -0
- data/{data → resources}/dark_bg.color_scheme.yaml +0 -0
- data/{data → resources}/light_bg.color_scheme.yaml +0 -0
- data/spec/base_app_spec.rb +1 -1
- data/spec/convert_csv_spec.rb +2 -3
- data/spec/entry_spec.rb +1 -1
- data/spec/keybox_app_spec.rb +25 -24
- data/spec/kpg_app_spec.rb +1 -1
- data/spec/password_hash_spec.rb +2 -1
- data/spec/randomizer_spec.rb +1 -1
- data/spec/spec_helper.rb +21 -0
- data/spec/storage_container_spec.rb +1 -7
- data/spec/storage_record_spec.rb +1 -1
- data/spec/string_generator_spec.rb +2 -1
- data/spec/uuid_spec.rb +2 -1
- metadata +50 -42
- data/vendor/highline/highline.rb +0 -744
- data/vendor/highline/highline/color_scheme.rb +0 -120
- data/vendor/highline/highline/import.rb +0 -43
- data/vendor/highline/highline/menu.rb +0 -395
- data/vendor/highline/highline/question.rb +0 -462
- data/vendor/highline/highline/system_extensions.rb +0 -125
@@ -1,125 +0,0 @@
|
|
1
|
-
#!/usr/local/bin/ruby -w
|
2
|
-
|
3
|
-
# system_extensions.rb
|
4
|
-
#
|
5
|
-
# Created by James Edward Gray II on 2006-06-14.
|
6
|
-
# Copyright 2006 Gray Productions. All rights reserved.
|
7
|
-
#
|
8
|
-
# This is Free Software. See LICENSE and COPYING for details.
|
9
|
-
|
10
|
-
class HighLine
|
11
|
-
module SystemExtensions
|
12
|
-
module_function
|
13
|
-
|
14
|
-
#
|
15
|
-
# This section builds character reading and terminal size functions
|
16
|
-
# to suit the proper platform we're running on. Be warned: Here be
|
17
|
-
# dragons!
|
18
|
-
#
|
19
|
-
begin
|
20
|
-
# Cygwin will look like Windows, but we want to treat it like a Posix OS:
|
21
|
-
raise LoadError, "Cygwin is a Posix OS." if RUBY_PLATFORM =~ /\bcygwin\b/i
|
22
|
-
|
23
|
-
require "Win32API" # See if we're on Windows.
|
24
|
-
|
25
|
-
CHARACTER_MODE = "Win32API" # For Debugging purposes only.
|
26
|
-
|
27
|
-
#
|
28
|
-
# Windows savvy getc().
|
29
|
-
#
|
30
|
-
# *WARNING*: This method ignores <tt>input</tt> and reads one
|
31
|
-
# character from +STDIN+!
|
32
|
-
#
|
33
|
-
def get_character( input = STDIN )
|
34
|
-
Win32API.new("crtdll", "_getch", [ ], "L").Call
|
35
|
-
end
|
36
|
-
|
37
|
-
# A Windows savvy method to fetch the console columns, and rows.
|
38
|
-
def terminal_size
|
39
|
-
m_GetStdHandle = Win32API.new( 'kernel32',
|
40
|
-
'GetStdHandle',
|
41
|
-
['L'],
|
42
|
-
'L' )
|
43
|
-
m_GetConsoleScreenBufferInfo = Win32API.new(
|
44
|
-
'kernel32', 'GetConsoleScreenBufferInfo', ['L', 'P'], 'L'
|
45
|
-
)
|
46
|
-
|
47
|
-
format = 'SSSSSssssSS'
|
48
|
-
buf = ([0] * format.size).pack(format)
|
49
|
-
stdout_handle = m_GetStdHandle.call(0xFFFFFFF5)
|
50
|
-
|
51
|
-
m_GetConsoleScreenBufferInfo.call(stdout_handle, buf)
|
52
|
-
bufx, bufy, curx, cury, wattr,
|
53
|
-
left, top, right, bottom, maxx, maxy = buf.unpack(format)
|
54
|
-
return right - left + 1, bottom - top + 1
|
55
|
-
end
|
56
|
-
rescue LoadError # If we're not on Windows try...
|
57
|
-
begin
|
58
|
-
require "termios" # Unix, first choice.
|
59
|
-
|
60
|
-
CHARACTER_MODE = "termios" # For Debugging purposes only.
|
61
|
-
|
62
|
-
#
|
63
|
-
# Unix savvy getc(). (First choice.)
|
64
|
-
#
|
65
|
-
# *WARNING*: This method requires the "termios" library!
|
66
|
-
#
|
67
|
-
def get_character( input = STDIN )
|
68
|
-
old_settings = Termios.getattr(input)
|
69
|
-
|
70
|
-
new_settings = old_settings.dup
|
71
|
-
new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)
|
72
|
-
new_settings.c_cc[Termios::VMIN] = 1
|
73
|
-
|
74
|
-
begin
|
75
|
-
Termios.setattr(input, Termios::TCSANOW, new_settings)
|
76
|
-
input.getc
|
77
|
-
ensure
|
78
|
-
Termios.setattr(input, Termios::TCSANOW, old_settings)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
rescue LoadError # If our first choice fails, default.
|
82
|
-
CHARACTER_MODE = "stty" # For Debugging purposes only.
|
83
|
-
|
84
|
-
#
|
85
|
-
# Unix savvy getc(). (Second choice.)
|
86
|
-
#
|
87
|
-
# *WARNING*: This method requires the external "stty" program!
|
88
|
-
#
|
89
|
-
def get_character( input = STDIN )
|
90
|
-
raw_no_echo_mode
|
91
|
-
|
92
|
-
begin
|
93
|
-
input.getc
|
94
|
-
ensure
|
95
|
-
restore_mode
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
#
|
100
|
-
# Switched the input mode to raw and disables echo.
|
101
|
-
#
|
102
|
-
# *WARNING*: This method requires the external "stty" program!
|
103
|
-
#
|
104
|
-
def raw_no_echo_mode
|
105
|
-
@state = `stty -g`
|
106
|
-
system "stty raw -echo cbreak isig"
|
107
|
-
end
|
108
|
-
|
109
|
-
#
|
110
|
-
# Restores a previously saved input mode.
|
111
|
-
#
|
112
|
-
# *WARNING*: This method requires the external "stty" program!
|
113
|
-
#
|
114
|
-
def restore_mode
|
115
|
-
system "stty #{@state}"
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
# A Unix savvy method to fetch the console columns, and rows.
|
120
|
-
def terminal_size
|
121
|
-
`stty size`.split.map { |x| x.to_i }.reverse
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|