Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'io/console', improve JRuby and Windows support, code coverage and add 'acceptance' tests #149

Merged
merged 44 commits into from
Sep 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
64708ae
Extract HighLine::BuiltinStyles as a module
abinoam Jul 9, 2015
7a5e96e
Make const_missing available when HighLine::BuiltinStyles is included
abinoam Jul 9, 2015
a498560
Review HighLine#say
abinoam Jul 17, 2015
dd5f8be
It's 'nil check' hunting season
abinoam Jul 17, 2015
bd9e74c
Remove the 'setting environment before invocation' option of HighLine…
abinoam Jul 17, 2015
5f6780d
Move the responsabilities of dealing with Question initialization to …
abinoam Jul 17, 2015
3b7d922
Completely remove @question inst var from HighLine objects
abinoam Jul 17, 2015
078c4e8
Include lib subdirs in RDoc Rake task
abinoam Jul 16, 2015
7a877e3
Add some rdoc markup for correct doc generation
abinoam Jul 17, 2015
c343443
Extract HighLine::String to its own file and fix doc generation for it
abinoam Jul 17, 2015
8327582
Make the new HighLine::String work
abinoam Jul 17, 2015
8f710dc
Class variable hunting season is open!
abinoam Jul 17, 2015
14e7b9c
Add Terminal::IOConsole (copy Terminal::UnixStty)
abinoam Jul 17, 2015
6e1878e
Make Terminal::IOConsole work
abinoam Jul 17, 2015
b336e2f
Make tests involving (io/console) #getch and Tempfile work
abinoam Jul 17, 2015
85f0c93
Advertise what Terminal class in use at tests and examples
abinoam Jul 17, 2015
691c1d9
Remove duplicate HighLine#directory accessor
abinoam Jul 17, 2015
8ca40cd
Change local variable name 'string' to 'str'
abinoam Jul 17, 2015
3ad917e
Make HighLine::Terminal instances respect HighLine defined input and …
abinoam Jul 20, 2015
02d0f4f
Make Readline tests be skipped when JRuby or Rubinius
abinoam Jul 20, 2015
ccc05fd
Add a compatibility module to give io/console capabilities to StringI…
abinoam Jul 20, 2015
3418407
Add some debug information to be show at test run time
abinoam Jul 20, 2015
a400deb
Add some semi-automatic 'acceptance' tests to HighLine (yup)
abinoam Jul 20, 2015
6c93017
Update .travis with JRuby and the head versions of MRI
abinoam Jul 20, 2015
046719b
Update changelog and bump up version to 2.0.0-develop.2
abinoam Jul 20, 2015
803d59c
Specify test files explicitly - good for Windows
abinoam Jul 23, 2015
b8b1949
Skip Readline tests for Windows also'
abinoam Jul 23, 2015
6eec787
Choose filename from right to left - better for Windows
abinoam Jul 23, 2015
2677003
Use Encoding::UTF_8 because StringIO always will be that in this case
abinoam Jul 23, 2015
1c32748
Add appveyor.yml - CI on Windows
abinoam Jul 23, 2015
a9d3604
Encapsulate the Readline.readline in a block that preserves stty state
abinoam Aug 16, 2015
8b6b912
Set Readline.completion_proc only if there's a Question#selection given
abinoam Aug 16, 2015
e7b50cd
Add more debug messages on test/test_helper.rb
abinoam Sep 6, 2015
02457e6
Require io_console_compatible at test_helper so other files benefit f…
abinoam Sep 7, 2015
6fea528
Remove unecessary begin clause. Use def as 'delimiter'.
abinoam Sep 8, 2015
f27035c
Remove _old_ and broken windows code. We will rely on io/console.
abinoam Sep 8, 2015
3e33ce0
Remove _old_ and broken termios code. We will rely on io/console.
abinoam Sep 8, 2015
a5127fa
Remove _old_, duplicate and broken stty code. There's a new unix_stty…
abinoam Sep 8, 2015
8a61253
Remove _old_ and broken jruby code. We will rely on io/console.
abinoam Sep 8, 2015
a994dc4
Add a TODO note on ncurses code. Will we maintain it?
abinoam Sep 8, 2015
79d8e7e
Merge branch 'feat_improve_terminals' into fix_readline_at_jruby-2
abinoam Sep 9, 2015
d890f5e
Add AppVeyor (Windows) CI build status badge to README.rdoc
abinoam Sep 10, 2015
65ef18d
Update travis rubies versions for JRuby-9.0.2.0 (head)
abinoam Sep 10, 2015
91143b4
Update Changelog.md - 2.0.0-develop.2
abinoam Sep 10, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ language: ruby
sudo: false
script: "bundle exec rake test"
rvm:
- 1.9.3
- 2.0.0
- 2.1.5
- 2.2.0
- 2.2.1
- 2.2.2
- 1.9
- 2.0
- 2.1
- 2.2
- ruby-head
- rbx-2
- jruby-19mode # JRuby in 1.9 mode
- jruby-head

