tty-pager 0.9.0 → 0.13.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,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --warnings
@@ -1,25 +0,0 @@
1
- ---
2
- language: ruby
3
- sudo: false
4
- cache: bundler
5
- bundler_args: --without yard benchmarks
6
- script: "bundle exec rake ci"
7
- rvm:
8
- - 1.9.3
9
- - 2.0.0
10
- - 2.1.10
11
- - 2.2.6
12
- - 2.3.3
13
- - 2.4.1
14
- - ruby-head
15
- - jruby-9.1.5.0
16
- - jruby-head
17
- matrix:
18
- allow_failures:
19
- - rvm: ruby-head
20
- - rvm: jruby-head
21
- fast_finish: true
22
- branches:
23
- only: master
24
- notifications:
25
- email: false
@@ -1,49 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at [email]. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'yard', '~> 0.8.7'
7
- end
8
-
9
- group :metrics do
10
- gem 'coveralls', '~> 0.8.1'
11
- gem 'simplecov', '~> 0.10.0'
12
- gem 'yardstick', '~> 0.9.9'
13
- gem 'term-ansicolor', '=1.3.2'
14
- end
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # coding: 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 ]
@@ -1,25 +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: "193"
13
- - ruby_version: "200"
14
- - ruby_version: "200-x64"
15
- - ruby_version: "21"
16
- - ruby_version: "21-x64"
17
- - ruby_version: "22"
18
- - ruby_version: "22-x64"
19
- - ruby_version: "23"
20
- - ruby_version: "23-x64"
21
- - ruby_version: "24"
22
- - ruby_version: "24-x64"
23
- matrix:
24
- allow_failures:
25
- - ruby_version: "193"
@@ -1,7 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'tty-pager'
4
-
5
- pager = TTY::Pager::BasicPager.new(width: 80)
6
- file = File.join(File.dirname(__FILE__), 'temp.txt')
7
- pager.page(File.read(file))
@@ -1,9 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'tty-pager'
4
-
5
- ENV['PAGER']='less'
6
-
7
- pager = TTY::Pager::SystemPager.new
8
- file = File.join(File.dirname(__FILE__), 'temp.txt')
9
- pager.page(File.read(file))
@@ -1,49 +0,0 @@
1
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
2
-
3
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
4
-
5
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
6
-
7
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
8
-
9
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
10
-
11
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
12
-
13
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
14
-
15
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
16
-
17
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
18
-
19
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
20
-
21
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
22
-
23
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
24
-
25
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
26
-
27
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
28
-
29
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
30
-
31
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
32
-
33
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
34
-
35
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
36
-
37
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
38
-
39
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
40
-
41
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
42
-
43
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
44
-
45
- Consider the subtleness of the sea; how its most dreaded creatures glide under water, unapparent for the most part, and treacherously hidden beneath the loveliest tints of azure. Consider also the devilish brilliance and beauty of many of its most remorseless tribes, as the dainty embellished shape of many species of sharks. Consider, once more, the universal cannibalism of the sea; all whose creatures prey upon each other, carrying on eternal war since the world began.
46
-
47
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
48
-
49
- Consider all this; and then turn to the green, gentle, and most docile earth; consider them both, the sea and the land; and do you not find a strange analogy to something in yourself? For as this appalling ocean surrounds the verdant land, so in the soul of man there lies one insular Tahiti, full of peace and joy, but encompassed by all the horrors of the half-known life. God keep thee! Push not off from that isle, thou canst never return!
@@ -1,45 +0,0 @@
1
- # coding: utf-8
2
-
3
- if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
4
- require 'simplecov'
5
- require 'coveralls'
6
-
7
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
8
- SimpleCov::Formatter::HTMLFormatter,
9
- Coveralls::SimpleCov::Formatter
10
- ]
11
-
12
- SimpleCov.start do
13
- command_name 'spec'
14
- add_filter 'spec'
15
- end
16
- end
17
-
18
- require 'tty-pager'
19
-
20
- RSpec.configure do |config|
21
- config.expect_with :rspec do |expectations|
22
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
23
- end
24
-
25
- config.mock_with :rspec do |mocks|
26
- mocks.verify_partial_doubles = true
27
- end
28
-
29
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
30
- config.disable_monkey_patching!
31
-
32
- # This setting enables warnings. It's recommended, but in some cases may
33
- # be too noisy due to issues in dependencies.
34
- config.warnings = true
35
-
36
- if config.files_to_run.one?
37
- config.default_formatter = 'doc'
38
- end
39
-
40
- config.profile_examples = 2
41
-
42
- config.order = :random
43
-
44
- Kernel.srand config.seed
45
- end
@@ -1,142 +0,0 @@
1
- # coding: utf-8
2
-
3
- RSpec.describe TTY::Pager::BasicPager, '.page' do
4
- let(:input) { StringIO.new }
5
- let(:output) { StringIO.new }
6
-
7
- it "doesn't paginate empty string" do
8
- pager = described_class.new(output: output, input: input)
9
- pager.page("")
10
- expect(output.string).to eq("")
11
- end
12
-
13
- it "doesn't paginate text that fits on screen" do
14
- text = "I try all things, I achieve what I can.\n"
15
- pager = described_class.new(output: output, width: 100, height: 10)
16
- pager.page(text)
17
- expect(output.string).to eq(text)
18
- end
19
-
20
- it "breaks text exceeding terminal width" do
21
- text = ""
22
- text << "It is not down on any map; true places never are.\n"
23
- input << "\n"
24
- input.rewind
25
- pager = described_class.new(output: output, input: input,
26
- width: 10, height: 6)
27
- pager.page(text)
28
- expect(output.string).to eq([
29
- "It is not ",
30
- "down on ",
31
- "any map; ",
32
- "true ",
33
- "",
34
- "--- Page ",
35
- "-1- Press ",
36
- "e",
37
- "nter/retur",
38
- "n to ",
39
- "continue ",
40
- "(or q to ",
41
- "quit) ---",
42
- "places ",
43
- "never are.\n"
44
- ].join("\n"))
45
- end
46
-
47
- it "continues paging when enter is pressed" do
48
- text = ""
49
- 10.times { text << "I try all things, I achieve what I can.\n"}
50
- input << "\n\n\n"
51
- input.rewind
52
- pager = described_class.new(output: output, input: input,
53
- width: 100, height: 5)
54
- pager.page(text)
55
- expect(output.string).to eq([
56
- "I try all things, I achieve what I can.",
57
- "I try all things, I achieve what I can.",
58
- "I try all things, I achieve what I can.",
59
- "",
60
- "--- Page -1- Press enter/return to continue (or q to quit) ---",
61
- "I try all things, I achieve what I can.",
62
- "I try all things, I achieve what I can.",
63
- "I try all things, I achieve what I can.",
64
- "",
65
- "--- Page -2- Press enter/return to continue (or q to quit) ---",
66
- "I try all things, I achieve what I can.",
67
- "I try all things, I achieve what I can.",
68
- "I try all things, I achieve what I can.",
69
- "",
70
- "--- Page -3- Press enter/return to continue (or q to quit) ---",
71
- "I try all things, I achieve what I can.\n"
72
- ].join("\n"))
73
- end
74
-
75
- it "stops paging when q is pressed" do
76
- text = ""
77
- 10.times { text << "I try all things, I achieve what I can.\n"}
78
- input << "\nq\n"
79
- input.rewind
80
- pager = described_class.new(output: output, input: input,
81
- width: 100, height: 5)
82
- pager.page(text)
83
- expect(output.string).to eq([
84
- "I try all things, I achieve what I can.",
85
- "I try all things, I achieve what I can.",
86
- "I try all things, I achieve what I can.",
87
- "",
88
- "--- Page -1- Press enter/return to continue (or q to quit) ---",
89
- "I try all things, I achieve what I can.",
90
- "I try all things, I achieve what I can.",
91
- "I try all things, I achieve what I can.",
92
- "",
93
- "--- Page -2- Press enter/return to continue (or q to quit) ---\n",
94
- ].join("\n"))
95
- end
96
-
97
- it "allows to change paging prompt" do
98
- text = ""
99
- 5.times { text << "I try all things, I achieve what I can.\n"}
100
- input << "\nq\n"
101
- input.rewind
102
- prompt = proc { |num| output.puts "Page -#{num}-" }
103
- pager = described_class.new(output: output, input: input,
104
- width: 100, height: 5, prompt: prompt)
105
- pager.page(text)
106
- expect(output.string).to eq([
107
- "I try all things, I achieve what I can.",
108
- "I try all things, I achieve what I can.",
109
- "I try all things, I achieve what I can.",
110
- "Page -1-",
111
- "I try all things, I achieve what I can.",
112
- "I try all things, I achieve what I can.\n",
113
- ].join("\n"))
114
- end
115
-
116
- it "preserves new lines when breaking" do
117
- text = "a\na\na\na\na\na\na\na\na\na"
118
- input << "\n\n\n"
119
- input.rewind
120
- pager = described_class.new(output: output, input: input,
121
- width: 80, height: 5)
122
- pager.page(text)
123
- expect(output.string).to eq([
124
- "a",
125
- "a",
126
- "a",
127
- "",
128
- "--- Page -1- Press enter/return to continue (or q to quit) ---",
129
- "a",
130
- "a",
131
- "a",
132
- "",
133
- "--- Page -2- Press enter/return to continue (or q to quit) ---",
134
- "a",
135
- "a",
136
- "a",
137
- "",
138
- "--- Page -3- Press enter/return to continue (or q to quit) ---",
139
- "a"
140
- ].join("\n"))
141
- end
142
- end
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
-
3
- RSpec.describe TTY::Pager::NullPager, '.page' do
4
- let(:output) { StringIO.new }
5
-
6
- it "prints content to stdout when tty device" do
7
- allow(output).to receive(:tty?).and_return(true)
8
- pager = described_class.new(output: output)
9
- text = "I try all things, I achieve what I can.\n"
10
-
11
- pager.page(text)
12
-
13
- expect(output.string).to eq(text)
14
- end
15
-
16
- it "returns text when non-tty device" do
17
- pager = described_class.new(output: output)
18
- text = "I try all things, I achieve what I can.\n"
19
-
20
- expect(pager.page(text)).to eq(text)
21
- expect(output.string).to eq('')
22
- end
23
- end
@@ -1,40 +0,0 @@
1
- # coding: utf-8
2
-
3
- RSpec.describe TTY::Pager, '.page' do
4
- let(:output) { StringIO.new }
5
-
6
- it "selects null pager when disabled" do
7
- null_pager = spy(:null_pager)
8
- allow(TTY::Pager::NullPager).to receive(:new) { null_pager }
9
-
10
- pager = described_class.new(enabled: false)
11
- text = "I try all things, I achieve what I can.\n"
12
- pager.page(text)
13
-
14
- expect(TTY::Pager::NullPager).to have_received(:new)
15
- end
16
-
17
- it "selects BasicPager when no paging command is available" do
18
- basic_pager = spy(:basic_pager)
19
- allow(TTY::Pager::SystemPager).to receive(:available?) { false }
20
- allow(TTY::Pager::BasicPager).to receive(:new) { basic_pager }
21
-
22
- pager = described_class.new
23
- text = "I try all things, I achieve what I can.\n"
24
- pager.page(text)
25
-
26
- expect(basic_pager).to have_received(:page).with(text)
27
- end
28
-
29
- it "selects SystemPager when paging command is available" do
30
- system_pager = spy(:system_pager)
31
- allow(TTY::Pager::SystemPager).to receive(:available?) { true }
32
- allow(TTY::Pager::SystemPager).to receive(:new) { system_pager }
33
-
34
- pager = described_class.new
35
- text = "I try all things, I achieve what I can.\n"
36
- pager.page(text)
37
-
38
- expect(system_pager).to have_received(:page).with(text)
39
- end
40
- end