rudy 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/CHANGES.txt +54 -30
  2. data/README.rdoc +100 -12
  3. data/Rakefile +103 -8
  4. data/Rudyfile +119 -0
  5. data/bin/ird +175 -0
  6. data/bin/rudy +259 -156
  7. data/bin/rudy-ec2 +228 -95
  8. data/bin/rudy-s3 +76 -0
  9. data/bin/rudy-sdb +67 -0
  10. data/lib/annoy.rb +270 -0
  11. data/lib/console.rb +30 -9
  12. data/lib/escape.rb +305 -0
  13. data/lib/rudy.rb +151 -182
  14. data/lib/rudy/aws.rb +56 -49
  15. data/lib/rudy/aws/ec2.rb +47 -292
  16. data/lib/rudy/aws/ec2/address.rb +157 -0
  17. data/lib/rudy/aws/ec2/group.rb +301 -0
  18. data/lib/rudy/aws/ec2/image.rb +168 -0
  19. data/lib/rudy/aws/ec2/instance.rb +434 -0
  20. data/lib/rudy/aws/ec2/keypair.rb +104 -0
  21. data/lib/rudy/aws/ec2/snapshot.rb +98 -0
  22. data/lib/rudy/aws/ec2/volume.rb +230 -0
  23. data/lib/rudy/aws/ec2/zone.rb +77 -0
  24. data/lib/rudy/aws/s3.rb +54 -0
  25. data/lib/rudy/aws/sdb.rb +298 -0
  26. data/lib/rudy/aws/sdb/error.rb +46 -0
  27. data/lib/rudy/{metadata/backup.rb → backup.rb} +26 -51
  28. data/lib/rudy/cli.rb +157 -0
  29. data/lib/rudy/cli/aws/ec2/addresses.rb +105 -0
  30. data/lib/rudy/cli/aws/ec2/candy.rb +208 -0
  31. data/lib/rudy/cli/aws/ec2/groups.rb +121 -0
  32. data/lib/rudy/cli/aws/ec2/images.rb +196 -0
  33. data/lib/rudy/cli/aws/ec2/instances.rb +194 -0
  34. data/lib/rudy/cli/aws/ec2/keypairs.rb +53 -0
  35. data/lib/rudy/cli/aws/ec2/snapshots.rb +49 -0
  36. data/lib/rudy/cli/aws/ec2/volumes.rb +104 -0
  37. data/lib/rudy/cli/aws/ec2/zones.rb +22 -0
  38. data/lib/rudy/cli/aws/s3/buckets.rb +50 -0
  39. data/lib/rudy/cli/aws/s3/store.rb +22 -0
  40. data/lib/rudy/cli/aws/sdb/domains.rb +41 -0
  41. data/lib/rudy/cli/candy.rb +8 -0
  42. data/lib/rudy/{command → cli}/config.rb +34 -24
  43. data/lib/rudy/cli/disks.rb +35 -0
  44. data/lib/rudy/cli/machines.rb +94 -0
  45. data/lib/rudy/cli/routines.rb +57 -0
  46. data/lib/rudy/config.rb +77 -72
  47. data/lib/rudy/config/objects.rb +29 -0
  48. data/lib/rudy/disks.rb +248 -0
  49. data/lib/rudy/global.rb +121 -0
  50. data/lib/rudy/huxtable.rb +340 -0
  51. data/lib/rudy/machines.rb +245 -0
  52. data/lib/rudy/metadata.rb +123 -13
  53. data/lib/rudy/routines.rb +47 -0
  54. data/lib/rudy/routines/helpers/diskhelper.rb +101 -0
  55. data/lib/rudy/routines/helpers/scripthelper.rb +91 -0
  56. data/lib/rudy/routines/release.rb +34 -0
  57. data/lib/rudy/routines/shutdown.rb +57 -0
  58. data/lib/rudy/routines/startup.rb +58 -0
  59. data/lib/rudy/scm/svn.rb +1 -1
  60. data/lib/rudy/utils.rb +322 -4
  61. data/lib/storable.rb +26 -17
  62. data/lib/sysinfo.rb +274 -0
  63. data/lib/tryouts.rb +6 -13
  64. data/rudy.gemspec +128 -42
  65. data/support/randomize-root-password +45 -0
  66. data/support/rudy-ec2-startup +9 -9
  67. data/support/update-ec2-ami-tools +20 -0
  68. data/test/05_config/00_setup_test.rb +20 -0
  69. data/test/05_config/30_machines_test.rb +69 -0
  70. data/test/20_sdb/00_setup_test.rb +16 -0
  71. data/test/20_sdb/10_domains_test.rb +115 -0
  72. data/test/25_ec2/00_setup_test.rb +29 -0
  73. data/test/25_ec2/10_keypairs_test.rb +41 -0
  74. data/test/25_ec2/20_groups_test.rb +131 -0
  75. data/test/25_ec2/30_addresses_test.rb +38 -0
  76. data/test/25_ec2/40_volumes_test.rb +49 -0
  77. data/test/25_ec2/50_snapshots_test.rb +74 -0
  78. data/test/26_ec2_instances/00_setup_test.rb +28 -0
  79. data/test/26_ec2_instances/10_instances_test.rb +83 -0
  80. data/test/26_ec2_instances/50_images_test.rb +13 -0
  81. data/test/30_sdb_metadata/00_setup_test.rb +21 -0
  82. data/test/30_sdb_metadata/10_disks_test.rb +109 -0
  83. data/test/30_sdb_metadata/20_backups_test.rb +102 -0
  84. data/test/coverage.txt +51 -0
  85. data/test/helper.rb +36 -0
  86. data/vendor/highline-1.5.1/CHANGELOG +222 -0
  87. data/vendor/highline-1.5.1/INSTALL +35 -0
  88. data/vendor/highline-1.5.1/LICENSE +7 -0
  89. data/vendor/highline-1.5.1/README +63 -0
  90. data/vendor/highline-1.5.1/Rakefile +82 -0
  91. data/vendor/highline-1.5.1/TODO +6 -0
  92. data/vendor/highline-1.5.1/examples/ansi_colors.rb +38 -0
  93. data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +18 -0
  94. data/vendor/highline-1.5.1/examples/basic_usage.rb +75 -0
  95. data/vendor/highline-1.5.1/examples/color_scheme.rb +32 -0
  96. data/vendor/highline-1.5.1/examples/limit.rb +12 -0
  97. data/vendor/highline-1.5.1/examples/menus.rb +65 -0
  98. data/vendor/highline-1.5.1/examples/overwrite.rb +19 -0
  99. data/vendor/highline-1.5.1/examples/page_and_wrap.rb +322 -0
  100. data/vendor/highline-1.5.1/examples/password.rb +7 -0
  101. data/vendor/highline-1.5.1/examples/trapping_eof.rb +22 -0
  102. data/vendor/highline-1.5.1/examples/using_readline.rb +17 -0
  103. data/vendor/highline-1.5.1/lib/highline.rb +758 -0
  104. data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +120 -0
  105. data/vendor/highline-1.5.1/lib/highline/compatibility.rb +17 -0
  106. data/vendor/highline-1.5.1/lib/highline/import.rb +43 -0
  107. data/vendor/highline-1.5.1/lib/highline/menu.rb +395 -0
  108. data/vendor/highline-1.5.1/lib/highline/question.rb +463 -0
  109. data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +193 -0
  110. data/vendor/highline-1.5.1/setup.rb +1360 -0
  111. data/vendor/highline-1.5.1/test/tc_color_scheme.rb +56 -0
  112. data/vendor/highline-1.5.1/test/tc_highline.rb +823 -0
  113. data/vendor/highline-1.5.1/test/tc_import.rb +54 -0
  114. data/vendor/highline-1.5.1/test/tc_menu.rb +429 -0
  115. data/vendor/highline-1.5.1/test/ts_all.rb +15 -0
  116. metadata +141 -38
  117. data/lib/aws_sdb.rb +0 -3
  118. data/lib/aws_sdb/error.rb +0 -42
  119. data/lib/aws_sdb/service.rb +0 -215
  120. data/lib/rudy/aws/simpledb.rb +0 -53
  121. data/lib/rudy/command/addresses.rb +0 -46
  122. data/lib/rudy/command/backups.rb +0 -175
  123. data/lib/rudy/command/base.rb +0 -841
  124. data/lib/rudy/command/deploy.rb +0 -12
  125. data/lib/rudy/command/disks.rb +0 -213
  126. data/lib/rudy/command/environment.rb +0 -73
  127. data/lib/rudy/command/groups.rb +0 -61
  128. data/lib/rudy/command/images.rb +0 -91
  129. data/lib/rudy/command/instances.rb +0 -85
  130. data/lib/rudy/command/machines.rb +0 -161
  131. data/lib/rudy/command/metadata.rb +0 -41
  132. data/lib/rudy/command/release.rb +0 -174
  133. data/lib/rudy/command/volumes.rb +0 -66
  134. data/lib/rudy/metadata/disk.rb +0 -138
  135. data/tryouts/console_tryout.rb +0 -91
