terminal-size 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +2 -4
- data/Gemfile.lock +36 -36
- data/Guardfile +1 -0
- data/{README.md → README.rdoc} +9 -5
- data/Rakefile +1 -5
- data/lib/terminal-size.rb +7 -11
- data/terminal-size.gemspec +10 -13
- data/test/terminal-size_test.rb +1 -2
- data/test/test_helper.rb +2 -28
- metadata +10 -7
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
GIT
|
2
|
-
remote: git://github.com/
|
3
|
-
revision:
|
4
|
-
branch: feature/kill-pry-rescue
|
2
|
+
remote: git://github.com/pry/pry.git
|
3
|
+
revision: 92fe82dbd6c6866d8ad107fb031d16c2f307148c
|
5
4
|
specs:
|
6
|
-
pry
|
7
|
-
|
8
|
-
|
5
|
+
pry (0.9.11)
|
6
|
+
coderay (~> 1.0.5)
|
7
|
+
method_source (~> 0.8)
|
8
|
+
slop (~> 3.3.1)
|
9
|
+
|
10
|
+
PATH
|
11
|
+
remote: .
|
12
|
+
specs:
|
13
|
+
terminal-size (0.0.1)
|
9
14
|
|
10
15
|
GEM
|
11
16
|
remote: http://rubygems.org/
|
@@ -28,8 +33,7 @@ GEM
|
|
28
33
|
debugger-ruby_core_source (>= 1.1.1)
|
29
34
|
debugger-ruby_core_source (1.1.6)
|
30
35
|
diff-lcs (1.1.3)
|
31
|
-
diffy (2.1.
|
32
|
-
eventmachine (1.0.0)
|
36
|
+
diffy (2.1.3)
|
33
37
|
ffi (1.2.0)
|
34
38
|
grit (2.5.0)
|
35
39
|
diff-lcs (~> 1.1)
|
@@ -47,28 +51,23 @@ GEM
|
|
47
51
|
childprocess (>= 0.2.3)
|
48
52
|
guard (>= 1.1)
|
49
53
|
spork (>= 0.8.4)
|
50
|
-
guard-sporkminitest (0.0.
|
54
|
+
guard-sporkminitest (0.0.2)
|
51
55
|
guard
|
52
56
|
guard-spork
|
53
57
|
rb-fsevent
|
54
58
|
rb-inotify
|
55
59
|
spork-minitest
|
56
|
-
highline (1.6.15)
|
57
60
|
interception (0.3)
|
58
|
-
jist (1.
|
61
|
+
jist (1.4.0)
|
59
62
|
json
|
60
|
-
json (1.7.
|
61
|
-
listen (0.
|
63
|
+
json (1.7.6)
|
64
|
+
listen (0.7.1)
|
62
65
|
lumberjack (1.0.2)
|
63
66
|
method_source (0.8.1)
|
64
67
|
mime-types (1.19)
|
65
68
|
minitest (4.3.3)
|
66
69
|
nokogiri (1.5.6)
|
67
70
|
posix-spawn (0.3.6)
|
68
|
-
pry (0.9.10)
|
69
|
-
coderay (~> 1.0.5)
|
70
|
-
method_source (~> 0.8)
|
71
|
-
slop (~> 3.3.1)
|
72
71
|
pry-awesome_print (9.6.5)
|
73
72
|
awesome_print (~> 1.1.0)
|
74
73
|
pry-de (0.1.0)
|
@@ -86,24 +85,16 @@ GEM
|
|
86
85
|
pry
|
87
86
|
pry-doc
|
88
87
|
pry-editline (1.1.1)
|
89
|
-
pry-exception_explorer (0.
|
90
|
-
pry-stack_explorer (>= 0.
|
91
|
-
pry-full (1.0)
|
92
|
-
bond
|
93
|
-
jist
|
88
|
+
pry-exception_explorer (0.2.3)
|
89
|
+
pry-stack_explorer (>= 0.4.6)
|
90
|
+
pry-full (1.2.0)
|
94
91
|
pry-awesome_print
|
95
|
-
pry-debugger
|
96
92
|
pry-developer_tools
|
97
|
-
pry-doc
|
98
|
-
pry-docmore
|
99
93
|
pry-editline
|
100
|
-
pry-exception_explorer (= 0.1.9)
|
101
94
|
pry-git
|
102
95
|
pry-highlight
|
96
|
+
pry-plus
|
103
97
|
pry-pretty-numeric
|
104
|
-
pry-remote-em
|
105
|
-
pry-rescue
|
106
|
-
pry-stack_explorer
|
107
98
|
pry-syntax-hacks
|
108
99
|
pry-theme
|
109
100
|
pry-git (0.2.3)
|
@@ -115,12 +106,20 @@ GEM
|
|
115
106
|
json
|
116
107
|
nokogiri
|
117
108
|
pry
|
109
|
+
pry-plus (0.2.0)
|
110
|
+
bond
|
111
|
+
jist
|
112
|
+
pry-debugger
|
113
|
+
pry-doc
|
114
|
+
pry-docmore
|
115
|
+
pry-exception_explorer
|
116
|
+
pry-rescue
|
117
|
+
pry-stack_explorer
|
118
118
|
pry-pretty-numeric (0.1.1)
|
119
119
|
pry
|
120
|
-
pry-
|
121
|
-
|
122
|
-
|
123
|
-
pry (~> 0.9)
|
120
|
+
pry-rescue (0.15)
|
121
|
+
interception (>= 0.3)
|
122
|
+
pry
|
124
123
|
pry-stack_explorer (0.4.7)
|
125
124
|
binding_of_caller (~> 0.6.8)
|
126
125
|
pry-syntax-hacks (0.0.6)
|
@@ -128,7 +127,7 @@ GEM
|
|
128
127
|
pry-theme (0.1.3)
|
129
128
|
json
|
130
129
|
rake (10.0.3)
|
131
|
-
rb-fsevent (0.9.
|
130
|
+
rb-fsevent (0.9.3)
|
132
131
|
rb-inotify (0.8.8)
|
133
132
|
ffi (>= 0.5.0)
|
134
133
|
slop (3.3.3)
|
@@ -138,7 +137,7 @@ GEM
|
|
138
137
|
thor (0.16.0)
|
139
138
|
turn (0.9.6)
|
140
139
|
ansi
|
141
|
-
working (0.0.
|
140
|
+
working (0.0.8)
|
142
141
|
beg
|
143
142
|
guard-bundler
|
144
143
|
guard-sporkminitest
|
@@ -152,5 +151,6 @@ PLATFORMS
|
|
152
151
|
ruby
|
153
152
|
|
154
153
|
DEPENDENCIES
|
155
|
-
pry
|
154
|
+
pry!
|
155
|
+
terminal-size!
|
156
156
|
working
|
data/Guardfile
CHANGED
data/{README.md → README.rdoc}
RENAMED
@@ -1,7 +1,14 @@
|
|
1
|
-
|
1
|
+
= Terminal.size
|
2
2
|
|
3
3
|
A tiny gem to accomplish a simple task: Determining the terminal size.
|
4
4
|
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
p Terminal.size # ⇒ {height: 90, width: 161}
|
8
|
+
p Terminal.size! # to get 80×25 as a fallback instead of nil
|
9
|
+
|
10
|
+
== Bonus Contract
|
11
|
+
|
5
12
|
One of the guarantees of this project is that it will always be exactly one
|
6
13
|
file: `lib/terminal-size/terminal.rb`
|
7
14
|
|
@@ -11,7 +18,7 @@ not-easily-updated Copy & Paste). I'm kicking around the idea of using this as
|
|
11
18
|
an example of an automatic, namespaced fat-pack trick, but we'll see if that's
|
12
19
|
really necessary.
|
13
20
|
|
14
|
-
|
21
|
+
== Installation
|
15
22
|
|
16
23
|
Add this line to your application's Gemfile:
|
17
24
|
|
@@ -25,6 +32,3 @@ Or install it yourself as:
|
|
25
32
|
|
26
33
|
$ gem install terminal-size
|
27
34
|
|
28
|
-
## Usage
|
29
|
-
|
30
|
-
p Terminal.size
|
data/Rakefile
CHANGED
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.2' end
|
3
3
|
class << self
|
4
4
|
def size
|
5
5
|
size_via_low_level_ioctl or size_via_stty or nil
|
@@ -30,17 +30,13 @@ class Terminal
|
|
30
30
|
nil
|
31
31
|
end
|
32
32
|
|
33
|
-
# This is as reported by <sys/ioctl.h>
|
34
|
-
# Hard-coding because it seems like overkll to acutally involve C for this.
|
35
|
-
TIOCGWINSZ = {
|
36
|
-
/linux/ => 0x5413,
|
37
|
-
/darwin/ => 0x40087468, # thanks to brandon@brandon.io for the lookup!
|
38
|
-
}
|
39
33
|
def tiocgwinsz_value_for platform
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
# This is as reported by <sys/ioctl.h>
|
35
|
+
# Hard-coding because it seems like overkll to acutally involve C for this.
|
36
|
+
{
|
37
|
+
/linux/ => 0x5413,
|
38
|
+
/darwin/ => 0x40087468, # thanks to brandon@brandon.io for the lookup!
|
39
|
+
}.find{|k,v| platform[k]}
|
44
40
|
end
|
45
41
|
|
46
42
|
def size_via_stty
|
data/terminal-size.gemspec
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
require 'working/gemspec'
|
3
3
|
require 'terminal-size'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
-
end
|
4
|
+
Working.gemspec \
|
5
|
+
name: 'terminal-size',
|
6
|
+
summary: Working.third_line_of_readme,
|
7
|
+
description: Working.readme_snippet(/== Usage/, /== Installation/),
|
8
|
+
version: Terminal::Size::VERSION,
|
9
|
+
authors: %w(☈king Norrin),
|
10
|
+
email: 'rking-terminal-size@sharpsaw.org',
|
11
|
+
github: 'rking/terminal-size',
|
12
|
+
deps: []
|
data/test/terminal-size_test.rb
CHANGED
@@ -34,8 +34,7 @@ class TerminalTest < MiniTest::Unit::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_integration_using_tmux
|
37
|
-
|
38
|
-
unless ENV['TMUX']
|
37
|
+
return warn "\nSKIP: integration test requires tmux" unless ENV['TMUX']
|
39
38
|
# TODO: figure out how to get this to work if not already in a horizontal
|
40
39
|
# split, e.g.:
|
41
40
|
# system 'tmux split-window -h'
|
data/test/test_helper.rb
CHANGED
@@ -1,28 +1,2 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# require File.expand_path('../../config/environment', __FILE_)
|
4
|
-
# def reload!
|
5
|
-
# puts "[Performing .reload!]"
|
6
|
-
# ActionDispatch::Reloader.cleanup!
|
7
|
-
# ActionDispatch::Reloader.prepare!
|
8
|
-
# end
|
9
|
-
|
10
|
-
require 'spork'
|
11
|
-
require 'minitest/autorun'
|
12
|
-
require 'pry-rescue/minitest'
|
13
|
-
$:.unshift './lib'
|
14
|
-
|
15
|
-
require 'turn'
|
16
|
-
Turn.config do |c|
|
17
|
-
c.format = :pretty
|
18
|
-
end
|
19
|
-
|
20
|
-
puts "[test_helper.rb toplevel running]"
|
21
|
-
Spork.prefork do
|
22
|
-
puts "[Spork.prefork running]"
|
23
|
-
end
|
24
|
-
Spork.each_run do
|
25
|
-
puts "[Spork.each_run running]"
|
26
|
-
# TODO: verify that this helps (Rails)
|
27
|
-
# reload!
|
28
|
-
end
|
1
|
+
require 'working/test_helper'
|
2
|
+
# Spork.prefork doesn't like when this is missing
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,22 +10,25 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-01-07 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
|
-
description: ! '
|
16
|
-
|
17
|
-
|
15
|
+
description: ! '== Usage
|
16
|
+
|
17
|
+
'
|
18
|
+
email: rking-terminal-size@sharpsaw.org
|
18
19
|
executables: []
|
19
20
|
extensions: []
|
20
21
|
extra_rdoc_files: []
|
21
22
|
files:
|
23
|
+
- .gitignore
|
22
24
|
- Gemfile
|
23
25
|
- Gemfile.lock
|
24
26
|
- Guardfile
|
25
27
|
- LICENSE.txt
|
26
|
-
- README.
|
28
|
+
- README.rdoc
|
27
29
|
- Rakefile
|
28
30
|
- lib/terminal-size.rb
|
31
|
+
- pkg/terminal-size-0.0.1.gem
|
29
32
|
- terminal-size.gemspec
|
30
33
|
- test/real-life-ioctl-return-value
|
31
34
|
- test/terminal-size_test.rb
|
@@ -53,7 +56,7 @@ rubyforge_project:
|
|
53
56
|
rubygems_version: 1.8.24
|
54
57
|
signing_key:
|
55
58
|
specification_version: 3
|
56
|
-
summary: ! '
|
59
|
+
summary: ! 'A tiny gem to accomplish a simple task: Determining the terminal size.'
|
57
60
|
test_files:
|
58
61
|
- test/real-life-ioctl-return-value
|
59
62
|
- test/terminal-size_test.rb
|