tty-pager 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +16 -0
- data/Gemfile +3 -4
- data/README.md +4 -3
- data/examples/basic_pager.rb +1 -3
- data/examples/pager.rb +7 -0
- data/examples/system_pager.rb +1 -3
- data/lib/tty/pager.rb +20 -19
- data/lib/tty/pager/basic.rb +3 -3
- data/lib/tty/pager/system.rb +51 -53
- data/lib/tty/pager/version.rb +1 -1
- data/spec/unit/basic/page_spec.rb +9 -8
- data/spec/unit/page_spec.rb +2 -2
- data/spec/unit/system/executables_spec.rb +11 -0
- data/spec/unit/system/{available_spec.rb → find_executable_spec.rb} +8 -8
- data/spec/unit/system/new_spec.rb +1 -1
- data/spec/unit/system/page_spec.rb +1 -1
- data/tty-pager.gemspec +2 -2
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55f5c44928591973014fd8a38e846c47450825a7
|
4
|
+
data.tar.gz: 6d569bedaa777b130deb2ce2a6ffea24580f6113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adb81f00fba4a7ffbf9f76e638fccf4699305a1e932003fd20a89f4a737d0a8da1f95945dd66e20fd55d75742fd2171ed15a34935e4393513f8f2c1b4badfeb9
|
7
|
+
data.tar.gz: cdd003dbeeab701b181693b6e53cac19c75c1a338896c5bce11a4ead8d233ec358f8834041651babe9230ca6dfefc806e725cd11d7c04a7e75ce6976e3629f18
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.11.0] - 2018-01-11
|
4
|
+
|
5
|
+
### Added
|
6
|
+
* Add `pg` and `most` to executables lookup
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
* Change verse to strings dependency
|
10
|
+
* Change SystemPager to make all class methods public
|
11
|
+
* Change SystemPager#available to #find_executable
|
12
|
+
* Change SystemPager#available? to #exec_available
|
13
|
+
* Change Pager#find_available to #select_pager and make class method
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
* Fix Pager throwing exception if git is not installed by Katelyn Schiesser(@slowbro)
|
17
|
+
|
3
18
|
## [v0.10.0] - 2017-10-29
|
4
19
|
|
5
20
|
### Changed
|
@@ -69,6 +84,7 @@
|
|
69
84
|
### Changed
|
70
85
|
* Change SystemPager to correctly paginate inside a process.
|
71
86
|
|
87
|
+
[v0.11.0]: https://github.com/peter-murach/tty-prompt/compare/v0.10.0...v0.11.0
|
72
88
|
[v0.10.0]: https://github.com/peter-murach/tty-prompt/compare/v0.9.0...v0.10.0
|
73
89
|
[v0.9.0]: https://github.com/peter-murach/tty-prompt/compare/v0.8.0...v0.9.0
|
74
90
|
[v0.8.0]: https://github.com/peter-murach/tty-prompt/compare/v0.7.1...v0.8.0
|
data/Gemfile
CHANGED
@@ -3,12 +3,11 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'yard',
|
6
|
+
gem 'yard', '~> 0.9.12'
|
7
7
|
end
|
8
8
|
|
9
9
|
group :metrics do
|
10
|
-
gem 'coveralls', '~> 0.8.
|
11
|
-
gem 'simplecov', '~> 0.
|
10
|
+
gem 'coveralls', '~> 0.8.21'
|
11
|
+
gem 'simplecov', '~> 0.14.1'
|
12
12
|
gem 'yardstick', '~> 0.9.9'
|
13
|
-
gem 'term-ansicolor', '=1.3.2'
|
14
13
|
end
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# TTY::Pager [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
|
2
|
+
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/tty-pager.svg)][gem]
|
3
4
|
[![Build Status](https://secure.travis-ci.org/piotrmurach/tty-pager.svg?branch=master)][travis]
|
4
5
|
[![Build status](https://ci.appveyor.com/api/projects/status/3auc1vi3mk5puqai?svg=true)][appveyor]
|
5
|
-
[![
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/636da0d02231b7f3e50f/maintainability)][codeclimate]
|
6
7
|
[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/tty-pager/badge.svg)][coverage]
|
7
8
|
[![Inline docs](http://inch-ci.org/github/piotrmurach/tty-pager.svg?branch=master)][inchpages]
|
8
9
|
|
@@ -10,7 +11,7 @@
|
|
10
11
|
[gem]: http://badge.fury.io/rb/tty-pager
|
11
12
|
[travis]: http://travis-ci.org/piotrmurach/tty-pager
|
12
13
|
[appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-pager
|
13
|
-
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-pager
|
14
|
+
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-pager/maintainability
|
14
15
|
[coverage]: https://coveralls.io/github/piotrmurach/tty-pager
|
15
16
|
[inchpages]: http://inch-ci.org/github/piotrmurach/tty-pager
|
16
17
|
|
@@ -120,4 +121,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/piotrm
|
|
120
121
|
|
121
122
|
## Copyright
|
122
123
|
|
123
|
-
Copyright (c) 2015-
|
124
|
+
Copyright (c) 2015-2018 Piotr Murach. See LICENSE for further details.
|
data/examples/basic_pager.rb
CHANGED
data/examples/pager.rb
ADDED
data/examples/system_pager.rb
CHANGED
data/lib/tty/pager.rb
CHANGED
@@ -9,6 +9,25 @@ module TTY
|
|
9
9
|
class Pager
|
10
10
|
Error = Class.new(StandardError)
|
11
11
|
|
12
|
+
# Select an appriopriate pager
|
13
|
+
#
|
14
|
+
# If the user disabled paging then a NullPager is returned,
|
15
|
+
# otherwise a check is performed to find native system
|
16
|
+
# command to perform pagination with SystemPager. Finally,
|
17
|
+
# if no system command is found, a BasicPager is used which
|
18
|
+
# is a pure Ruby implementation known to work on any platform.
|
19
|
+
#
|
20
|
+
# @api private
|
21
|
+
def self.select_pager(enabled)
|
22
|
+
if !enabled
|
23
|
+
NullPager
|
24
|
+
elsif SystemPager.exec_available?
|
25
|
+
SystemPager
|
26
|
+
else
|
27
|
+
BasicPager
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
12
31
|
# Create a pager
|
13
32
|
#
|
14
33
|
# @param [Hash] options
|
@@ -28,7 +47,7 @@ module TTY
|
|
28
47
|
@enabled = options.fetch(:enabled) { true }
|
29
48
|
|
30
49
|
if self.class == TTY::Pager
|
31
|
-
@pager =
|
50
|
+
@pager = self.class.select_pager(@enabled).new(options)
|
32
51
|
end
|
33
52
|
end
|
34
53
|
|
@@ -78,23 +97,5 @@ module TTY
|
|
78
97
|
|
79
98
|
attr_reader :pager
|
80
99
|
|
81
|
-
# Find available pager
|
82
|
-
#
|
83
|
-
# If the user disabled paging then a NullPager is returned,
|
84
|
-
# otherwise a check is performed to find native system
|
85
|
-
# command to perform pagination with SystemPager. Finally,
|
86
|
-
# if no system command is found, a BasicPager is used which
|
87
|
-
# is a pure Ruby implementation known to work on any platform.
|
88
|
-
#
|
89
|
-
# @api private
|
90
|
-
def find_available(options)
|
91
|
-
if !enabled?
|
92
|
-
NullPager.new
|
93
|
-
elsif SystemPager.available?
|
94
|
-
SystemPager.new(options)
|
95
|
-
else
|
96
|
-
BasicPager.new(options)
|
97
|
-
end
|
98
|
-
end
|
99
100
|
end # Pager
|
100
101
|
end # TTY
|
data/lib/tty/pager/basic.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'strings'
|
4
4
|
|
5
5
|
module TTY
|
6
6
|
class Pager
|
@@ -36,7 +36,7 @@ module TTY
|
|
36
36
|
#
|
37
37
|
# @api private
|
38
38
|
def default_prompt
|
39
|
-
proc { |page_num| output.puts
|
39
|
+
proc { |page_num| output.puts Strings.wrap(PAGE_BREAK % page_num, @width) }
|
40
40
|
end
|
41
41
|
|
42
42
|
# Page text
|
@@ -53,7 +53,7 @@ module TTY
|
|
53
53
|
chunk = leftover
|
54
54
|
leftover = []
|
55
55
|
end
|
56
|
-
wrapped_line =
|
56
|
+
wrapped_line = Strings.wrap(line, @width)
|
57
57
|
wrapped_line.lines.each do |line_part|
|
58
58
|
if lines_left > 0
|
59
59
|
chunk << line_part
|
data/lib/tty/pager/system.rb
CHANGED
@@ -9,40 +9,49 @@ module TTY
|
|
9
9
|
#
|
10
10
|
# @api public
|
11
11
|
class SystemPager < Pager
|
12
|
-
#
|
12
|
+
# Check if command exists
|
13
13
|
#
|
14
|
-
# @
|
15
|
-
#
|
16
|
-
# the command to use for paging
|
14
|
+
# @example
|
15
|
+
# command_exists?('less) # => true
|
17
16
|
#
|
18
|
-
# @
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
" try using `BasicPager` instead." \
|
27
|
-
end
|
17
|
+
# @param [String] command
|
18
|
+
# the command to check
|
19
|
+
#
|
20
|
+
# @return [Boolean]
|
21
|
+
#
|
22
|
+
# @api private
|
23
|
+
def self.command_exists?(command)
|
24
|
+
TTY::Which.exist?(command)
|
28
25
|
end
|
29
26
|
|
30
|
-
#
|
27
|
+
# List possible executables for output paging
|
28
|
+
#
|
29
|
+
# @return [Array[String]]
|
30
|
+
#
|
31
|
+
# @api private
|
32
|
+
def self.executables
|
33
|
+
[ENV['GIT_PAGER'], ENV['PAGER'],
|
34
|
+
command_exists?('git') ? `git config --get-all core.pager` : nil,
|
35
|
+
'less', 'more', 'cat', 'pager', 'pg', 'most'].compact
|
36
|
+
end
|
37
|
+
|
38
|
+
# Find first available termainal pager program executable
|
31
39
|
#
|
32
40
|
# @example Basic usage
|
33
|
-
#
|
41
|
+
# find_executable # => 'less'
|
34
42
|
#
|
35
43
|
# @example Usage with commands
|
36
|
-
#
|
44
|
+
# find_executable('less', 'cat') # => 'less'
|
37
45
|
#
|
38
46
|
# @param [Array[String]] commands
|
39
47
|
#
|
40
|
-
# @return [String]
|
48
|
+
# @return [String, nil]
|
49
|
+
# the found executable or nil when not found
|
41
50
|
#
|
42
51
|
# @api public
|
43
|
-
def self.
|
44
|
-
|
45
|
-
|
52
|
+
def self.find_executable(*commands)
|
53
|
+
execs = commands.empty? ? executables : commands
|
54
|
+
execs
|
46
55
|
.compact.map(&:strip).reject(&:empty?).uniq
|
47
56
|
.find { |cmd| command_exists?(cmd.split.first) }
|
48
57
|
end
|
@@ -58,8 +67,26 @@ module TTY
|
|
58
67
|
# @return [Boolean]
|
59
68
|
#
|
60
69
|
# @api public
|
61
|
-
def self.
|
62
|
-
!
|
70
|
+
def self.exec_available?(*commands)
|
71
|
+
!find_executable(*commands).nil?
|
72
|
+
end
|
73
|
+
|
74
|
+
# Create a system pager
|
75
|
+
#
|
76
|
+
# @param [Hash] options
|
77
|
+
# @option options [String] :command
|
78
|
+
# the command to use for paging
|
79
|
+
#
|
80
|
+
# @api public
|
81
|
+
def initialize(options = {})
|
82
|
+
super
|
83
|
+
@pager_command = options[:command]
|
84
|
+
unless self.class.exec_available?
|
85
|
+
raise TTY::Pager::Error, "#{self.class.name} cannot be used on your" \
|
86
|
+
" system due to lack of appropriate pager" \
|
87
|
+
" executable. Install `less` like pager or" \
|
88
|
+
" try using `BasicPager` instead." \
|
89
|
+
end
|
63
90
|
end
|
64
91
|
|
65
92
|
# Use system command to page output text
|
@@ -90,35 +117,6 @@ module TTY
|
|
90
117
|
true
|
91
118
|
end
|
92
119
|
|
93
|
-
private
|
94
|
-
|
95
|
-
# List possible executables for output paging
|
96
|
-
#
|
97
|
-
# @return [Array[String]]
|
98
|
-
#
|
99
|
-
# @api private
|
100
|
-
def self.executables
|
101
|
-
[ENV['GIT_PAGER'], ENV['PAGER'],
|
102
|
-
`git config --get-all core.pager`,
|
103
|
-
'less', 'more', 'cat', 'pager']
|
104
|
-
end
|
105
|
-
private_class_method :executables
|
106
|
-
|
107
|
-
# Check if command exists
|
108
|
-
#
|
109
|
-
# @example
|
110
|
-
# command_exists?('less) # => true
|
111
|
-
#
|
112
|
-
# @param [String] command
|
113
|
-
# the command to check
|
114
|
-
#
|
115
|
-
# @return [Boolean]
|
116
|
-
#
|
117
|
-
# @api private
|
118
|
-
def self.command_exists?(command)
|
119
|
-
TTY::Which.exist?(command)
|
120
|
-
end
|
121
|
-
|
122
120
|
# The pager command to run
|
123
121
|
#
|
124
122
|
# @return [String]
|
@@ -129,7 +127,7 @@ module TTY
|
|
129
127
|
@pager_command = if @pager_command && commands.empty?
|
130
128
|
@pager_command
|
131
129
|
else
|
132
|
-
self.class.
|
130
|
+
self.class.find_executable(*commands)
|
133
131
|
end
|
134
132
|
end
|
135
133
|
end # SystemPager
|
data/lib/tty/pager/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe TTY::Pager::BasicPager, '.page' do
|
2
4
|
let(:input) { StringIO.new }
|
3
5
|
let(:output) { StringIO.new }
|
@@ -16,8 +18,7 @@ RSpec.describe TTY::Pager::BasicPager, '.page' do
|
|
16
18
|
end
|
17
19
|
|
18
20
|
it "breaks text exceeding terminal width" do
|
19
|
-
text = ""
|
20
|
-
text << "It is not down on any map; true places never are.\n"
|
21
|
+
text = "It is not down on any map; true places never are.\n"
|
21
22
|
input << "\n"
|
22
23
|
input.rewind
|
23
24
|
pager = described_class.new(output: output, input: input,
|
@@ -43,13 +44,13 @@ RSpec.describe TTY::Pager::BasicPager, '.page' do
|
|
43
44
|
end
|
44
45
|
|
45
46
|
it "continues paging when enter is pressed" do
|
46
|
-
text =
|
47
|
+
text = []
|
47
48
|
10.times { text << "I try all things, I achieve what I can.\n"}
|
48
49
|
input << "\n\n\n"
|
49
50
|
input.rewind
|
50
51
|
pager = described_class.new(output: output, input: input,
|
51
52
|
width: 100, height: 5)
|
52
|
-
pager.page(text)
|
53
|
+
pager.page(text.join)
|
53
54
|
expect(output.string).to eq([
|
54
55
|
"I try all things, I achieve what I can.",
|
55
56
|
"I try all things, I achieve what I can.",
|
@@ -71,13 +72,13 @@ RSpec.describe TTY::Pager::BasicPager, '.page' do
|
|
71
72
|
end
|
72
73
|
|
73
74
|
it "stops paging when q is pressed" do
|
74
|
-
text =
|
75
|
+
text = []
|
75
76
|
10.times { text << "I try all things, I achieve what I can.\n"}
|
76
77
|
input << "\nq\n"
|
77
78
|
input.rewind
|
78
79
|
pager = described_class.new(output: output, input: input,
|
79
80
|
width: 100, height: 5)
|
80
|
-
pager.page(text)
|
81
|
+
pager.page(text.join)
|
81
82
|
expect(output.string).to eq([
|
82
83
|
"I try all things, I achieve what I can.",
|
83
84
|
"I try all things, I achieve what I can.",
|
@@ -93,14 +94,14 @@ RSpec.describe TTY::Pager::BasicPager, '.page' do
|
|
93
94
|
end
|
94
95
|
|
95
96
|
it "allows to change paging prompt" do
|
96
|
-
text =
|
97
|
+
text = []
|
97
98
|
5.times { text << "I try all things, I achieve what I can.\n"}
|
98
99
|
input << "\nq\n"
|
99
100
|
input.rewind
|
100
101
|
prompt = proc { |num| output.puts "Page -#{num}-" }
|
101
102
|
pager = described_class.new(output: output, input: input,
|
102
103
|
width: 100, height: 5, prompt: prompt)
|
103
|
-
pager.page(text)
|
104
|
+
pager.page(text.join)
|
104
105
|
expect(output.string).to eq([
|
105
106
|
"I try all things, I achieve what I can.",
|
106
107
|
"I try all things, I achieve what I can.",
|
data/spec/unit/page_spec.rb
CHANGED
@@ -14,7 +14,7 @@ RSpec.describe TTY::Pager, '.page' do
|
|
14
14
|
|
15
15
|
it "selects BasicPager when no paging command is available" do
|
16
16
|
basic_pager = spy(:basic_pager)
|
17
|
-
allow(TTY::Pager::SystemPager).to receive(:
|
17
|
+
allow(TTY::Pager::SystemPager).to receive(:exec_available?) { false }
|
18
18
|
allow(TTY::Pager::BasicPager).to receive(:new) { basic_pager }
|
19
19
|
|
20
20
|
pager = described_class.new
|
@@ -26,7 +26,7 @@ RSpec.describe TTY::Pager, '.page' do
|
|
26
26
|
|
27
27
|
it "selects SystemPager when paging command is available" do
|
28
28
|
system_pager = spy(:system_pager)
|
29
|
-
allow(TTY::Pager::SystemPager).to receive(:
|
29
|
+
allow(TTY::Pager::SystemPager).to receive(:exec_available?) { true }
|
30
30
|
allow(TTY::Pager::SystemPager).to receive(:new) { system_pager }
|
31
31
|
|
32
32
|
pager = described_class.new
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe TTY::Pager::SystemPager do
|
4
|
+
it "provides executable names" do
|
5
|
+
allow(ENV).to receive(:[]).with('GIT_PAGER').and_return(nil)
|
6
|
+
allow(ENV).to receive(:[]).with('PAGER').and_return(nil)
|
7
|
+
allow(described_class).to receive(:command_exists?).with('git').and_return(false)
|
8
|
+
|
9
|
+
expect(described_class.executables).to eq(['less', 'more', 'cat', 'pager', 'pg', 'most'])
|
10
|
+
end
|
11
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
RSpec.describe TTY::Pager::SystemPager, '#
|
1
|
+
RSpec.describe TTY::Pager::SystemPager, '#find_executable' do
|
2
2
|
let(:execs) { ['less', 'more'] }
|
3
3
|
|
4
4
|
subject(:pager) { described_class }
|
@@ -7,23 +7,23 @@ RSpec.describe TTY::Pager::SystemPager, '#available' do
|
|
7
7
|
allow(pager).to receive(:executables).and_return(execs)
|
8
8
|
allow(pager).to receive(:command_exists?).with('less') { true }
|
9
9
|
allow(pager).to receive(:command_exists?).with('more') { false }
|
10
|
-
expect(pager.
|
10
|
+
expect(pager.find_executable).to eql('less')
|
11
11
|
end
|
12
12
|
|
13
13
|
it "doesn't find command" do
|
14
14
|
allow(pager).to receive(:executables).and_return(execs)
|
15
15
|
allow(pager).to receive(:command_exists?) { false }
|
16
|
-
expect(pager.
|
16
|
+
expect(pager.find_executable).to be_nil
|
17
17
|
end
|
18
18
|
|
19
19
|
it "takes precedence over other commands" do
|
20
20
|
allow(pager).to receive(:command_exists?).with('more') { true }
|
21
|
-
expect(pager.
|
21
|
+
expect(pager.find_executable('more')).to eql('more')
|
22
22
|
end
|
23
23
|
|
24
24
|
it "allows to query for available command" do
|
25
|
-
allow(pager).to receive(:
|
26
|
-
expect(pager.
|
25
|
+
allow(pager).to receive(:find_executable).with('less') { true }
|
26
|
+
expect(pager.exec_available?('less')).to eq(true)
|
27
27
|
end
|
28
28
|
|
29
29
|
context "when given nil, blank, and whitespace commands" do
|
@@ -32,7 +32,7 @@ RSpec.describe TTY::Pager::SystemPager, '#available' do
|
|
32
32
|
it "does not error" do
|
33
33
|
allow(pager).to receive(:executables).and_return(execs)
|
34
34
|
allow(pager).to receive(:command_exists?).with('less') { true }
|
35
|
-
expect(pager.
|
35
|
+
expect(pager.find_executable).to eql('less')
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -42,7 +42,7 @@ RSpec.describe TTY::Pager::SystemPager, '#available' do
|
|
42
42
|
it "finds the command" do
|
43
43
|
allow(pager).to receive(:executables).and_return(execs)
|
44
44
|
allow(pager).to receive(:command_exists?).with("diff-so-fancy") { true }
|
45
|
-
expect(pager.
|
45
|
+
expect(pager.find_executable).to eql(execs.first)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe TTY::Pager::SystemPager, '#new' do
|
2
2
|
it "raises error if system paging is not supported" do
|
3
|
-
allow(TTY::Pager::SystemPager).to receive(:
|
3
|
+
allow(TTY::Pager::SystemPager).to receive(:exec_available?).and_return(false)
|
4
4
|
expect {
|
5
5
|
TTY::Pager::SystemPager.new
|
6
6
|
}.to raise_error(TTY::Pager::Error, "TTY::Pager::SystemPager cannot be used on your system due to lack of appropriate pager executable. Install `less` like pager or try using `BasicPager` instead.")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe TTY::Pager::SystemPager, '.page' do
|
2
2
|
it "executes the pager command in a subprocess" do
|
3
3
|
text = "I try all things, I achieve what I can.\n"
|
4
|
-
allow(TTY::Pager::SystemPager).to receive(:
|
4
|
+
allow(TTY::Pager::SystemPager).to receive(:exec_available?).and_return(true)
|
5
5
|
output = double(:output, :tty? => true)
|
6
6
|
pager = described_class.new(output: output)
|
7
7
|
write_io = spy
|
data/tty-pager.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0.0'
|
22
22
|
|
23
|
-
spec.add_dependency 'tty-screen', '~> 0.6.
|
23
|
+
spec.add_dependency 'tty-screen', '~> 0.6.4'
|
24
24
|
spec.add_dependency 'tty-which', '~> 0.3.0'
|
25
|
-
spec.add_dependency '
|
25
|
+
spec.add_dependency 'strings', '~> 0.1.0'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
28
28
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-pager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.6.
|
19
|
+
version: 0.6.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.6.
|
26
|
+
version: 0.6.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tty-which
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: strings
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- Rakefile
|
120
120
|
- appveyor.yml
|
121
121
|
- examples/basic_pager.rb
|
122
|
+
- examples/pager.rb
|
122
123
|
- examples/system_pager.rb
|
123
124
|
- examples/temp.txt
|
124
125
|
- lib/tty-pager.rb
|
@@ -131,8 +132,9 @@ files:
|
|
131
132
|
- spec/unit/basic/page_spec.rb
|
132
133
|
- spec/unit/null/page_spec.rb
|
133
134
|
- spec/unit/page_spec.rb
|
134
|
-
- spec/unit/system/available_spec.rb
|
135
135
|
- spec/unit/system/command_exists_spec.rb
|
136
|
+
- spec/unit/system/executables_spec.rb
|
137
|
+
- spec/unit/system/find_executable_spec.rb
|
136
138
|
- spec/unit/system/new_spec.rb
|
137
139
|
- spec/unit/system/page_spec.rb
|
138
140
|
- tasks/console.rake
|
@@ -169,8 +171,8 @@ test_files:
|
|
169
171
|
- spec/unit/basic/page_spec.rb
|
170
172
|
- spec/unit/null/page_spec.rb
|
171
173
|
- spec/unit/page_spec.rb
|
172
|
-
- spec/unit/system/available_spec.rb
|
173
174
|
- spec/unit/system/command_exists_spec.rb
|
175
|
+
- spec/unit/system/executables_spec.rb
|
176
|
+
- spec/unit/system/find_executable_spec.rb
|
174
177
|
- spec/unit/system/new_spec.rb
|
175
178
|
- spec/unit/system/page_spec.rb
|
176
|
-
has_rdoc:
|