@@ -0,0 +1,51 @@
1
+ Finished in 134.699353 seconds.
2
+
3
+ 81 tests, 200 assertions, 0 failures, 0 errors
4
+ +----------------------------------------------------+-------+-------+--------+
5
+ | File | Lines | LOC | COV |
6
+ +----------------------------------------------------+-------+-------+--------+
7
+ |lib/annoy.rb | 227 | 131 | 42.0% |
8
+ |lib/aws_sdb.rb | 3 | 2 | 100.0% |
9
+ |lib/aws_sdb/error.rb | 42 | 33 | 66.7% |
10
+ |lib/aws_sdb/service.rb | 215 | 192 | 96.4% |
11
+ |lib/console.rb | 401 | 263 | 35.7% |
12
+ |lib/rudy.rb | 275 | 186 | 57.5% |
13
+ |lib/rudy/addresses.rb | 22 | 14 | 57.1% |
14
+ |lib/rudy/aws.rb | 72 | 47 | 91.5% |
15
+ |lib/rudy/aws/ec2.rb | 28 | 23 | 100.0% |
16
+ |lib/rudy/aws/ec2/address.rb | 111 | 80 | 87.5% |
17
+ |lib/rudy/aws/ec2/group.rb | 237 | 150 | 86.7% |
18
+ |lib/rudy/aws/ec2/image.rb | 46 | 33 | 21.2% |
19
+ |lib/rudy/aws/ec2/instance.rb | 283 | 180 | 71.1% |
20
+ |lib/rudy/aws/ec2/keypair.rb | 90 | 71 | 93.0% |
21
+ |lib/rudy/aws/ec2/snapshot.rb | 87 | 63 | 87.3% |
22
+ |lib/rudy/aws/ec2/volume.rb | 184 | 127 | 60.6% |
23
+ |lib/rudy/aws/s3.rb | 3 | 2 | 100.0% |
24
+ |lib/rudy/aws/simpledb.rb | 71 | 54 | 100.0% |
25
+ |lib/rudy/backups.rb | 10 | 5 | 100.0% |
26
+ |lib/rudy/config.rb | 113 | 72 | 91.7% |
27
+ |lib/rudy/disks.rb | 9 | 5 | 100.0% |
28
+ |lib/rudy/groups.rb | 113 | 80 | 82.5% |
29
+ |lib/rudy/huxtable.rb | 212 | 152 | 54.6% |
30
+ |lib/rudy/keypairs.rb | 100 | 78 | 100.0% |
31
+ |lib/rudy/machines.rb | 193 | 142 | 9.2% |
32
+ |lib/rudy/manager.rb | 62 | 43 | 16.3% |
33
+ |lib/rudy/metadata/backup.rb | 135 | 100 | 73.0% |
34
+ |lib/rudy/metadata/disk.rb | 149 | 117 | 47.0% |
35
+ |lib/rudy/metadata/machine.rb | 34 | 23 | 82.6% |
36
+ |lib/rudy/routines.rb | 54 | 26 | 23.1% |
37
+ |lib/rudy/routines/disk_handler.rb | 190 | 133 | 5.3% |
38
+ |lib/rudy/routines/release.rb | 15 | 8 | 100.0% |
39
+ |lib/rudy/routines/script_runner.rb | 65 | 47 | 10.6% |
40
+ |lib/rudy/routines/shutdown.rb | 42 | 30 | 13.3% |
41
+ |lib/rudy/routines/startup.rb | 48 | 33 | 12.1% |
42
+ |lib/rudy/scm/svn.rb | 68 | 50 | 26.0% |
43
+ |lib/rudy/utils.rb | 118 | 75 | 54.7% |
44
+ |lib/rudy/volumes.rb | 108 | 84 | 11.9% |
45
+ |lib/storable.rb | 284 | 185 | 43.8% |
46
+ |lib/sysinfo.rb | 255 | 154 | 35.7% |
47
+ |lib/utils/crypto-key.rb | 93 | 36 | 55.6% |
48
+ +----------------------------------------------------+-------+-------+--------+
49
+ |Total | 4867 | 3329 | 55.6% |
50
+ +----------------------------------------------------+-------+-------+--------+
51
+ 55.6% 41 file(s) 4867 Lines 3329 LOC
@@ -0,0 +1,36 @@
1
+
2
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
3
+ $:.unshift libdir
4
+ %w{amazon-ec2 drydock caesars rye}.each { |dir| $: << File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
5
+
6
+ require 'rubygems'
7
+ require 'test/unit'
8
+ require 'shoulda'
9
+
10
+ require 'rudy'
11
+
12
+
13
+ puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}")
14
+
15
+ # +should_stop+ should the test be stopped?
16
+ # +str+ The message to print when +should_stop+ is true
17
+ def stop_test(should_stop, str)
18
+ return unless should_stop
19
+ str ||= "Test stopped for unknown reason"
20
+ abort str.color(:red).bright
21
+ end
22
+ def xstop_test(*args, &ignore)
23
+ #puts %Q(Skipping stop_test: %s "%s") % [args.last.color(:blue), args.first.color(:blue).bright]
24
+ end
25
+
26
+ def skip(msg)
27
+ puts "%s (%s)" % ["SKIP".color(:blue).bright, msg]
28
+ :skip # this doesn't do anything, but I would like it to!
29
+ end
30
+
31
+ def xshould(*args, &ignore)
32
+ puts %Q(Skipping test: %s "%s") % [@name.color(:blue), args.first.color(:blue).bright]
33
+ end
34
+ def xcontext(*args, &ignore)
35
+ puts %q(Skipping context: "%s") % (@name || args.first).color(:blue).bright
36
+ end
@@ -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.
@@ -0,0 +1,82 @@
1
+ require "rake/rdoctask"
2
+ require "rake/testtask"
3
+ require "rake/gempackagetask"
4
+
5
+ require "rubygems"
6
+
7
+ dir = File.dirname(__FILE__)
8
+ lib = File.join(dir, "lib", "highline.rb")
9
+ version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
10
+
11
+ task :default => [:test]
12
+
13
+ Rake::TestTask.new do |test|
14
+ test.libs << "test"
15
+ test.test_files = [ "test/ts_all.rb" ]
16
+ test.verbose = true
17
+ end
18
+
19
+ Rake::RDocTask.new do |rdoc|
20
+ rdoc.rdoc_files.include( "README", "INSTALL",
21
+ "TODO", "CHANGELOG",
22
+ "AUTHORS", "COPYING",
23
+ "LICENSE", "lib/" )
24
+ rdoc.main = "README"
25
+ rdoc.rdoc_dir = "doc/html"
26
+ rdoc.title = "HighLine Documentation"
27
+ end
28
+
29
+ desc "Upload current documentation to Rubyforge"
30
+ task :upload_docs => [:rdoc] do
31
+ sh "scp -r doc/html/* " +
32
+ "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/doc/"
33
+ sh "scp -r site/* " +
34
+ "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/"
35
+ end
36
+
37
+ spec = Gem::Specification.new do |spec|
38
+ spec.name = "highline"
39
+ spec.version = version
40
+ spec.platform = Gem::Platform::RUBY
41
+ spec.summary = "HighLine is a high-level command-line IO library."
42
+ spec.files = Dir.glob("{examples,lib,test}/**/*.rb").
43
+ delete_if { |item| item.include?("CVS") } +
44
+ ["Rakefile", "setup.rb"]
45
+
46
+ spec.test_files = "test/ts_all.rb"
47
+ spec.has_rdoc = true
48
+ spec.extra_rdoc_files = %w{README INSTALL TODO CHANGELOG LICENSE}
49
+ spec.rdoc_options << '--title' << 'HighLine Documentation' <<
50
+ '--main' << 'README'
51
+
52
+ spec.require_path = 'lib'
53
+
54
+ spec.author = "James Edward Gray II"
55
+ spec.email = "james@grayproductions.net"
56
+ spec.rubyforge_project = "highline"
57
+ spec.homepage = "http://highline.rubyforge.org"
58
+ spec.description = <<END_DESC
59
+ A high-level IO library that provides validation, type conversion, and more for
60
+ command-line interfaces. HighLine also includes a complete menu system that can
61
+ crank out anything from simple list selection to complete shells with just
62
+ minutes of work.
63
+ END_DESC
64
+ end
65
+
66
+ Rake::GemPackageTask.new(spec) do |pkg|
67
+ pkg.need_zip = true
68
+ pkg.need_tar = true
69
+ end
70
+
71
+ desc "Show library's code statistics"
72
+ task :stats do
73
+ require 'code_statistics'
74
+ CodeStatistics.new( ["HighLine", "lib"],
75
+ ["Functionals", "examples"],
76
+ ["Units", "test"] ).to_s
77
+ end
78
+
79
+ desc "Add new files to Subversion"
80
+ task :add_to_svn do
81
+ sh %Q{svn status | ruby -nae 'system "svn add \#{$F[1]}" if $F[0] == "?"' }
82
+ end