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.
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source :rubygems
2
- group :development do
3
- gem 'working'
4
- gem 'pry-rescue', github: 'ConradIrwin/pry-rescue', branch: 'feature/kill-pry-rescue'
5
- end
2
+ gem 'pry', github: 'pry/pry'
3
+ gemspec
@@ -1,11 +1,16 @@
1
1
  GIT
2
- remote: git://github.com/ConradIrwin/pry-rescue.git
3
- revision: 6a31294b730f8caab8b0998eb1e9ee0211909f48
4
- branch: feature/kill-pry-rescue
2
+ remote: git://github.com/pry/pry.git
3
+ revision: 92fe82dbd6c6866d8ad107fb031d16c2f307148c
5
4
  specs:
6
- pry-rescue (0.14)
7
- interception (>= 0.3)
8
- pry
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.0)
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.1)
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.3.0)
61
+ jist (1.4.0)
59
62
  json
60
- json (1.7.5)
61
- listen (0.6.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.1.9)
90
- pry-stack_explorer (>= 0.3.9)
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-remote-em (0.7.3)
121
- eventmachine
122
- highline
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.2)
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.4)
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-rescue!
154
+ pry!
155
+ terminal-size!
156
156
  working
data/Guardfile CHANGED
@@ -1,2 +1,3 @@
1
1
  require 'working/guard'
2
2
  # vim:ft=ruby
3
+ # vim ft=ruby
@@ -1,7 +1,14 @@
1
- # Terminal.size
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
- ## Installation
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
@@ -1,6 +1,2 @@
1
1
  require 'bundler/gem_tasks'
2
- # TODO: require 'working/rake'
3
- task default: :test
4
- task :test do
5
- Dir['test/**/*_test.rb'].each do |e| load e end
6
- end
2
+ require 'working/rake_tasks'
@@ -1,5 +1,5 @@
1
1
  class Terminal
2
- class Size; VERSION = '0.0.1' end
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
- TIOCGWINSZ.each do |k,v|
41
- return v if platform[k]
42
- end
43
- nil
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
@@ -1,15 +1,12 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.unshift './lib'
2
+ require 'working/gemspec'
3
3
  require 'terminal-size'
4
-
5
- Gem::Specification.new do |gem|
6
- gem.name = 'terminal-size'
7
- gem.version = Terminal::Size::VERSION
8
- gem.authors = %w(☈king Norrin)
9
- gem.email = ['rking-terminal-size@sharpsaw.org']
10
- gem.description = gem.summary = %q{Terminal.size ⇒ {columns: 80, rows: 25}}
11
- gem.homepage = 'https://github.com/rking/terminal-size'
12
- gem.files = `git ls-files`.split($/)
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: []
@@ -34,8 +34,7 @@ class TerminalTest < MiniTest::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_integration_using_tmux
37
- skip 'This test must be run from within tmux (with a split-window -h)' \
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'
@@ -1,28 +1,2 @@
1
- # If on Rails:
2
- # ENV['RAILS_ENV'] = 'test'
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.1
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: 2012-12-29 00:00:00.000000000 Z
13
+ date: 2013-01-07 00:00:00.000000000 Z
14
14
  dependencies: []
15
- description: ! 'Terminal.size ⇒ {columns: 80, rows: 25}'
16
- email:
17
- - rking-terminal-size@sharpsaw.org
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.md
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: ! 'Terminal.size {columns: 80, rows: 25}'
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