rtt 0.0.0.7 → 0.0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +34 -2
- data/README.rdoc +17 -5
- data/Rakefile +2 -2
- data/USAGE.txt +47 -9
- data/db/rtt.sqlite3 +0 -0
- data/db/rtt2.sqlite3 +0 -0
- data/db/test.sqlite3 +0 -0
- data/lib/rtt.rb +75 -31
- data/lib/rtt/client.rb +17 -0
- data/lib/rtt/{cmd_line_interpreter.rb → cmd_line_parser.rb} +53 -13
- data/lib/rtt/interactive_configurator.rb +162 -0
- data/lib/rtt/project.rb +21 -2
- data/lib/rtt/query_builder.rb +5 -3
- data/lib/rtt/report_generator.rb +70 -50
- data/lib/rtt/storage.rb +1 -1
- data/lib/rtt/task.rb +9 -1
- data/lib/rtt/user.rb +12 -1
- data/rtt.gemspec +10 -7
- data/spec/lib/rtt_spec.rb +5 -5
- data/todo.txt +1 -0
- data/vendor/highline-1.5.2/CHANGELOG +227 -0
- data/vendor/highline-1.5.2/INSTALL +41 -0
- data/vendor/highline-1.5.2/LICENSE +7 -0
- data/vendor/highline-1.5.2/README +63 -0
- data/vendor/highline-1.5.2/Rakefile +82 -0
- data/vendor/highline-1.5.2/TODO +6 -0
- data/vendor/highline-1.5.2/examples/ansi_colors.rb +38 -0
- data/vendor/highline-1.5.2/examples/asking_for_arrays.rb +18 -0
- data/vendor/highline-1.5.2/examples/basic_usage.rb +75 -0
- data/vendor/highline-1.5.2/examples/color_scheme.rb +32 -0
- data/vendor/highline-1.5.2/examples/limit.rb +12 -0
- data/vendor/highline-1.5.2/examples/menus.rb +65 -0
- data/vendor/highline-1.5.2/examples/overwrite.rb +19 -0
- data/vendor/highline-1.5.2/examples/page_and_wrap.rb +322 -0
- data/vendor/highline-1.5.2/examples/password.rb +7 -0
- data/vendor/highline-1.5.2/examples/trapping_eof.rb +22 -0
- data/vendor/highline-1.5.2/examples/using_readline.rb +17 -0
- data/vendor/highline-1.5.2/lib/highline.rb +758 -0
- data/vendor/highline-1.5.2/lib/highline/color_scheme.rb +120 -0
- data/vendor/highline-1.5.2/lib/highline/compatibility.rb +17 -0
- data/vendor/highline-1.5.2/lib/highline/import.rb +43 -0
- data/vendor/highline-1.5.2/lib/highline/menu.rb +395 -0
- data/vendor/highline-1.5.2/lib/highline/question.rb +463 -0
- data/vendor/highline-1.5.2/lib/highline/system_extensions.rb +240 -0
- data/vendor/highline-1.5.2/setup.rb +1360 -0
- data/vendor/highline-1.5.2/test/tc_color_scheme.rb +56 -0
- data/vendor/highline-1.5.2/test/tc_highline.rb +823 -0
- data/vendor/highline-1.5.2/test/tc_import.rb +54 -0
- data/vendor/highline-1.5.2/test/tc_menu.rb +429 -0
- data/vendor/highline-1.5.2/test/ts_all.rb +15 -0
- metadata +65 -15
- data/lib/rtt/user_configurator.rb +0 -24
data/lib/rtt/user.rb
CHANGED
@@ -4,7 +4,7 @@ module Rtt
|
|
4
4
|
include DataMapper::Resource
|
5
5
|
|
6
6
|
BLANK_FIELD = ''
|
7
|
-
DEFAULT_NICK = '
|
7
|
+
DEFAULT_NICK = 'Default user'
|
8
8
|
|
9
9
|
property :id, Serial
|
10
10
|
property :nickname, String, :required => true, :unique => true, :default => DEFAULT_NICK
|
@@ -27,6 +27,17 @@ module Rtt
|
|
27
27
|
first_or_create :active => true
|
28
28
|
end
|
29
29
|
|
30
|
+
def self.find_or_create_active
|
31
|
+
last_user = User.last
|
32
|
+
if last_user.present?
|
33
|
+
last_user.active = true
|
34
|
+
last_user.save
|
35
|
+
last_user
|
36
|
+
else
|
37
|
+
self.default
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
30
41
|
def activate
|
31
42
|
self.active = true
|
32
43
|
self.save
|
data/rtt.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rtt}
|
5
|
-
s.version = "0.0.0.
|
5
|
+
s.version = "0.0.0.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Marcelo Giorgi"]
|
9
|
-
s.date = %q{2010-06-
|
9
|
+
s.date = %q{2010-06-27}
|
10
10
|
s.default_executable = %q{rtt}
|
11
11
|
s.description = %q{RTT is a tool for tracking time}
|
12
12
|
s.email = %q{marklazz.uy@gmail.com}
|
13
13
|
s.executables = ["rtt"]
|
14
|
-
s.extra_rdoc_files = ["LICENSE", "README.rdoc", "bin/rtt", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/
|
15
|
-
s.files = ["LICENSE", "Manifest", "README.rdoc", "Rakefile", "USAGE.txt", "bin/rtt", "db/rtt.sqlite3", "db/test.sqlite3", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/
|
14
|
+
s.extra_rdoc_files = ["LICENSE", "README.rdoc", "bin/rtt", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/cmd_line_parser.rb", "lib/rtt/hash_extensions.rb", "lib/rtt/interactive_configurator.rb", "lib/rtt/project.rb", "lib/rtt/query_builder.rb", "lib/rtt/report_generator.rb", "lib/rtt/storage.rb", "lib/rtt/task.rb", "lib/rtt/user.rb", "tasks/rtt.rake"]
|
15
|
+
s.files = ["LICENSE", "Manifest", "README.rdoc", "Rakefile", "USAGE.txt", "bin/rtt", "db/rtt.sqlite3", "db/rtt2.sqlite3", "db/test.sqlite3", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/cmd_line_parser.rb", "lib/rtt/hash_extensions.rb", "lib/rtt/interactive_configurator.rb", "lib/rtt/project.rb", "lib/rtt/query_builder.rb", "lib/rtt/report_generator.rb", "lib/rtt/storage.rb", "lib/rtt/task.rb", "lib/rtt/user.rb", "log/rtt.sqlite3", "rtt.gemspec", "spec/datamapper_spec_helper.rb", "spec/lib/rtt/task_spec.rb", "spec/lib/rtt_spec.rb", "tasks/rtt.rake", "todo.txt", "vendor/highline-1.5.2/CHANGELOG", "vendor/highline-1.5.2/INSTALL", "vendor/highline-1.5.2/LICENSE", "vendor/highline-1.5.2/README", "vendor/highline-1.5.2/Rakefile", "vendor/highline-1.5.2/TODO", "vendor/highline-1.5.2/examples/ansi_colors.rb", "vendor/highline-1.5.2/examples/asking_for_arrays.rb", "vendor/highline-1.5.2/examples/basic_usage.rb", "vendor/highline-1.5.2/examples/color_scheme.rb", "vendor/highline-1.5.2/examples/limit.rb", "vendor/highline-1.5.2/examples/menus.rb", "vendor/highline-1.5.2/examples/overwrite.rb", "vendor/highline-1.5.2/examples/page_and_wrap.rb", "vendor/highline-1.5.2/examples/password.rb", "vendor/highline-1.5.2/examples/trapping_eof.rb", "vendor/highline-1.5.2/examples/using_readline.rb", "vendor/highline-1.5.2/lib/highline.rb", "vendor/highline-1.5.2/lib/highline/color_scheme.rb", "vendor/highline-1.5.2/lib/highline/compatibility.rb", "vendor/highline-1.5.2/lib/highline/import.rb", "vendor/highline-1.5.2/lib/highline/menu.rb", "vendor/highline-1.5.2/lib/highline/question.rb", "vendor/highline-1.5.2/lib/highline/system_extensions.rb", "vendor/highline-1.5.2/setup.rb", "vendor/highline-1.5.2/test/tc_color_scheme.rb", "vendor/highline-1.5.2/test/tc_highline.rb", "vendor/highline-1.5.2/test/tc_import.rb", "vendor/highline-1.5.2/test/tc_menu.rb", "vendor/highline-1.5.2/test/ts_all.rb"]
|
16
16
|
s.homepage = %q{http://github.com/marklazz/rtt}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rtt", "--main", "README.rdoc"]
|
18
18
|
s.require_paths = ["lib"]
|
@@ -28,14 +28,16 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_runtime_dependency(%q<highline>, [">= 1.5.2"])
|
29
29
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.0"])
|
30
30
|
s.add_runtime_dependency(%q<prawn>, [">= 0.8.0"])
|
31
|
-
s.add_runtime_dependency(%q<
|
31
|
+
s.add_runtime_dependency(%q<dm-core>, [">= 1.0.0"])
|
32
|
+
s.add_runtime_dependency(%q<dm-migrations>, [">= 1.0.0"])
|
32
33
|
s.add_runtime_dependency(%q<dm-sqlite-adapter>, [">= 0"])
|
33
34
|
s.add_development_dependency(%q<spec>, [">= 0"])
|
34
35
|
else
|
35
36
|
s.add_dependency(%q<highline>, [">= 1.5.2"])
|
36
37
|
s.add_dependency(%q<activesupport>, [">= 2.3.0"])
|
37
38
|
s.add_dependency(%q<prawn>, [">= 0.8.0"])
|
38
|
-
s.add_dependency(%q<
|
39
|
+
s.add_dependency(%q<dm-core>, [">= 1.0.0"])
|
40
|
+
s.add_dependency(%q<dm-migrations>, [">= 1.0.0"])
|
39
41
|
s.add_dependency(%q<dm-sqlite-adapter>, [">= 0"])
|
40
42
|
s.add_dependency(%q<spec>, [">= 0"])
|
41
43
|
end
|
@@ -43,7 +45,8 @@ Gem::Specification.new do |s|
|
|
43
45
|
s.add_dependency(%q<highline>, [">= 1.5.2"])
|
44
46
|
s.add_dependency(%q<activesupport>, [">= 2.3.0"])
|
45
47
|
s.add_dependency(%q<prawn>, [">= 0.8.0"])
|
46
|
-
s.add_dependency(%q<
|
48
|
+
s.add_dependency(%q<dm-core>, [">= 1.0.0"])
|
49
|
+
s.add_dependency(%q<dm-migrations>, [">= 1.0.0"])
|
47
50
|
s.add_dependency(%q<dm-sqlite-adapter>, [">= 0"])
|
48
51
|
s.add_dependency(%q<spec>, [">= 0"])
|
49
52
|
end
|
data/spec/lib/rtt_spec.rb
CHANGED
@@ -52,7 +52,7 @@ describe Rtt do
|
|
52
52
|
describe 'when there is a current task' do
|
53
53
|
|
54
54
|
before do
|
55
|
-
@current_task = Rtt::Task.create :name => 'older_task', :start_at => Date.today.beginning_of_day, :active => true
|
55
|
+
@current_task = Rtt::Task.create :name => 'older_task', :start_at => Date.today.beginning_of_day, :active => true, :rate => 100
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should create a new task' do
|
@@ -116,7 +116,7 @@ describe Rtt do
|
|
116
116
|
describe 'when there is a current task' do
|
117
117
|
|
118
118
|
before do
|
119
|
-
Rtt::Task.create :name => 'older_task', :start_at => Date.today.beginning_of_day, :active => true
|
119
|
+
Rtt::Task.create :name => 'older_task', :start_at => Date.today.beginning_of_day, :active => true, :rate => 100
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'should finish the task' do
|
@@ -145,7 +145,7 @@ describe Rtt do
|
|
145
145
|
describe 'When there is a current task' do
|
146
146
|
|
147
147
|
before do
|
148
|
-
@current_task = Rtt::Task.create :name => 'older_task', :start_at => Date.today.beginning_of_day, :active => true
|
148
|
+
@current_task = Rtt::Task.create :name => 'older_task', :start_at => Date.today.beginning_of_day, :active => true, :rate => 100
|
149
149
|
end
|
150
150
|
|
151
151
|
it 'should change the name' do
|
@@ -173,8 +173,8 @@ describe Rtt do
|
|
173
173
|
describe '#report' do
|
174
174
|
|
175
175
|
it 'should call report_for_csv when :pdf is recevied' do
|
176
|
-
Rtt.should_receive(:report_to_pdf).with('/somepath')
|
177
|
-
Rtt.report :pdf => '/somepath'
|
176
|
+
Rtt.should_receive(:report_to_pdf).with('/somepath.pdf')
|
177
|
+
Rtt.report :pdf => '/somepath.pdf'
|
178
178
|
end
|
179
179
|
|
180
180
|
it 'should call report_for_csv when :csv is recevied' do
|
data/todo.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1) Add --configure to current task
|
@@ -0,0 +1,227 @@
|
|
1
|
+
= Change Log
|
2
|
+
|
3
|
+
Below is a complete listing of changes for each revision of HighLine.
|
4
|
+
|
5
|
+
== 1.5.2
|
6
|
+
|
7
|
+
* Added support for using the ffi-ncurses gem which is supported in JRuby.
|
8
|
+
* Added gem build instructions.
|
9
|
+
|
10
|
+
== 1.5.1
|
11
|
+
|
12
|
+
* Fixed the long standing echo true bug.
|
13
|
+
(reported by Lauri Tuominen)
|
14
|
+
* Improved Windows API calls to support the redirection of STDIN.
|
15
|
+
(patch by Aaron Simmons)
|
16
|
+
* Updated gem specification to avoid a deprecated call.
|
17
|
+
* Made a minor documentation clarification about character mode support.
|
18
|
+
* Worked around some API changes in Ruby's standard library in Ruby 1.9.
|
19
|
+
(patch by Jake Benilov)
|
20
|
+
|
21
|
+
== 1.5.0
|
22
|
+
|
23
|
+
* Fixed a bug that would prevent Readline from showing all completions.
|
24
|
+
(reported by Yaohan Chen)
|
25
|
+
* Added the ability to pass a block to HighLine#agree().
|
26
|
+
(patch by Yaohan Chen)
|
27
|
+
|
28
|
+
== 1.4.0
|
29
|
+
|
30
|
+
* Made the code grabbing terminal size a little more cross-platform by
|
31
|
+
adding support for Solaris. (patch by Ronald Braswell and Coey Minear)
|
32
|
+
|
33
|
+
== 1.2.9
|
34
|
+
|
35
|
+
* Additional work on the backspacing issue. (patch by Jeremy Hinegardner)
|
36
|
+
* Fixed Readline prompt bug. (patch by Jeremy Hinegardner)
|
37
|
+
|
38
|
+
== 1.2.8
|
39
|
+
|
40
|
+
* Fixed backspacing past the prompt and interrupting a prompt bugs.
|
41
|
+
(patch by Jeremy Hinegardner)
|
42
|
+
|
43
|
+
== 1.2.7
|
44
|
+
|
45
|
+
* Fixed the stty indent bug.
|
46
|
+
* Fixed the echo backspace bug.
|
47
|
+
* Added HighLine::track_eof=() setting to work are threaded eof?() calls.
|
48
|
+
|
49
|
+
== 1.2.6
|
50
|
+
|
51
|
+
Patch by Jeremy Hinegardner:
|
52
|
+
|
53
|
+
* Added ColorScheme support.
|
54
|
+
* Added HighLine::Question.overwrite mode.
|
55
|
+
* Various documentation fixes.
|
56
|
+
|
57
|
+
== 1.2.5
|
58
|
+
|
59
|
+
* Really fixed the bug I tried to fix in 1.2.4.
|
60
|
+
|
61
|
+
== 1.2.4
|
62
|
+
|
63
|
+
* Fixed a crash causing bug when using menus, reported by Patrick Hof.
|
64
|
+
|
65
|
+
== 1.2.3
|
66
|
+
|
67
|
+
* Treat Cygwin like a Posix OS, instead of a native Windows environment.
|
68
|
+
|
69
|
+
== 1.2.2
|
70
|
+
|
71
|
+
* Minor documentation corrections.
|
72
|
+
* Applied Thomas Werschleiln's patch to fix termio buffering on Solaris.
|
73
|
+
* Applied Justin Bailey's patch to allow canceling paged output.
|
74
|
+
* Fixed a documentation bug in the description of character case settings.
|
75
|
+
* Added a notice about termios in HighLine::Question#echo.
|
76
|
+
* Finally working around the infamous "fast typing" bug
|
77
|
+
|
78
|
+
== 1.2.1
|
79
|
+
|
80
|
+
* Applied Justin Bailey's fix for the page_print() infinite loop bug.
|
81
|
+
* Made a SystemExtensions module to expose OS level functionality other
|
82
|
+
libraries may want to access.
|
83
|
+
* Publicly exposed the get_character() method, per user requests.
|
84
|
+
* Added terminal_size(), output_cols(), and output_rows() methods.
|
85
|
+
* Added :auto setting for warp_at=() and page_at=().
|
86
|
+
|
87
|
+
== 1.2.0
|
88
|
+
|
89
|
+
* Improved RubyForge and gem spec project descriptions.
|
90
|
+
* Added basic examples to README.
|
91
|
+
* Added a VERSION constant.
|
92
|
+
* Added support for hidden menu commands.
|
93
|
+
* Added Object.or_ask() when using highline/import.
|
94
|
+
|
95
|
+
== 1.0.4
|
96
|
+
|
97
|
+
* Moved the HighLine project to Subversion.
|
98
|
+
* HighLine's color escapes can now be disabled.
|
99
|
+
* Fixed EOF bug introduced in the last release.
|
100
|
+
* Updated HighLine web page.
|
101
|
+
* Moved to a forked development/stable version numbering.
|
102
|
+
|
103
|
+
== 1.0.2
|
104
|
+
|
105
|
+
* Removed old and broken help tests.
|
106
|
+
* Fixed test case typo found by David A. Black.
|
107
|
+
* Added ERb escapes processing to lists, for coloring list items. Color escapes
|
108
|
+
do not add to list element size.
|
109
|
+
* HighLine now throws EOFError when input is exhausted.
|
110
|
+
|
111
|
+
== 1.0.1
|
112
|
+
|
113
|
+
* Minor bug fix: Moved help initialization to before response building, so help
|
114
|
+
would show up in the default responses.
|
115
|
+
|
116
|
+
== 1.0.0
|
117
|
+
|
118
|
+
* Fixed documentation typo pointed out by Gavin Kistner.
|
119
|
+
* Added <tt>gather = ...</tt> option to question for fetching entire Arrays or
|
120
|
+
Hashes filled with answers. You can set +gather+ to a count of answers to
|
121
|
+
collect, a String or Regexp matching the end of input, or a Hash where each
|
122
|
+
key can be used in a new question.
|
123
|
+
* Added File support to HighLine.ask(). You can specify a _directory_ and a
|
124
|
+
_glob_ pattern that combine into a list of file choices the user can select
|
125
|
+
from. You can choose to receive the user's answer as an open filehandle or as
|
126
|
+
a Pathname object.
|
127
|
+
* Added Readline support for history and editing.
|
128
|
+
* Added tab completion for menu and file selection selection (requires
|
129
|
+
Readline).
|
130
|
+
* Added an optional character limit for input.
|
131
|
+
* Added a complete help system to HighLine's shell menu creation tools.
|
132
|
+
|
133
|
+
== 0.6.1
|
134
|
+
|
135
|
+
* Removed termios dependancy in gem, to fix Windows' install.
|
136
|
+
|
137
|
+
== 0.6.0
|
138
|
+
|
139
|
+
* Implemented HighLine.choose() for menu handling.
|
140
|
+
* Provided shortcut <tt>choose(item1, item2, ...)</tt> for simple menus.
|
141
|
+
* Allowed Ruby code to be attached to each menu item, to create a complete
|
142
|
+
menu solution.
|
143
|
+
* Provided for total customization of the menu layout.
|
144
|
+
* Allowed for menu selection by index, name or both.
|
145
|
+
* Added a _shell_ mode to allow menu selection with additional details
|
146
|
+
following the name.
|
147
|
+
* Added a list() utility method that can be invoked just like color(). It can
|
148
|
+
layout Arrays for you in any output in the modes <tt>:columns_across</tt>,
|
149
|
+
<tt>:columns_down</tt>, <tt>:inline</tt> and <tt>:rows</tt>
|
150
|
+
* Added support for <tt>echo = "*"</tt> style settings. User code can now
|
151
|
+
choose the echo character this way.
|
152
|
+
* Modified HighLine to user the "termios" library for character input, if
|
153
|
+
available. Will return to old behavior (using "stty"), if "termios" cannot be
|
154
|
+
loaded.
|
155
|
+
* Improved "stty" state restoring code.
|
156
|
+
* Fixed "stty" code to handle interrupt signals.
|
157
|
+
* Improved the default auto-complete error message and exposed this message
|
158
|
+
through the +responses+ interface as <tt>:no_completion</tt>.
|
159
|
+
|
160
|
+
== 0.5.0
|
161
|
+
|
162
|
+
* Implemented <tt>echo = false</tt> for HighLine::Question objects, primarily to
|
163
|
+
make fetching passwords trivial.
|
164
|
+
* Fixed an auto-complete bug that could cause a crash when the user gave an
|
165
|
+
answer that didn't complete to any valid choice.
|
166
|
+
* Implemented +case+ for HighLine::Question objects to provide character case
|
167
|
+
conversions on given answers. Can be set to <tt>:up</tt>, <tt>:down</tt>, or
|
168
|
+
<tt>:capitalize</tt>.
|
169
|
+
* Exposed <tt>@answer</tt> to the response system, to allow response that are
|
170
|
+
aware of incorrect input.
|
171
|
+
* Implemented +confirm+ for HighLine::Question objects to allow for verification
|
172
|
+
for sensitive user choices. If set to +true+, user will have to answer an
|
173
|
+
"Are you sure? " question. Can also be set to the question to confirm with
|
174
|
+
the user.
|
175
|
+
|
176
|
+
== 0.4.0
|
177
|
+
|
178
|
+
* Added <tt>@wrap_at</tt> and <tt>@page_at</tt> settings and accessors to
|
179
|
+
HighLine, to control text flow.
|
180
|
+
* Implemented line wrapping with adjustable limit.
|
181
|
+
* Implemented paged printing with adjustable limit.
|
182
|
+
|
183
|
+
== 0.3.0
|
184
|
+
|
185
|
+
* Added support for installing with setup.rb.
|
186
|
+
* All output is now treated as an ERb sequence, allowing Ruby code to be
|
187
|
+
embedded in output strings.
|
188
|
+
* Added support for ANSI color sequences in say(). (And everything else
|
189
|
+
by extension.)
|
190
|
+
* Added whitespace handling for answers. Can be set to <tt>:strip</tt>,
|
191
|
+
<tt>:chomp</tt>, <tt>:collapse</tt>, <tt>:strip_and_collapse</tt>,
|
192
|
+
<tt>:chomp_and_collapse</tt>, <tt>:remove</tt>, or <tt>:none</tt>.
|
193
|
+
* Exposed question details to ERb completion through @question, to allow for
|
194
|
+
intelligent responses.
|
195
|
+
* Simplified HighLine internals using @question.
|
196
|
+
* Added support for fetching single character input either with getc() or
|
197
|
+
HighLine's own cross-platform terminal input routine.
|
198
|
+
* Improved type conversion to handle user defined classes.
|
199
|
+
|
200
|
+
== 0.2.0
|
201
|
+
|
202
|
+
* Added Unit Tests to cover an already fixed output bug in the future.
|
203
|
+
* Added Rakefile and setup test action (default).
|
204
|
+
* Renamed HighLine::Answer to HighLine::Question to better illustrate its role.
|
205
|
+
* Renamed fetch_line() to get_response() to better define its goal.
|
206
|
+
* Simplified explain_error in terms of the Question object.
|
207
|
+
* Renamed accept?() to in_range?() to better define purpose.
|
208
|
+
* Reworked valid?() into valid_answer?() to better fit Question object.
|
209
|
+
* Reworked <tt>@member</tt> into <tt>@in</tt>, to make it easier to remember and
|
210
|
+
switched implementation to include?().
|
211
|
+
* Added range checks for @above and @below.
|
212
|
+
* Fixed the bug causing ask() to swallow NoMethodErrors.
|
213
|
+
* Rolled ask_on_error() into responses.
|
214
|
+
* Redirected imports to Kernel from Object.
|
215
|
+
* Added support for <tt>validate = lambda { ... }</tt>.
|
216
|
+
* Added default answer support.
|
217
|
+
* Fixed bug that caused ask() to die with an empty question.
|
218
|
+
* Added complete documentation.
|
219
|
+
* Improve the implemetation of agree() to be the intended "yes" or "no" only
|
220
|
+
question.
|
221
|
+
* Added Rake tasks for documentation and packaging.
|
222
|
+
* Moved project to RubyForge.
|
223
|
+
|
224
|
+
== 0.1.0
|
225
|
+
|
226
|
+
* Initial release as the solution to
|
227
|
+
{Ruby Quiz #29}[http://www.rubyquiz.com/quiz29.html].
|
@@ -0,0 +1,41 @@
|
|
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
|
+
If you want to build the gem locally, make sure you have
|
18
|
+
Rake[http://rubyforge.org/projects/rake/] installed then run the following
|
19
|
+
command:
|
20
|
+
|
21
|
+
$ rake package
|
22
|
+
|
23
|
+
== Installing Manually
|
24
|
+
|
25
|
+
Download the latest version of HighLine from the
|
26
|
+
{RubyForge project page}[http://rubyforge.org/frs/?group_id=683]. Navigate to
|
27
|
+
the root project directory and enter:
|
28
|
+
|
29
|
+
$ sudo ruby setup.rb
|
30
|
+
|
31
|
+
== Using termios
|
32
|
+
|
33
|
+
While not a requirement, HighLine will take advantage of the termios library if
|
34
|
+
installed (on Unix). This slightly improves HighLine's character reading
|
35
|
+
capabilities and thus is recommended for all Unix users.
|
36
|
+
|
37
|
+
If using the HighLine gem, you should be able to add termios as easily as:
|
38
|
+
|
39
|
+
$ sudo gem install termios
|
40
|
+
|
41
|
+
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.
|