Skip to content

Commit

Permalink
Merge pull request #149 from abinoam/refac_styles
Browse files Browse the repository at this point in the history
Use 'io/console', improve JRuby and Windows support, code coverage and add 'acceptance' tests
  • Loading branch information
abinoam committed Sep 10, 2015
2 parents 1e89bed + 91143b4 commit 6d8677a
Show file tree
Hide file tree
Showing 44 changed files with 752 additions and 441 deletions.
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

0 comments on commit 6d8677a

Please sign in to comment.