tty-screen 0.7.0 → 0.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71cc4336951dca9f56757e9c395ea8d041b42e6ff865b7a4f7272fe7b23c84d2
4
- data.tar.gz: 17eb2857e5d9cdf2f88fa95964fd823b8e852205866c5dada1a878f4b441a5cb
3
+ metadata.gz: ef837a96a0b6f7282a40e712920b73ffba5c9946899d13c0f1a9a74395b7c6fc
4
+ data.tar.gz: 3b58bc3f356329e71aeaf495e7b4dd0cfbe3390bd205d94791cc689abb224111
5
5
  SHA512:
6
- metadata.gz: 2c312cf2daabf31b388f3e8404f1a2db9d3ebe58561847d4ddc7030c40d7efed5fa304ae03fa48b14486aa6106f011c4f12f20cc1fb9a48ae7f737574ac0530c
7
- data.tar.gz: 1232a37433b71681a1838ff124988bc51aabb6e81538d21ee93eaa173bf0c3c2576fd62d1aa9d120fe8c7b6a26d2141511792dcd3c0096874dbbf496528fd5e1
6
+ metadata.gz: 5611619549f9eae4c34152768a263f999eb466106e36604ecc34c73934491f896942446efd31aa8e0229292738ad8feb9d7d7f8fd6d023c39267e9acdd26609f
7
+ data.tar.gz: 2a1129f3aa1c066271028c2da550aba4d267174b5e2354a6276a6c0a66acf926e83ba7cc89324cc842afaacdbd6036d6976815f644d6d0eb3a95c72fbed5c4e8
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.7.1] - 2020-02-02
4
+
5
+ ### Changed
6
+ * Change gemspec to add metadata, remove test artifacts and load version directly
7
+
3
8
  ## [v0.7.0] - 2019-05-19
4
9
 
5
10
  ### Changed
@@ -106,6 +111,7 @@
106
111
  ### Fixed
107
112
  * Fix bug with screen detection from_io_console by @luxflux
108
113
 
114
+ [v0.7.1]: https://github.com/piotrmurach/tty-screen/compare/v0.7.0...v0.7.1
109
115
  [v0.7.0]: https://github.com/piotrmurach/tty-screen/compare/v0.6.5...v0.7.0
110
116
  [v0.6.5]: https://github.com/piotrmurach/tty-screen/compare/v0.6.4...v0.6.5
111
117
  [v0.6.4]: https://github.com/piotrmurach/tty-screen/compare/v0.6.3...v0.6.4
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Screen
5
- VERSION = '0.7.0'.freeze
5
+ VERSION = "0.7.1"
6
6
  end # Screen
7
7
  end # TTY
metadata CHANGED
@@ -1,83 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-screen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-19 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 1.5.0
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 1.5.0
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '3.1'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '3.1'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
11
+ date: 2020-02-02 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description: Terminal screen size detection which works on Linux, OS X and Windows/Cygwin
56
14
  platforms and supports MRI, JRuby and Rubinius interpreters.
57
15
  email:
58
- - me@piotrmurach.com
16
+ - piotr@piotrmurach.com
59
17
  executables: []
60
18
  extensions: []
61
- extra_rdoc_files: []
19
+ extra_rdoc_files:
20
+ - README.md
21
+ - CHANGELOG.md
62
22
  files:
63
23
  - CHANGELOG.md
64
24
  - LICENSE.txt
65
25
  - README.md
66
- - Rakefile
67
26
  - lib/tty-screen.rb
68
27
  - lib/tty/screen.rb
69
28
  - lib/tty/screen/version.rb
70
- - spec/spec_helper.rb
71
- - spec/unit/height_width_spec.rb
72
- - spec/unit/size_spec.rb
73
- - tasks/console.rake
74
- - tasks/coverage.rake
75
- - tasks/spec.rake
76
- - tty-screen.gemspec
77
- homepage: https://piotrmurach.github.io/tty/
29
+ homepage: https://ttytoolkit.org
78
30
  licenses:
79
31
  - MIT
