tty-reader 0.3.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --warnings
@@ -1,26 +0,0 @@
1
- ---
2
- language: ruby
3
- sudo: false
4
- cache: bundler
5
- before_install: "gem update bundler"
6
- bundler_args: --without tools
7
- script: "bundle exec rake ci"
8
- rvm:
9
- - 2.0.0
10
- - 2.1.10
11
- - 2.2.9
12
- - 2.3.6
13
- - 2.4.3
14
- - 2.5.0
15
- - ruby-head
16
- - jruby-9.1.1.0
17
- - jruby-head
18
- matrix:
19
- allow_failures:
20
- - rvm: ruby-head
21
- - rvm: jruby-head
22
- fast_finish: true
23
- branches:
24
- only: master
25
- notifications:
26
- email: false
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at [email]. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,20 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- gemspec
6
-
7
- group :test do
8
- gem 'benchmark-ips', '~> 2.7.2'
9
- gem 'simplecov', '~> 0.14.1'
10
- gem 'coveralls', '~> 0.8.21'
11
- end
12
-
13
- group :tools do
14
- gem 'byebug', platform: :mri
15
- end
16
-
17
- group :metrics do
18
- gem 'yard', '~> 0.9.12'
19
- gem 'yardstick', '~> 0.9.9'
20
- end
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require "bundler/gem_tasks"
4
-
5
- FileList['tasks/**/*.rake'].each(&method(:import))
6
-
7
- desc 'Run all specs'
8
- task ci: %w[ spec ]
9
-
10
- task default: :spec
@@ -1,23 +0,0 @@
1
- ---
2
- install:
3
- - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4
- - ruby --version
5
- - gem --version
6
- - bundle install
7
- build: off
8
- test_script:
9
- - bundle exec rake ci
10
- environment:
11
- matrix:
12
- - ruby_version: "200"
13
- - ruby_version: "200-x64"
14
- - ruby_version: "21"
15
- - ruby_version: "21-x64"
16
- - ruby_version: "22"
17
- - ruby_version: "22-x64"
18
- - ruby_version: "23"
19
- - ruby_version: "23-x64"
20
- - ruby_version: "24"
21
- - ruby_version: "24-x64"
22
- - ruby_version: "25"
23
- - ruby_version: "25-x64"
@@ -1,34 +0,0 @@
1
- require 'benchmark/ips'
2
- require 'tty-reader'
3
-
4
- input = StringIO.new("a")
5
- output = StringIO.new
6
- $stdin = input
7
- reader = TTY::Reader.new(input, output)
8
-
9
- Benchmark.ips do |x|
10
- x.report('getc') do
11
- input.rewind
12
- $stdin.getc
13
- end
14
-
15
- x.report('read_char') do
16
- input.rewind
17
- reader.read_char
18
- end
19
-
20
- x.compare!
21
- end
22
-
23
- # v0.1.0
24
- #
25
- # Calculating -------------------------------------
26
- # getc 52462 i/100ms
27
- # read_char 751 i/100ms
28
- # -------------------------------------------------
29
- # getc 2484819.4 (±4.1%) i/s - 12433494 in 5.013438s
30
- # read_char 7736.4 (±2.9%) i/s - 39052 in 5.052628s
31
- #
32
- # Comparison:
33
- # getc: 2484819.4 i/s
34
- # read_char: 7736.4 i/s - 321.19x slower
@@ -1,34 +0,0 @@
1
- require 'benchmark/ips'
2
- require 'tty-reader'
3
-
4
- input = StringIO.new("abc\n")
5
- output = StringIO.new
6
- $stdin = input
7
- reader = TTY::Reader.new(input, output)
8
-
9
- Benchmark.ips do |x|
10
- x.report('gets') do
11
- input.rewind
12
- $stdin.gets
13
- end
14
-
15
- x.report('read_line') do
16
- input.rewind
17
- reader.read_line
18
- end
19
-
20
- x.compare!
21
- end
22
-
23
- # v0.1.0
24
- #
25
- # Calculating -------------------------------------
26
- # gets 51729 i/100ms
27
- # read_line 164 i/100ms
28
- # -------------------------------------------------
29
- # gets 1955255.2 (±3.7%) i/s - 9776781 in 5.008004s
30
- # read_line 1215.1 (±33.1%) i/s - 5248 in 5.066569s
31
- #
32
- # Comparison:
33
- # gets: 1955255.2 i/s
34
- # read_line: 1215.1 i/s - 1609.19x slower
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "tty/reader"
5
- require "irb"
6
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,16 +0,0 @@
1
- require_relative '../lib/tty-reader'
2
-
3
- reader = TTY::Reader.new
4
-
5
- puts "Press a key (or Ctrl-X to exit)"
6
-
7
- loop do
8
- print "=> "
9
- char = reader.read_keypress
10
- if ?\C-x == char
11
- puts "Exiting..."
12
- exit
13
- else
14
- puts "#{char.inspect} [#{char.ord}] (hex: #{char.ord.to_s(16)})"
15
- end
16
- end
@@ -1,7 +0,0 @@
1
- require_relative '../lib/tty-reader'
2
-
3
- reader = TTY::Reader.new
4
-
5
- answer = reader.read_line(">> ")
6
-
7
- puts "answer: #{answer}"
@@ -1,7 +0,0 @@
1
- require_relative '../lib/tty-reader'
2
-
3
- reader = TTY::Reader.new
4
-
5
- answer = reader.read_multiline(">> ")
6
-
7
- puts "\nanswer: #{answer}"
@@ -1,6 +0,0 @@
1
- require_relative '../lib/tty-reader'
2
-
3
- reader = TTY::Reader.new
4
-
5
- answer = reader.read_line('=> ', echo: false)
6
- puts "Answer: #{answer}"
@@ -1,12 +0,0 @@
1
- require_relative '../lib/tty-reader'
2
-
3
- puts "*** TTY::Reader Shell ***"
4
- puts "Press Ctrl-X to exit"
5
-
6
- reader = TTY::Reader.new
7
-
8
- reader.on(:keyctrl_x) { puts "Exiting..."; exit }
9
-
10
- loop do
11
- reader.read_line('=> ')
12
- end
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Load gem inside irb console'
4
- task :console do
5
- require 'irb'
6
- require 'irb/completion'
7
- require File.join(__FILE__, '../../lib/tty-reader')
8
- ARGV.clear
9
- IRB.start
10
- end
11
- task c: %w[ console ]
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Measure code coverage'
4
- task :coverage do
5
- begin
6
- original, ENV['COVERAGE'] = ENV['COVERAGE'], 'true'
7
- Rake::Task['spec'].invoke
8
- ensure
9
- ENV['COVERAGE'] = original
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
-
6
- desc 'Run all specs'
7
- RSpec::Core::RakeTask.new(:spec) do |task|
8
- task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
9
- end
10
-
11
- namespace :spec do
12
- desc 'Run unit specs'
13
- RSpec::Core::RakeTask.new(:unit) do |task|
14
- task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
15
- end
16
-
17
- desc 'Run integration specs'
18
- RSpec::Core::RakeTask.new(:integration) do |task|
19
- task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
20
- end
21
- end
22
-
23
- rescue LoadError
24
- %w[spec spec:unit spec:integration].each do |name|
25
- task name do
26
- $stderr.puts "In order to run #{name}, do `gem install rspec`"
27
- end
28
- end
29
- end
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "tty/reader/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "tty-reader"
8
- spec.version = TTY::Reader::VERSION
9
- spec.authors = ["Piotr Murach"]
10
- spec.email = [""]
11
- spec.summary = %q{A set of methods for processing keyboard input in character, line and multiline modes.}
12
- spec.description = %q{A set of methods for processing keyboard input in character, line and multiline modes. In addition it maintains history of entered input with an ability to recall and re-edit those inputs and register to listen for keystrokes.}
13
- spec.homepage = "https://piotrmurach.github.io/tty"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
18
- end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ["lib"]
22
-
23
- spec.required_ruby_version = '>= 2.0.0'
24
-
25
- spec.add_dependency "wisper", "~> 2.0.0"
26
- spec.add_dependency "tty-screen", "~> 0.6.4"
27
- spec.add_dependency "tty-cursor", "~> 0.5.0"
28
-
29
- spec.add_development_dependency "bundler", ">= 1.5.0", "< 2.0"
30
- spec.add_development_dependency "rake", "~> 12.0"
31
- spec.add_development_dependency "rspec", "~> 3.0"
32
- end