terminal-size 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -1
- data/Gemfile.lock +5 -5
- data/lib/terminal-size.rb +2 -2
- data/terminal-size.gemspec +10 -9
- data/test/terminal-size_test.rb +6 -4
- metadata +2 -2
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
terminal-size (0.0.
|
13
|
+
terminal-size (0.0.5)
|
14
14
|
|
15
15
|
GEM
|
16
16
|
remote: http://rubygems.org/
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
debugger-ruby_core_source (1.1.6)
|
35
35
|
diff-lcs (1.1.3)
|
36
36
|
diffy (2.1.3)
|
37
|
-
ffi (1.
|
37
|
+
ffi (1.3.0)
|
38
38
|
grit (2.5.0)
|
39
39
|
diff-lcs (~> 1.1)
|
40
40
|
mime-types (~> 1.15)
|
@@ -47,7 +47,7 @@ GEM
|
|
47
47
|
guard-bundler (1.0.0)
|
48
48
|
bundler (~> 1.0)
|
49
49
|
guard (~> 1.1)
|
50
|
-
guard-spork (1.4.
|
50
|
+
guard-spork (1.4.1)
|
51
51
|
childprocess (>= 0.2.3)
|
52
52
|
guard (>= 1.1)
|
53
53
|
spork (>= 0.8.4)
|
@@ -65,7 +65,7 @@ GEM
|
|
65
65
|
lumberjack (1.0.2)
|
66
66
|
method_source (0.8.1)
|
67
67
|
mime-types (1.19)
|
68
|
-
minitest (4.
|
68
|
+
minitest (4.4.0)
|
69
69
|
nokogiri (1.5.6)
|
70
70
|
posix-spawn (0.3.6)
|
71
71
|
pry-awesome_print (9.6.5)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
pry-doc (0.4.4)
|
82
82
|
pry (>= 0.9.9.6)
|
83
83
|
yard (~> 0.8.1)
|
84
|
-
pry-docmore (0.0.
|
84
|
+
pry-docmore (0.0.4)
|
85
85
|
pry
|
86
86
|
pry-doc
|
87
87
|
pry-editline (1.1.1)
|
data/lib/terminal-size.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Terminal
|
2
|
-
class Size; VERSION = '0.0.
|
2
|
+
class Size; VERSION = '0.0.6' end
|
3
3
|
class << self
|
4
4
|
def size
|
5
5
|
size_via_low_level_ioctl or size_via_stty or nil
|
@@ -48,7 +48,7 @@ class Terminal
|
|
48
48
|
|
49
49
|
private
|
50
50
|
def _height_width_hash_from *dimensions
|
51
|
-
{ height
|
51
|
+
{ :height => dimensions[0], :width => dimensions[1] }
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
data/terminal-size.gemspec
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
require 'working/gemspec'
|
3
3
|
require 'terminal-size'
|
4
4
|
|
5
|
-
Working.gemspec
|
6
|
-
name
|
7
|
-
summary
|
8
|
-
description
|
9
|
-
version
|
10
|
-
authors
|
11
|
-
email
|
12
|
-
github
|
13
|
-
deps
|
5
|
+
Working.gemspec(
|
6
|
+
:name => 'terminal-size',
|
7
|
+
:summary => Working.third_line_of_readme,
|
8
|
+
:description => Working.readme_snippet(/== Usage/, /== Bonus Contract/),
|
9
|
+
:version => Terminal::Size::VERSION,
|
10
|
+
:authors => %w(☈king Norrin),
|
11
|
+
:email => 'rking-terminal-size@sharpsaw.org',
|
12
|
+
:github => 'rking/terminal-size',
|
13
|
+
:deps => []
|
14
|
+
)
|
data/test/terminal-size_test.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require './test/test_helper'
|
2
2
|
require 'terminal-size'
|
3
3
|
class TerminalTest < MiniTest::Unit::TestCase
|
4
|
-
DEFAULT_SIZE = {width
|
4
|
+
DEFAULT_SIZE = {:width => 80, :height => 25}
|
5
5
|
def test_simulating_windows
|
6
6
|
class << $stdout
|
7
7
|
alias_method :actual_respond_to?, :respond_to?
|
8
8
|
end
|
9
9
|
brb_path = ENV['PATH']
|
10
|
-
|
10
|
+
fake_respond_to = lambda {|m| :ioctl != m and actual_respond_to m }
|
11
|
+
$stdin.stub :respond_to?, fake_respond_to do
|
11
12
|
refute Terminal.size_via_low_level_ioctl
|
12
13
|
ENV['PATH'] = ''
|
13
14
|
refute Terminal.size_via_stty
|
@@ -24,8 +25,9 @@ class TerminalTest < MiniTest::Unit::TestCase
|
|
24
25
|
refute_equal \
|
25
26
|
Terminal.tiocgwinsz_value_for('linux'),
|
26
27
|
Terminal.tiocgwinsz_value_for('darwin')
|
27
|
-
expected = {width
|
28
|
-
|
28
|
+
expected = {:width => 133, :height => 80}
|
29
|
+
fake_ioctl = lambda {|num, buf| buf.replace FAKE_IOCTL_RESULT; 0 }
|
30
|
+
$stdout.stub :ioctl, fake_ioctl do
|
29
31
|
assert_equal expected, Terminal.size_via_low_level_ioctl
|
30
32
|
end
|
31
33
|
Terminal.stub :`, '80 133' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal-size
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-01-
|
13
|
+
date: 2013-01-09 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: ! "A tiny gem to accomplish a simple task: Determining the terminal size.\n\n==
|
16
16
|
Usage\n\n p Terminal.size # ⇒ {height: 90, width: 161}\n p Terminal.size!
|