80
- metadata: {}
32
+ metadata:
33
+ allowed_push_host: https://rubygems.org
34
+ bug_tracker_uri: https://github.com/piotrmurach/tty-screen/issues
35
+ changelog_uri: https://github.com/piotrmurach/tty-screen/blob/master/CHANGELOG.md
36
+ documentation_uri: https://www.rubydoc.info/gems/tty-screen
37
+ homepage_uri: https://ttytoolkit.org
38
+ source_code_uri: https://github.com/piotrmurach/tty-screen
81
39
  post_install_message:
82
40
  rdoc_options: []
83
41
  require_paths:
@@ -93,12 +51,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
51
  - !ruby/object:Gem::Version
94
52
  version: '0'
95
53
  requirements: []
96
- rubygems_version: 3.0.3
54
+ rubygems_version: 3.1.2
97
55
  signing_key:
98
56
  specification_version: 4
99
57
  summary: Terminal screen size detection which works on Linux, OS X and Windows/Cygwin
100
58
  platforms and supports MRI, JRuby and Rubinius interpreters.
101
- test_files:
102
- - spec/spec_helper.rb
103
- - spec/unit/height_width_spec.rb
104
- - spec/unit/size_spec.rb
59
+ test_files: []
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,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if ENV['COVERAGE'] || ENV['TRAVIS']
4
- require 'simplecov'
5
- require 'coveralls'
6
-
7
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
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-screen'
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,31 +0,0 @@
1
- RSpec.describe TTY::Screen, '#height,#width' do
2
- it "calcualtes screen width" do
3
- allow(TTY::Screen).to receive(:size).and_return([51, 280])
4
- expect(TTY::Screen.width).to eq(280)
5
- end
6
-
7
- it "aliases width to columns" do
8
- allow(TTY::Screen).to receive(:size).and_return([51, 280])
9
- expect(TTY::Screen.columns).to eq(280)
10
- end
11
-
12
- it "aliases width to cols" do
13
- allow(TTY::Screen).to receive(:size).and_return([51, 280])
14
- expect(TTY::Screen.cols).to eq(280)
15
- end
16
-
17
- it "calcualtes screen height" do
18
- allow(TTY::Screen).to receive(:size).and_return([51, 280])
19
- expect(TTY::Screen.height).to eq(51)
20
- end
21
-
22
- it "aliases width to rows" do
23
- allow(TTY::Screen).to receive(:size).and_return([51, 280])
24
- expect(TTY::Screen.rows).to eq(51)
25
- end
26
-
27
- it "aliases width to lines" do
28
- allow(TTY::Screen).to receive(:size).and_return([51, 280])
29
- expect(TTY::Screen.lines).to eq(51)
30
- end
31
- end
@@ -1,224 +0,0 @@
1
- require 'delegate'
2
-
3
- RSpec.describe TTY::Screen, '#size' do
4
- class Output < SimpleDelegator
5
- def winsize
6
- [100, 200]
7
- end
8
-
9
- def ioctl(control, buf)
10
- buf.replace("3\x00\xD3\x00\xF2\x04\xCA\x02\x00")
11
- 0
12
- end
13
- end
14
-
15
- let(:output) { Output.new(StringIO.new('', 'w+')) }
16
-
17
- context 'size' do
18
- it "correctly falls through choices" do
19
- screen = TTY::Screen
20
- old_output = screen.output
21
- screen.output = output
22
-
23
- allow(screen).to receive(:size_from_java).and_return(nil)
24
- allow(screen).to receive(:size_from_win_api).and_return(nil)
25
- allow(screen).to receive(:size_from_ioctl).and_return(nil)
26
- allow(screen).to receive(:size_from_io_console).and_return([51, 280])
27
- allow(screen).to receive(:size_from_readline).and_return(nil)
28
-
29
- expect(screen.size).to eq([51, 280])
30
- expect(screen).to have_received(:size_from_java)
31
- expect(screen).to have_received(:size_from_win_api)
32
- expect(screen).to have_received(:size_from_ioctl)
33
- expect(screen).to_not have_received(:size_from_readline)
34
-
35
- screen.output = old_output
36
- end
37
- end
38
-
39
- context "size from java" do
40
- it "doesn't import java on non-jruby platform" do
41
- screen = TTY::Screen
42
- allow(screen).to receive(:jruby?).and_return(false)
43
- expect(screen.size_from_java).to eq(nil)
44
- end
45
-
46
- it "imports java library on jruby" do
47
- screen = TTY::Screen
48
- class << screen
49
- def java_import(*args); end
50
- end
51
- terminal = double(:terminal, get_height: 51, get_width: 211)
52
- factory = double(:factory, get: terminal)
53
- stub_const("TTY::Screen::TerminalFactory", factory)
54
-
55
- allow(screen).to receive(:jruby?).and_return(true)
56
- allow(screen).to receive(:require).with('java').and_return(true)
57
- allow(screen).to receive(:java_import)
58
-
59
- expect(screen.size_from_java).to eq([51, 211])
60
- end
61
- end
62
-
63
- context 'from io console' do
64
- it "doesn't calculate size if jruby " do
65
- screen = TTY::Screen
66
- allow(screen).to receive(:jruby?).and_return(true)
67
- expect(screen.size_from_io_console).to eq(nil)
68
- end
69
-
70
- it "calcualtes the size" do
71
- screen = TTY::Screen
72
- old_output = screen.output
73
- screen.output = output
74
-
75
- allow(screen).to receive(:jruby?).and_return(false)
76
- allow(screen).to receive(:require).with('io/console').
77
- and_return(true)
78
- allow(output).to receive(:tty?).and_return(true)
79
- allow(IO).to receive(:method_defined?).with(:winsize).and_return(true)
80
- allow(output).to receive(:winsize).and_return([100, 200])
81
-
82
- expect(screen.size_from_io_console).to eq([100, 200])
83
- expect(output).to have_received(:winsize)
84
-
85
- screen.output = old_output
86
- end
87
-
88
- it "doesn't calculate size if io/console not available" do
89
- screen = TTY::Screen
90
- allow(screen).to receive(:jruby?).and_return(false)
91
- allow(screen).to receive(:require).with('io/console').
92
- and_raise(LoadError)
93
- expect(screen.size_from_io_console).to eq(nil)
94
- end
95
-
96
- it "doesn't calculate size if it is run without a console" do
97
- screen = TTY::Screen
98
- allow(screen).to receive(:jruby?).and_return(false)
99
- allow(screen).to receive(:require).with('io/console').
100
- and_return(true)
101
- allow(screen.output).to receive(:tty?).and_return(true)
102
- allow(IO).to receive(:method_defined?).with(:winsize).and_return(false)
103
- expect(screen.size_from_io_console).to eq(nil)
104
- end
105
- end
106
-
107
- context "from ioctl" do
108
- it "reads terminal size" do
109
- screen = TTY::Screen
110
- old_output = screen.output
111
- screen.output = output
112
- allow(screen).to receive(:jruby?).and_return(false)
113
- expect(screen.size_from_ioctl).to eq([51, 211])
114
- screen.output = old_output
115
- end
116
-
117
- it "skips reading on jruby" do
118
- allow(TTY::Screen).to receive(:jruby?).and_return(true)
119
- expect(TTY::Screen.size_from_ioctl).to eq(nil)
120
- end
121
- end
122
-
123
- context 'from tput' do
124
- it "doesn't run command if outside of terminal" do
125
- allow(TTY::Screen.output).to receive(:tty?).and_return(false)
126
- expect(TTY::Screen.size_from_tput).to eq(nil)
127
- end
128
-
129
- it "runs tput commands" do
130
- screen = TTY::Screen
131
- allow(screen.output).to receive(:tty?).and_return(true)
132
- allow(screen).to receive(:run_command).with('tput', 'lines').and_return(51)
133
- allow(screen).to receive(:run_command).with('tput', 'cols').and_return(280)
134
- expect(screen.size_from_tput).to eq([51, 280])
135
- end
136
-
137
- it "doesn't return zero size" do
138
- screen = TTY::Screen
139
- allow(screen.output).to receive(:tty?).and_return(true)
140
- allow(screen).to receive(:run_command).with('tput', 'lines').and_return(0)
141
- allow(screen).to receive(:run_command).with('tput', 'cols').and_return(0)
142
- expect(screen.size_from_tput).to eq(nil)
143
- end
144
- end
145
-
146
- context 'size from stty' do
147
- it "doesn't run command if outside of terminal" do
148
- allow(TTY::Screen.output).to receive(:tty?).and_return(false)
149
- expect(TTY::Screen.size_from_stty).to eq(nil)
150
- end
151
-
152
- it "runs stty commands" do
153
- screen = TTY::Screen
154
- allow(screen.output).to receive(:tty?).and_return(true)
155
- allow(screen).to receive(:run_command).with('stty', 'size').and_return("51 280")
156
- expect(screen.size_from_stty).to eq([51, 280])
157
- end
158
-
159
- it "doesn't return zero size" do
160
- screen = TTY::Screen
161
- allow(screen.output).to receive(:tty?).and_return(true)
162
- allow(screen).to receive(:run_command).with('stty', 'size').and_return("0 0")
163
- expect(screen.size_from_stty).to eq(nil)
164
- end
165
- end
166
-
167
- context 'size from env' do
168
- it "doesn't calculate size without COLUMNS key" do
169
- screen = TTY::Screen
170
- old_env = screen.env
171
- screen.env = {'COLUMNS' => nil}
172
- expect(screen.size_from_env).to eq(nil)
173
- screen.env = old_env
174
- end
175
-
176
- it "extracts lines and columns from environment" do
177
- screen = TTY::Screen
178
- old_env = screen.env
179
- screen.env = {'COLUMNS' => '280', 'LINES' => '51'}
180
- expect(screen.size_from_env).to eq([51, 280])
181
- screen.env = old_env
182
- end
183
-
184
- it "doesn't return zero size" do
185
- screen = TTY::Screen
186
- old_env = screen.env
187
- screen.env = {'COLUMNS' => '0', 'LINES' => '0'}
188
- expect(screen.size_from_env).to eq(nil)
189
- screen.env = old_env
190
- end
191
- end
192
-
193
- context 'from ansicon' do
194
- it "doesn't calculate size without ANSICON key" do
195
- screen = TTY::Screen
196
- old_env = screen.env
197
- screen.env = {'ANSICON' => nil}
198
- expect(screen.size_from_ansicon).to eq(nil)
199
- screen.env = old_env
200
- end
201
-
202
- it "extracts lines and columns from environment" do
203
- screen = TTY::Screen
204
- old_env = screen.env
205
- screen.env = {'ANSICON' => '(280x51)'}
206
- expect(screen.size_from_ansicon).to eq([51, 280])
207
- screen.env = old_env
208
- end
209
-
210
- it "doesn't return zero size" do
211
- screen = TTY::Screen
212
- old_env = screen.env
213
- screen.env = {'ANSICON' => '(0x0)'}
214
- expect(screen.size_from_ansicon).to eq(nil)
215
- screen.env = old_env
216
- end
217
- end
218
-
219
- context 'default size' do
220
- it "suggests default terminal size" do
221
- expect(TTY::Screen::DEFAULT_SIZE).to eq([27, 80])
222
- end
223
- end
224
- 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_relative '../lib/tty-screen'
8
- ARGV.clear
9
- IRB.start
10
- end
11
- task :c => :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,27 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'tty/screen/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'tty-screen'
7
- spec.version = TTY::Screen::VERSION
8
- spec.authors = ["Piotr Murach"]
9
- spec.email = ["me@piotrmurach.com"]
10
- spec.summary = %q{Terminal screen size detection which works on Linux, OS X and Windows/Cygwin platforms and supports MRI, JRuby and Rubinius interpreters.}
11
- spec.description = %q{Terminal screen size detection which works on Linux, OS X and Windows/Cygwin platforms and supports MRI, JRuby and Rubinius interpreters.}
12
- spec.homepage = "https://piotrmurach.github.io/tty/"
13
- spec.license = "MIT"
14
-
15
- spec.files = Dir['{lib,spec}/**/*.rb']
16
- spec.files += Dir['tasks/*', 'tty-screen.gemspec']
17
- spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(spec)/})
20
- spec.require_paths = ["lib"]
21
-
22
- spec.required_ruby_version = '>= 2.0.0'
23
-
24
- spec.add_development_dependency 'bundler', '>= 1.5.0'
25
- spec.add_development_dependency 'rspec', '~> 3.1'
26
- spec.add_development_dependency 'rake'
27
- end