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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.simplecov +5 -0
  4. data/.travis.yml +11 -6
  5. data/Changelog.md +112 -20
  6. data/Gemfile +8 -7
  7. data/README.rdoc +3 -0
  8. data/Rakefile +7 -2
  9. data/appveyor.yml +19 -0
  10. data/examples/asking_for_arrays.rb +3 -0
  11. data/examples/basic_usage.rb +3 -0
  12. data/examples/get_character.rb +3 -0
  13. data/examples/limit.rb +3 -0
  14. data/examples/menus.rb +3 -0
  15. data/examples/overwrite.rb +3 -0
  16. data/examples/password.rb +3 -0
  17. data/examples/repeat_entry.rb +4 -1
  18. data/lib/highline.rb +182 -704
  19. data/lib/highline/builtin_styles.rb +109 -0
  20. data/lib/highline/color_scheme.rb +4 -1
  21. data/lib/highline/compatibility.rb +2 -0
  22. data/lib/highline/custom_errors.rb +19 -0
  23. data/lib/highline/import.rb +4 -2
  24. data/lib/highline/list.rb +93 -0
  25. data/lib/highline/list_renderer.rb +232 -0
  26. data/lib/highline/menu.rb +20 -20
  27. data/lib/highline/paginator.rb +43 -0
  28. data/lib/highline/question.rb +157 -97
  29. data/lib/highline/question/answer_converter.rb +84 -0
  30. data/lib/highline/question_asker.rb +147 -0
  31. data/lib/highline/simulate.rb +5 -1
  32. data/lib/highline/statement.rb +58 -0
  33. data/lib/highline/string.rb +34 -0
  34. data/lib/highline/string_extensions.rb +3 -28
  35. data/lib/highline/style.rb +18 -8
  36. data/lib/highline/template_renderer.rb +38 -0
  37. data/lib/highline/terminal.rb +78 -0
  38. data/lib/highline/terminal/io_console.rb +98 -0
  39. data/lib/highline/terminal/ncurses.rb +38 -0
  40. data/lib/highline/terminal/unix_stty.rb +94 -0
  41. data/lib/highline/version.rb +3 -1
  42. data/lib/highline/wrapper.rb +43 -0
  43. data/test/acceptance/acceptance.rb +62 -0
  44. data/test/acceptance/acceptance_test.rb +69 -0
  45. data/test/acceptance/at_color_output_using_erb_templates.rb +17 -0
  46. data/test/acceptance/at_echo_false.rb +23 -0
  47. data/test/acceptance/at_readline.rb +37 -0
  48. data/test/io_console_compatible.rb +37 -0
  49. data/test/string_methods.rb +3 -0
  50. data/test/test_answer_converter.rb +26 -0
  51. data/test/{tc_color_scheme.rb → test_color_scheme.rb} +7 -9
  52. data/test/test_helper.rb +26 -0
  53. data/test/{tc_highline.rb → test_highline.rb} +193 -136
  54. data/test/{tc_import.rb → test_import.rb} +5 -2
  55. data/test/test_list.rb +60 -0
  56. data/test/{tc_menu.rb → test_menu.rb} +6 -3
  57. data/test/test_paginator.rb +73 -0
  58. data/test/test_question_asker.rb +20 -0
  59. data/test/test_simulator.rb +24 -0
  60. data/test/test_string_extension.rb +72 -0
  61. data/test/{tc_string_highline.rb → test_string_highline.rb} +7 -3
  62. data/test/{tc_style.rb → test_style.rb} +70 -35
  63. data/test/test_wrapper.rb +188 -0
  64. metadata +57 -22
  65. data/lib/highline/system_extensions.rb +0 -254
  66. data/test/tc_simulator.rb +0 -33
  67. data/test/tc_string_extension.rb +0 -33
@@ -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
@@ -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