rye 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +6 -0
- data/README.rdoc +5 -7
- data/bin/rye +3 -3
- data/lib/rye.rb +1 -1
- data/lib/rye/box.rb +1 -1
- data/rye.gemspec +31 -1
- data/vendor/highline-1.5.1/CHANGELOG +222 -0
- data/vendor/highline-1.5.1/INSTALL +35 -0
- data/vendor/highline-1.5.1/LICENSE +7 -0
- data/vendor/highline-1.5.1/README +63 -0
- data/vendor/highline-1.5.1/Rakefile +82 -0
- data/vendor/highline-1.5.1/TODO +6 -0
- data/vendor/highline-1.5.1/examples/ansi_colors.rb +38 -0
- data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +18 -0
- data/vendor/highline-1.5.1/examples/basic_usage.rb +75 -0
- data/vendor/highline-1.5.1/examples/color_scheme.rb +32 -0
- data/vendor/highline-1.5.1/examples/limit.rb +12 -0
- data/vendor/highline-1.5.1/examples/menus.rb +65 -0
- data/vendor/highline-1.5.1/examples/overwrite.rb +19 -0
- data/vendor/highline-1.5.1/examples/page_and_wrap.rb +322 -0
- data/vendor/highline-1.5.1/examples/password.rb +7 -0
- data/vendor/highline-1.5.1/examples/trapping_eof.rb +22 -0
- data/vendor/highline-1.5.1/examples/using_readline.rb +17 -0
- data/vendor/highline-1.5.1/lib/highline.rb +758 -0
- data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +120 -0
- data/vendor/highline-1.5.1/lib/highline/compatibility.rb +17 -0
- data/vendor/highline-1.5.1/lib/highline/import.rb +43 -0
- data/vendor/highline-1.5.1/lib/highline/menu.rb +395 -0
- data/vendor/highline-1.5.1/lib/highline/question.rb +463 -0
- data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +193 -0
- data/vendor/highline-1.5.1/setup.rb +1360 -0
- data/vendor/highline-1.5.1/test/tc_color_scheme.rb +56 -0
- data/vendor/highline-1.5.1/test/tc_highline.rb +823 -0
- data/vendor/highline-1.5.1/test/tc_import.rb +54 -0
- data/vendor/highline-1.5.1/test/tc_menu.rb +429 -0
- data/vendor/highline-1.5.1/test/ts_all.rb +15 -0
- metadata +31 -1
data/CHANGES.txt
CHANGED
@@ -4,6 +4,12 @@ TODO
|
|
4
4
|
|
5
5
|
* Fingerprints: ssh-keygen -l -f id_rsa_repos.pub
|
6
6
|
|
7
|
+
|
8
|
+
#### 0.6.2 (2009-04-29) #############################
|
9
|
+
|
10
|
+
* FIXED: I forgot to add highline to the gemspec file manifest. Cripes!
|
11
|
+
|
12
|
+
|
7
13
|
#### 0.6.1 (2009-04-29) #############################
|
8
14
|
|
9
15
|
* ADDED: Prints message to STDERR when passwordless login fails.
|
data/README.rdoc
CHANGED
@@ -33,13 +33,13 @@ See <tt>rye -h</tt> for more info
|
|
33
33
|
== EXAMPLE 2 -- Basic Usage
|
34
34
|
|
35
35
|
rbox = Rye::Box.new('localhost')
|
36
|
-
rbox.uptime
|
37
|
-
rbox['/usr/bin'].pwd
|
36
|
+
rbox.uptime # => 11:02 up 16:01, 3 users
|
37
|
+
rbox['/usr/bin'].pwd # => /usr/bin
|
38
38
|
|
39
39
|
You can specify environment variables
|
40
40
|
|
41
41
|
rbox.setenv(:RYE, "Forty Creek")
|
42
|
-
rbox.env
|
42
|
+
rbox.env # => ['HOME=/home/rye', 'RYE=Forty Creek', ...]
|
43
43
|
|
44
44
|
|
45
45
|
== EXAMPLE 3 -- Accessing Multiple Machines
|
@@ -47,7 +47,6 @@ You can specify environment variables
|
|
47
47
|
rset = Rye::Set.new
|
48
48
|
rbox = Rye::Box.new
|
49
49
|
|
50
|
-
rset.add_keys('/private/key/path') # For passwordless logins
|
51
50
|
rset.add_boxes(rbox, 'localhost') # Add boxes as hostnames or objects
|
52
51
|
|
53
52
|
Calling methods on Rye::Set objects is very similar to calling them on Rye::Box objects. In fact, it's identical:
|
@@ -69,7 +68,7 @@ Calling methods on Rye::Set objects is very similar to calling them on Rye::Box
|
|
69
68
|
applejack = StringIO.new("Some in-memory content")
|
70
69
|
rbox.upload(applejack, "#{dir_upload}/applejack.txt")
|
71
70
|
|
72
|
-
p rbox.ls(dir_upload)
|
71
|
+
p rbox.ls(dir_upload) # => [README.rdoc, LICENSE.txt, applejack.txt]
|
73
72
|
p rbox.cat("#{dir_upload}/applejack.txt") # => "Some in-memory content"
|
74
73
|
|
75
74
|
filecontent = StringIO.new
|
@@ -83,7 +82,7 @@ Calling methods on Rye::Set objects is very similar to calling them on Rye::Box
|
|
83
82
|
In safe-mode:
|
84
83
|
|
85
84
|
* You can't use file globs. This means you can't do this: <tt>rbox.ls('*.rb')</tt>. <tt>~</tt> also doesn't work!
|
86
|
-
*
|
85
|
+
* You can't use environment variables as arguments. This means you can't do this: <tt>rbox.echo('$HOME')</tt>. However, environment variables are available to the commands you run.
|
87
86
|
* Pipes and operators don't work: <tt>|, &&, >, <, ||, ~</tt>, etc...
|
88
87
|
* Backticks don't work either: <tt>procs=`ps aux`</tt>
|
89
88
|
|
@@ -111,7 +110,6 @@ Rye permits only a limited number of system commands to be run. This default whi
|
|
111
110
|
This list will grow. If you find one let me know!
|
112
111
|
|
113
112
|
* Rye doesn't read the ~/.ssh/config file yet
|
114
|
-
* Highline 1.5 not working in Ruby 1.9 (password prompts hang)
|
115
113
|
* Rye uses OpenSSL's ssh-agent (if it exists). Rye starts it up as a child process and shuts it down using at_exit. If you have code in an at_exit that rely's on Rye, make sure your code runs before Rye's at_exit block is called. For example, Drydock uses at_exit too which is why in bin/rye you can see that Drydock is called explicitly so that Rye's at_exit is executed after Drydock executes a command.
|
116
114
|
|
117
115
|
|
data/bin/rye
CHANGED
@@ -47,10 +47,10 @@ command :authorize do |obj|
|
|
47
47
|
|
48
48
|
obj.argv.each do |hostname|
|
49
49
|
|
50
|
-
puts "Authorizing #{
|
51
|
-
rbox = Rye::Box.new(hostname, opts)
|
50
|
+
puts "Authorizing #{obj.option.user}@#{hostname}"
|
51
|
+
rbox = Rye::Box.new(hostname, opts)
|
52
52
|
puts "Added public keys for: ", rbox.authorize_keys_remote
|
53
|
-
puts "Now try: " << "ssh #{
|
53
|
+
puts "Now try: " << "ssh #{obj.option.user}@#{hostname}"
|
54
54
|
|
55
55
|
end
|
56
56
|
|
data/lib/rye.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# Temporary fix before Highline 1.5.1 is release. This fixes
|
3
3
|
# a the issue with Ruby 1.9 that causes the prompts to hang.
|
4
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1')
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
|
5
5
|
|
6
6
|
require 'tempfile'
|
7
7
|
require 'logger'
|
data/lib/rye/box.rb
CHANGED
data/rye.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "rye"
|
3
3
|
s.rubyforge_project = "rye"
|
4
|
-
s.version = "0.6.
|
4
|
+
s.version = "0.6.2"
|
5
5
|
s.summary = "Rye: Safely run SSH commands on a bunch of machines at the same time (from Ruby)."
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
@@ -53,6 +53,36 @@
|
|
53
53
|
tst/60-file.mp3
|
54
54
|
tst/60_rbox_transfer_test.rb
|
55
55
|
tst/70_rbox_env_test.rb
|
56
|
+
vendor/highline-1.5.1/CHANGELOG
|
57
|
+
vendor/highline-1.5.1/INSTALL
|
58
|
+
vendor/highline-1.5.1/LICENSE
|
59
|
+
vendor/highline-1.5.1/README
|
60
|
+
vendor/highline-1.5.1/Rakefile
|
61
|
+
vendor/highline-1.5.1/TODO
|
62
|
+
vendor/highline-1.5.1/examples/ansi_colors.rb
|
63
|
+
vendor/highline-1.5.1/examples/asking_for_arrays.rb
|
64
|
+
vendor/highline-1.5.1/examples/basic_usage.rb
|
65
|
+
vendor/highline-1.5.1/examples/color_scheme.rb
|
66
|
+
vendor/highline-1.5.1/examples/limit.rb
|
67
|
+
vendor/highline-1.5.1/examples/menus.rb
|
68
|
+
vendor/highline-1.5.1/examples/overwrite.rb
|
69
|
+
vendor/highline-1.5.1/examples/page_and_wrap.rb
|
70
|
+
vendor/highline-1.5.1/examples/password.rb
|
71
|
+
vendor/highline-1.5.1/examples/trapping_eof.rb
|
72
|
+
vendor/highline-1.5.1/examples/using_readline.rb
|
73
|
+
vendor/highline-1.5.1/lib/highline.rb
|
74
|
+
vendor/highline-1.5.1/lib/highline/color_scheme.rb
|
75
|
+
vendor/highline-1.5.1/lib/highline/compatibility.rb
|
76
|
+
vendor/highline-1.5.1/lib/highline/import.rb
|
77
|
+
vendor/highline-1.5.1/lib/highline/menu.rb
|
78
|
+
vendor/highline-1.5.1/lib/highline/question.rb
|
79
|
+
vendor/highline-1.5.1/lib/highline/system_extensions.rb
|
80
|
+
vendor/highline-1.5.1/setup.rb
|
81
|
+
vendor/highline-1.5.1/test/tc_color_scheme.rb
|
82
|
+
vendor/highline-1.5.1/test/tc_highline.rb
|
83
|
+
vendor/highline-1.5.1/test/tc_import.rb
|
84
|
+
vendor/highline-1.5.1/test/tc_menu.rb
|
85
|
+
vendor/highline-1.5.1/test/ts_all.rb
|
56
86
|
)
|
57
87
|
|
58
88
|
s.extra_rdoc_files = %w[README.rdoc LICENSE.txt]
|
@@ -0,0 +1,222 @@
|
|
1
|
+
= Change Log
|
2
|
+
|
3
|
+
Below is a complete listing of changes for each revision of HighLine.
|
4
|
+
|
5
|
+
== 1.5.1
|
6
|
+
|
7
|
+
* Fixed the long standing echo true bug.
|
8
|
+
(reported by Lauri Tuominen)
|
9
|
+
* Improved Windows API calls to support the redirection of STDIN.
|
10
|
+
(patch by Aaron Simmons)
|
11
|
+
* Updated gem specification to avoid a deprecated call.
|
12
|
+
* Made a minor documentation clarification about character mode support.
|
13
|
+
* Worked around some API changes in Ruby's standard library in Ruby 1.9.
|
14
|
+
(patch by Jake Benilov)
|
15
|
+
|
16
|
+
== 1.5.0
|
17
|
+
|
18
|
+
* Fixed a bug that would prevent Readline from showing all completions.
|
19
|
+
(reported by Yaohan Chen)
|
20
|
+
* Added the ability to pass a block to HighLine#agree().
|
21
|
+
(patch by Yaohan Chen)
|
22
|
+
|
23
|
+
== 1.4.0
|
24
|
+
|
25
|
+
* Made the code grabbing terminal size a little more cross-platform by
|
26
|
+
adding support for Solaris. (patch by Ronald Braswell and Coey Minear)
|
27
|
+
|
28
|
+
== 1.2.9
|
29
|
+
|
30
|
+
* Additional work on the backspacing issue. (patch by Jeremy Hinegardner)
|
31
|
+
* Fixed Readline prompt bug. (patch by Jeremy Hinegardner)
|
32
|
+
|
33
|
+
== 1.2.8
|
34
|
+
|
35
|
+
* Fixed backspacing past the prompt and interrupting a prompt bugs.
|
36
|
+
(patch by Jeremy Hinegardner)
|
37
|
+
|
38
|
+
== 1.2.7
|
39
|
+
|
40
|
+
* Fixed the stty indent bug.
|
41
|
+
* Fixed the echo backspace bug.
|
42
|
+
* Added HighLine::track_eof=() setting to work are threaded eof?() calls.
|
43
|
+
|
44
|
+
== 1.2.6
|
45
|
+
|
46
|
+
Patch by Jeremy Hinegardner:
|
47
|
+
|
48
|
+
* Added ColorScheme support.
|
49
|
+
* Added HighLine::Question.overwrite mode.
|
50
|
+
* Various documentation fixes.
|
51
|
+
|
52
|
+
== 1.2.5
|
53
|
+
|
54
|
+
* Really fixed the bug I tried to fix in 1.2.4.
|
55
|
+
|
56
|
+
== 1.2.4
|
57
|
+
|
58
|
+
* Fixed a crash causing bug when using menus, reported by Patrick Hof.
|
59
|
+
|
60
|
+
== 1.2.3
|
61
|
+
|
62
|
+
* Treat Cygwin like a Posix OS, instead of a native Windows environment.
|
63
|
+
|
64
|
+
== 1.2.2
|
65
|
+
|
66
|
+
* Minor documentation corrections.
|
67
|
+
* Applied Thomas Werschleiln's patch to fix termio buffering on Solaris.
|
68
|
+
* Applied Justin Bailey's patch to allow canceling paged output.
|
69
|
+
* Fixed a documentation bug in the description of character case settings.
|
70
|
+
* Added a notice about termios in HighLine::Question#echo.
|
71
|
+
* Finally working around the infamous "fast typing" bug
|
72
|
+
|
73
|
+
== 1.2.1
|
74
|
+
|
75
|
+
* Applied Justin Bailey's fix for the page_print() infinite loop bug.
|
76
|
+
* Made a SystemExtensions module to expose OS level functionality other
|
77
|
+
libraries may want to access.
|
78
|
+
* Publicly exposed the get_character() method, per user requests.
|
79
|
+
* Added terminal_size(), output_cols(), and output_rows() methods.
|
80
|
+
* Added :auto setting for warp_at=() and page_at=().
|
81
|
+
|
82
|
+
== 1.2.0
|
83
|
+
|
84
|
+
* Improved RubyForge and gem spec project descriptions.
|
85
|
+
* Added basic examples to README.
|
86
|
+
* Added a VERSION constant.
|
87
|
+
* Added support for hidden menu commands.
|
88
|
+
* Added Object.or_ask() when using highline/import.
|
89
|
+
|
90
|
+
== 1.0.4
|
91
|
+
|
92
|
+
* Moved the HighLine project to Subversion.
|
93
|
+
* HighLine's color escapes can now be disabled.
|
94
|
+
* Fixed EOF bug introduced in the last release.
|
95
|
+
* Updated HighLine web page.
|
96
|
+
* Moved to a forked development/stable version numbering.
|
97
|
+
|
98
|
+
== 1.0.2
|
99
|
+
|
100
|
+
* Removed old and broken help tests.
|
101
|
+
* Fixed test case typo found by David A. Black.
|
102
|
+
* Added ERb escapes processing to lists, for coloring list items. Color escapes
|
103
|
+
do not add to list element size.
|
104
|
+
* HighLine now throws EOFError when input is exhausted.
|
105
|
+
|
106
|
+
== 1.0.1
|
107
|
+
|
108
|
+
* Minor bug fix: Moved help initialization to before response building, so help
|
109
|
+
would show up in the default responses.
|
110
|
+
|
111
|
+
== 1.0.0
|
112
|
+
|
113
|
+
* Fixed documentation typo pointed out by Gavin Kistner.
|
114
|
+
* Added <tt>gather = ...</tt> option to question for fetching entire Arrays or
|
115
|
+
Hashes filled with answers. You can set +gather+ to a count of answers to
|
116
|
+
collect, a String or Regexp matching the end of input, or a Hash where each
|
117
|
+
key can be used in a new question.
|
118
|
+
* Added File support to HighLine.ask(). You can specify a _directory_ and a
|
119
|
+
_glob_ pattern that combine into a list of file choices the user can select
|
120
|
+
from. You can choose to receive the user's answer as an open filehandle or as
|
121
|
+
a Pathname object.
|
122
|
+
* Added Readline support for history and editing.
|
123
|
+
* Added tab completion for menu and file selection selection (requires
|
124
|
+
Readline).
|
125
|
+
* Added an optional character limit for input.
|
126
|
+
* Added a complete help system to HighLine's shell menu creation tools.
|
127
|
+
|
128
|
+
== 0.6.1
|
129
|
+
|
130
|
+
* Removed termios dependancy in gem, to fix Windows' install.
|
131
|
+
|
132
|
+
== 0.6.0
|
133
|
+
|
134
|
+
* Implemented HighLine.choose() for menu handling.
|
135
|
+
* Provided shortcut <tt>choose(item1, item2, ...)</tt> for simple menus.
|
136
|
+
* Allowed Ruby code to be attached to each menu item, to create a complete
|
137
|
+
menu solution.
|
138
|
+
* Provided for total customization of the menu layout.
|
139
|
+
* Allowed for menu selection by index, name or both.
|
140
|
+
* Added a _shell_ mode to allow menu selection with additional details
|
141
|
+
following the name.
|
142
|
+
* Added a list() utility method that can be invoked just like color(). It can
|
143
|
+
layout Arrays for you in any output in the modes <tt>:columns_across</tt>,
|
144
|
+
<tt>:columns_down</tt>, <tt>:inline</tt> and <tt>:rows</tt>
|
145
|
+
* Added support for <tt>echo = "*"</tt> style settings. User code can now
|
146
|
+
choose the echo character this way.
|
147
|
+
* Modified HighLine to user the "termios" library for character input, if
|
148
|
+
available. Will return to old behavior (using "stty"), if "termios" cannot be
|
149
|
+
loaded.
|
150
|
+
* Improved "stty" state restoring code.
|
151
|
+
* Fixed "stty" code to handle interrupt signals.
|
152
|
+
* Improved the default auto-complete error message and exposed this message
|
153
|
+
through the +responses+ interface as <tt>:no_completion</tt>.
|
154
|
+
|
155
|
+
== 0.5.0
|
156
|
+
|
157
|
+
* Implemented <tt>echo = false</tt> for HighLine::Question objects, primarily to
|
158
|
+
make fetching passwords trivial.
|
159
|
+
* Fixed an auto-complete bug that could cause a crash when the user gave an
|
160
|
+
answer that didn't complete to any valid choice.
|
161
|
+
* Implemented +case+ for HighLine::Question objects to provide character case
|
162
|
+
conversions on given answers. Can be set to <tt>:up</tt>, <tt>:down</tt>, or
|
163
|
+
<tt>:capitalize</tt>.
|
164
|
+
* Exposed <tt>@answer</tt> to the response system, to allow response that are
|
165
|
+
aware of incorrect input.
|
166
|
+
* Implemented +confirm+ for HighLine::Question objects to allow for verification
|
167
|
+
for sensitive user choices. If set to +true+, user will have to answer an
|
168
|
+
"Are you sure? " question. Can also be set to the question to confirm with
|
169
|
+
the user.
|
170
|
+
|
171
|
+
== 0.4.0
|
172
|
+
|
173
|
+
* Added <tt>@wrap_at</tt> and <tt>@page_at</tt> settings and accessors to
|
174
|
+
HighLine, to control text flow.
|
175
|
+
* Implemented line wrapping with adjustable limit.
|
176
|
+
* Implemented paged printing with adjustable limit.
|
177
|
+
|
178
|
+
== 0.3.0
|
179
|
+
|
180
|
+
* Added support for installing with setup.rb.
|
181
|
+
* All output is now treated as an ERb sequence, allowing Ruby code to be
|
182
|
+
embedded in output strings.
|
183
|
+
* Added support for ANSI color sequences in say(). (And everything else
|
184
|
+
by extension.)
|
185
|
+
* Added whitespace handling for answers. Can be set to <tt>:strip</tt>,
|
186
|
+
<tt>:chomp</tt>, <tt>:collapse</tt>, <tt>:strip_and_collapse</tt>,
|
187
|
+
<tt>:chomp_and_collapse</tt>, <tt>:remove</tt>, or <tt>:none</tt>.
|
188
|
+
* Exposed question details to ERb completion through @question, to allow for
|
189
|
+
intelligent responses.
|
190
|
+
* Simplified HighLine internals using @question.
|
191
|
+
* Added support for fetching single character input either with getc() or
|
192
|
+
HighLine's own cross-platform terminal input routine.
|
193
|
+
* Improved type conversion to handle user defined classes.
|
194
|
+
|
195
|
+
== 0.2.0
|
196
|
+
|
197
|
+
* Added Unit Tests to cover an already fixed output bug in the future.
|
198
|
+
* Added Rakefile and setup test action (default).
|
199
|
+
* Renamed HighLine::Answer to HighLine::Question to better illustrate its role.
|
200
|
+
* Renamed fetch_line() to get_response() to better define its goal.
|
201
|
+
* Simplified explain_error in terms of the Question object.
|
202
|
+
* Renamed accept?() to in_range?() to better define purpose.
|
203
|
+
* Reworked valid?() into valid_answer?() to better fit Question object.
|
204
|
+
* Reworked <tt>@member</tt> into <tt>@in</tt>, to make it easier to remember and
|
205
|
+
switched implementation to include?().
|
206
|
+
* Added range checks for @above and @below.
|
207
|
+
* Fixed the bug causing ask() to swallow NoMethodErrors.
|
208
|
+
* Rolled ask_on_error() into responses.
|
209
|
+
* Redirected imports to Kernel from Object.
|
210
|
+
* Added support for <tt>validate = lambda { ... }</tt>.
|
211
|
+
* Added default answer support.
|
212
|
+
* Fixed bug that caused ask() to die with an empty question.
|
213
|
+
* Added complete documentation.
|
214
|
+
* Improve the implemetation of agree() to be the intended "yes" or "no" only
|
215
|
+
question.
|
216
|
+
* Added Rake tasks for documentation and packaging.
|
217
|
+
* Moved project to RubyForge.
|
218
|
+
|
219
|
+
== 0.1.0
|
220
|
+
|
221
|
+
* Initial release as the solution to
|
222
|
+
{Ruby Quiz #29}[http://www.rubyquiz.com/quiz29.html].
|
@@ -0,0 +1,35 @@
|
|
1
|
+
= Installing HighLine
|
2
|
+
|
3
|
+
RubyGems is the preferred easy install method for HighLine. However, you can
|
4
|
+
install HighLine manually as described below.
|
5
|
+
|
6
|
+
== Installing the Gem
|
7
|
+
|
8
|
+
HighLine is intended to be installed via the
|
9
|
+
RubyGems[http://rubyforge.org/projects/rubygems/] system. To get the latest
|
10
|
+
version, simply enter the following into your command prompt:
|
11
|
+
|
12
|
+
$ sudo gem install highline
|
13
|
+
|
14
|
+
You must have RubyGems[http://rubyforge.org/projects/rubygems/] installed for
|
15
|
+
the above to work.
|
16
|
+
|
17
|
+
== Installing Manually
|
18
|
+
|
19
|
+
Download the latest version of HighLine from the
|
20
|
+
{RubyForge project page}[http://rubyforge.org/frs/?group_id=683]. Navigate to
|
21
|
+
the root project directory and enter:
|
22
|
+
|
23
|
+
$ sudo ruby setup.rb
|
24
|
+
|
25
|
+
== Using termios
|
26
|
+
|
27
|
+
While not a requirement, HighLine will take advantage of the termios library if
|
28
|
+
installed (on Unix). This slightly improves HighLine's character reading
|
29
|
+
capabilities and thus is recommended for all Unix users.
|
30
|
+
|
31
|
+
If using the HighLine gem, you should be able to add termios as easily as:
|
32
|
+
|
33
|
+
$ sudo gem install termios
|
34
|
+
|
35
|
+
For manual installs, consult the termios documentation.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
= License Terms
|
2
|
+
|
3
|
+
Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the
|
4
|
+
{Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by
|
5
|
+
James Edward Gray II and Greg Brown.
|
6
|
+
|
7
|
+
Please email James[mailto:james@grayproductions.net] with any questions.
|
@@ -0,0 +1,63 @@
|
|
1
|
+
= Read Me
|
2
|
+
|
3
|
+
by James Edward Gray II
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Welcome to HighLine.
|
8
|
+
|
9
|
+
HighLine was designed to ease the tedious tasks of doing console input and
|
10
|
+
output with low-level methods like gets() and puts(). HighLine provides a
|
11
|
+
robust system for requesting data from a user, without needing to code all the
|
12
|
+
error checking and validation rules and without needing to convert the typed
|
13
|
+
Strings into what your program really needs. Just tell HighLine what you're
|
14
|
+
after, and let it do all the work.
|
15
|
+
|
16
|
+
== Documentation
|
17
|
+
|
18
|
+
See HighLine and HighLine::Question for documentation.
|
19
|
+
|
20
|
+
== Examples
|
21
|
+
|
22
|
+
Basic usage:
|
23
|
+
|
24
|
+
ask("Company? ") { |q| q.default = "none" }
|
25
|
+
|
26
|
+
Validation:
|
27
|
+
|
28
|
+
ask("Age? ", Integer) { |q| q.in = 0..105 }
|
29
|
+
ask("Name? (last, first) ") { |q| q.validate = /\A\w+, ?\w+\Z/ }
|
30
|
+
|
31
|
+
Type conversion for answers:
|
32
|
+
|
33
|
+
ask("Birthday? ", Date)
|
34
|
+
ask("Interests? (comma sep list) ", lambda { |str| str.split(/,\s*/) })
|
35
|
+
|
36
|
+
Reading passwords:
|
37
|
+
|
38
|
+
ask("Enter your password: ") { |q| q.echo = false }
|
39
|
+
ask("Enter your password: ") { |q| q.echo = "x" }
|
40
|
+
|
41
|
+
ERb based output (with HighLine's ANSI color tools):
|
42
|
+
|
43
|
+
say("This should be <%= color('bold', BOLD) %>!")
|
44
|
+
|
45
|
+
Menus:
|
46
|
+
|
47
|
+
choose do |menu|
|
48
|
+
menu.prompt = "Please choose your favorite programming language? "
|
49
|
+
|
50
|
+
menu.choice(:ruby) { say("Good choice!") }
|
51
|
+
menu.choices(:python, :perl) { say("Not from around here, are you?") }
|
52
|
+
end
|
53
|
+
|
54
|
+
For more examples see the examples/ directory of this project.
|
55
|
+
|
56
|
+
== Installing
|
57
|
+
|
58
|
+
See the INSTALL file for instructions.
|
59
|
+
|
60
|
+
== Questions and/or Comments
|
61
|
+
|
62
|
+
Feel free to email {James Edward Gray II}[mailto:james@grayproductions.net] or
|
63
|
+
{Gregory Brown}[mailto:gregory.t.brown@gmail.com] with any questions.
|