notifications:
email: false
matrix:
allow_failures:
- rvm: ruby-head
- rvm: rbx-2
- rvm: jruby-19mode # JRuby in 1.9 mode
- rvm: jruby-head
52 changes: 52 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,58 @@

Below is a complete listing of changes for each revision of HighLine.

### 2.0.0-develop.2 / 2015-09-09

(by Abinoam P. Marques Jr. - @abinoam)

#### NOTES

This version brings greater compatibility with JRuby and Windows.
But we still have a lot of small issues in both platforms.
We were able to unify/converge all approaches into using io/console,
so we could delete old code that relied solely on stty, termios, java api and
windows apis (DL and Fiddle).

Another improvement is the beginning of what I called "acceptance tests".
If you type ```rake acceptance``` you'll be guided through some tests
where you have to input some thing and see if everything work as expected.
This makes easier to catch bugs that otherwise would be over-sighted.

#### CHANGES SUMMARY

* Fix Simplecov - it was reporting erroneous code coverage
* Add new tests. Improves code coverage
* Extract HighLine::BuiltinStyles
* Try to avoid nil checking
* Try to avoid class variables (mis)use
* Fix RDoc include path and some small fixes to the docs
* Move HighLine::String to its own file
* Add HighLine::Terminal::IOConsole
- Add an IOConsoleCompatibility module with some stubbed
methods for using at StringIO, File and Tempfile to help
on tests.
- Any enviroment that can require 'io/console' will
use HighLine::Terminal::IOConsole by default. This kind
of unifies most environments where HighLine runs. For
example, we can use Terminal::IOConsole on JRuby!!!
* Add ruby-head and JRuby (19mode and head) to Travis CI matrix. Yes, this
our first step to a more peaceful JRuby compatibility.
* Add AppVeyor Continuous Integration for Windows
* Add _acceptance_ tests for HighLine
- Use ```rake acceptance``` to run them
- Basically it interactively asks the user to confirm if
some expected HighLine behavior is actually happening.
After that it gather some environment debug information,
so the use could send to the HighLine contributors in case
of failure.
* Remove old and unused files (as a result of relying on io/console)
- JRuby
- Windows (DL and Fiddle)
- Termios
* Fix some small (old and new) bugs
* Make some more tuning for Windows compatibility
* Make some more tuning for JRuby compatibility

### 2.0.0-develop.1 / 2015-06-11

This is the first development version of the 2.0.0 series. It's the begining of a refactoring phase on HighLine development cycle.
Expand Down
1 change: 1 addition & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
by James Edward Gray II

