highline 1.7.10 → 2.0.0.pre.develop.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.simplecov +5 -0
- data/.travis.yml +11 -6
- data/Changelog.md +112 -20
- data/Gemfile +8 -7
- data/README.rdoc +3 -0
- data/Rakefile +7 -2
- data/appveyor.yml +19 -0
- data/examples/asking_for_arrays.rb +3 -0
- data/examples/basic_usage.rb +3 -0
- data/examples/get_character.rb +3 -0
- data/examples/limit.rb +3 -0
- data/examples/menus.rb +3 -0
- data/examples/overwrite.rb +3 -0
- data/examples/password.rb +3 -0
- data/examples/repeat_entry.rb +4 -1
- data/lib/highline.rb +182 -704
- data/lib/highline/builtin_styles.rb +109 -0
- data/lib/highline/color_scheme.rb +4 -1
- data/lib/highline/compatibility.rb +2 -0
- data/lib/highline/custom_errors.rb +19 -0
- data/lib/highline/import.rb +4 -2
- data/lib/highline/list.rb +93 -0
- data/lib/highline/list_renderer.rb +232 -0
- data/lib/highline/menu.rb +20 -20
- data/lib/highline/paginator.rb +43 -0
- data/lib/highline/question.rb +157 -97
- data/lib/highline/question/answer_converter.rb +84 -0
- data/lib/highline/question_asker.rb +147 -0
- data/lib/highline/simulate.rb +5 -1
- data/lib/highline/statement.rb +58 -0
- data/lib/highline/string.rb +34 -0
- data/lib/highline/string_extensions.rb +3 -28
- data/lib/highline/style.rb +18 -8
- data/lib/highline/template_renderer.rb +38 -0
- data/lib/highline/terminal.rb +78 -0
- data/lib/highline/terminal/io_console.rb +98 -0
- data/lib/highline/terminal/ncurses.rb +38 -0
- data/lib/highline/terminal/unix_stty.rb +94 -0
- data/lib/highline/version.rb +3 -1
- data/lib/highline/wrapper.rb +43 -0
- data/test/acceptance/acceptance.rb +62 -0
- data/test/acceptance/acceptance_test.rb +69 -0
- data/test/acceptance/at_color_output_using_erb_templates.rb +17 -0
- data/test/acceptance/at_echo_false.rb +23 -0
- data/test/acceptance/at_readline.rb +37 -0
- data/test/io_console_compatible.rb +37 -0
- data/test/string_methods.rb +3 -0
- data/test/test_answer_converter.rb +26 -0
- data/test/{tc_color_scheme.rb → test_color_scheme.rb} +7 -9
- data/test/test_helper.rb +26 -0
- data/test/{tc_highline.rb → test_highline.rb} +193 -136
- data/test/{tc_import.rb → test_import.rb} +5 -2
- data/test/test_list.rb +60 -0
- data/test/{tc_menu.rb → test_menu.rb} +6 -3
- data/test/test_paginator.rb +73 -0
- data/test/test_question_asker.rb +20 -0
- data/test/test_simulator.rb +24 -0
- data/test/test_string_extension.rb +72 -0
- data/test/{tc_string_highline.rb → test_string_highline.rb} +7 -3
- data/test/{tc_style.rb → test_style.rb} +70 -35
- data/test/test_wrapper.rb +188 -0
- metadata +57 -22
- data/lib/highline/system_extensions.rb +0 -254
- data/test/tc_simulator.rb +0 -33
- data/test/tc_string_extension.rb +0 -33
data/test/tc_simulator.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'highline/import'
|
3
|
-
require 'highline/simulate'
|
4
|
-
|
5
|
-
class SimulatorTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
input = StringIO.new
|
8
|
-
output = StringIO.new
|
9
|
-
$terminal = HighLine.new(input, output)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_simulator
|
13
|
-
HighLine::Simulate.with('Bugs Bunny', '18') do
|
14
|
-
name = ask('What is your name?')
|
15
|
-
|
16
|
-
assert_equal 'Bugs Bunny', name
|
17
|
-
|
18
|
-
age = ask('What is your age?')
|
19
|
-
|
20
|
-
assert_equal '18', age
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_simulate_with_echo_and_frozen_strings
|
25
|
-
HighLine::Simulate.with('the password'.freeze) do
|
26
|
-
password = ask('What is your password?') do |q|
|
27
|
-
q.echo = '*'
|
28
|
-
end
|
29
|
-
|
30
|
-
assert_equal 'the password', password
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/test/tc_string_extension.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# tc_string_extension.rb
|
2
|
-
#
|
3
|
-
# Created by Richard LeBer 2011-06-27
|
4
|
-
#
|
5
|
-
# This is Free Software. See LICENSE and COPYING for details.
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
|
9
|
-
require "highline"
|
10
|
-
require "stringio"
|
11
|
-
require "string_methods"
|
12
|
-
|
13
|
-
class TestStringExtension < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
HighLine.colorize_strings
|
16
|
-
@string = "string"
|
17
|
-
end
|
18
|
-
|
19
|
-
include StringMethods
|
20
|
-
|
21
|
-
def test_Highline_String_is_yaml_serializable
|
22
|
-
require 'yaml'
|
23
|
-
unless Gem::Version.new(YAML::VERSION) < Gem::Version.new("2.0.2")
|
24
|
-
highline_string = HighLine::String.new("Yaml didn't messed with HighLine::String")
|
25
|
-
yaml_highline_string = highline_string.to_yaml
|
26
|
-
yaml_loaded_string = YAML.load(yaml_highline_string)
|
27
|
-
|
28
|
-
assert_equal "Yaml didn't messed with HighLine::String", yaml_loaded_string
|
29
|
-
assert_equal highline_string, yaml_loaded_string
|
30
|
-
assert_instance_of HighLine::String, yaml_loaded_string
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|