{<img src="https://travis-ci.org/JEG2/highline.svg" alt="Build Status" />}[https://travis-ci.org/JEG2/highline]
{<img src="https://ci.appveyor.com/api/projects/status/4p05fijpah77d28x?svg=true" alt="AppVeyor Build Status" />}[https://ci.appveyor.com/project/abinoam/highline]
{<img src="https://img.shields.io/gem/v/highline.svg?style=flat" />}[http://rubygems.org/gems/highline]
{<img src="https://codeclimate.com/github/JEG2/highline/badges/gpa.svg" />}[https://codeclimate.com/github/JEG2/highline]
{<img src="https://codeclimate.com/github/JEG2/highline/badges/coverage.svg" />}[https://codeclimate.com/github/JEG2/highline/coverage]
Expand Down
8 changes: 7 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ Rake::TestTask.new do |test|
test.libs = ["lib", "test"]
test.verbose = true
test.warning = true
test.test_files = FileList['test/test*.rb']
end

RDoc::Task.new do |rdoc|
rdoc.rdoc_files.include( "README.rdoc", "INSTALL",
"TODO", "Changelog.md",
"AUTHORS", "COPYING",
"LICENSE", "lib /*.rb" )
"LICENSE", "lib/**/*.rb")
rdoc.main = "README.rdoc"
rdoc.rdoc_dir = "doc/html"
rdoc.title = "HighLine Documentation"
Expand All @@ -27,3 +28,8 @@ end
Gem::PackageTask.new(SPEC) do |package|
# do nothing: I just need a gem but this block is required
end

desc "Run some interactive acceptance tests"
task :acceptance do
load "test/acceptance/acceptance.rb"
end
19 changes: 19 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '{build}'

skip_tags: true

environment:
matrix:
- ruby_version: "21"
- ruby_version: "21-x64"

install:
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
- gem install bundler --no-document -v 1.10.5
- bundle install --retry=3

test_script:
- bundle exec rake

build: off

3 changes: 3 additions & 0 deletions examples/asking_for_arrays.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
require "highline/import"
require "pp"

puts "Using: #{$terminal.terminal.class}"
puts

grades = ask( "Enter test scores (or a blank line to quit):",
lambda { |ans| ans =~ /^-?\d+$/ ? Integer(ans) : ans} ) do |q|
q.gather = ""
Expand Down
3 changes: 3 additions & 0 deletions examples/basic_usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
require "highline/import"
require "yaml"

puts "Using: #{$terminal.terminal.class}"
puts

contacts = [ ]

class NameClass
Expand Down
3 changes: 3 additions & 0 deletions examples/get_character.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
require "rubygems"
require "highline/import"

puts "Using: #{$terminal.terminal.class}"
puts

choices = "ynaq"
answer = ask("Your choice [#{choices}]? ") do |q|
q.echo = false
Expand Down
3 changes: 3 additions & 0 deletions examples/limit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
require "rubygems"
require "highline/import"

puts "Using: #{$terminal.terminal.class}"
puts

text = ask("Enter text (max 10 chars): ") { |q| q.limit = 10 }
puts "You entered: #{text}!"
3 changes: 3 additions & 0 deletions examples/menus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
require "rubygems"
require "highline/import"

puts "Using: #{$terminal.terminal.class}"
puts

# The old way, using ask() and say()...
choices = %w{ruby python perl}
say("This is the old way using ask() and say()...")
Expand Down
3 changes: 3 additions & 0 deletions examples/overwrite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
require 'rubygems'
require 'highline/import'

puts "Using: #{$terminal.terminal.class}"
puts

prompt = "here is your password:"
ask(
"#{prompt} <%= color('mypassword', RED, BOLD) %> (Press Any Key to blank) "
Expand Down
3 changes: 3 additions & 0 deletions examples/password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
require "rubygems"
require "highline/import"

puts "Using: #{$terminal.terminal.class}"
puts

pass = ask("Enter your password: ") { |q| q.echo = false }
puts "Your password is #{pass}!"
3 changes: 3 additions & 0 deletions examples/repeat_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
require "rubygems"
require "highline/import"

puts "Using: #{$terminal.terminal.class}"
puts

tounge_twister = ask("... try saying that three times fast") do |q|
q.gather = 3
q.verify_match = true
Expand Down
Loading