tty-cursor 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ab3e019fddbb91543e5e6cfcabdb3fa5e7ba9eee
4
+ data.tar.gz: 2a1beb7ebf58c777fde4c9092be162e721ab6a2f
5
+ SHA512:
6
+ metadata.gz: f481380fc4e9e021a96f0e9c463a57bed2f9fb8e6035edf0da5072037d6c61e6f5df05a783fdbd2b4d1bf1a635e73ca24f3c01ed1fb6f8bbe8a9376c123e95e7
7
+ data.tar.gz: 0bd767c2d2bc1d6d5060fe406984b18d310880cff655df120556d25ce20cf85f6d993ebf876f1dec53b1f716a5c17d14361b893bfc1bdc22f0bfd8d58ae04c25
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --warnings
@@ -0,0 +1 @@
1
+ 2.0.0
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+ bundler_args: --without yard benchmarks
3
+ script: "bundle exec rake ci"
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0
7
+ - 2.1
8
+ - 2.2
9
+ - ruby-head
10
+ matrix:
11
+ include:
12
+ - rvm: jruby-19mode
13
+ - rvm: jruby-20mode
14
+ - rvm: jruby-21mode
15
+ - rvm: jruby-9000
16
+ - rvm: jruby-head
17
+ - rvm: rbx-2
18
+ allow_failures:
19
+ - rvm: ruby-head
20
+ - rvm: jruby-head
21
+ fast_finish: true
22
+ branches:
23
+ only: master
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake', '~> 10.4.2'
7
+ gem 'rspec', '~> 3.4.0'
8
+ gem 'yard', '~> 0.8.7'
9
+ gem 'benchmark-ips', '~> 2.0.0'
10
+ end
11
+
12
+ group :metrics do
13
+ gem 'coveralls', '~> 0.8.9'
14
+ gem 'simplecov', '~> 0.10.0'
15
+ gem 'yardstick', '~> 0.9.9'
16
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Piotr Murach
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,194 @@
1
+ # TTY::Cursor
2
+ [![Gem Version](https://badge.fury.io/rb/tty-cursor.svg)][gem]
3
+ [![Build Status](https://secure.travis-ci.org/peter-murach/tty-cursor.svg?branch=master)][travis]
4
+ [![Code Climate](https://codeclimate.com/github/peter-murach/tty-cursor/badges/gpa.svg)][codeclimate]
5
+ [![Coverage Status](https://coveralls.io/repos/peter-murach/tty-cursor/badge.svg)][coverage]
6
+ [![Inline docs](http://inch-ci.org/github/peter-murach/tty-cursor.svg?branch=master)][inchpages]
7
+
8
+ [gem]: http://badge.fury.io/rb/tty-cursor
9
+ [travis]: http://travis-ci.org/peter-murach/tty-cursor
10
+ [codeclimate]: https://codeclimate.com/github/peter-murach/tty-cursor
11
+ [coverage]: https://coveralls.io/r/peter-murach/tty-cursor
12
+ [inchpages]: http://inch-ci.org/github/peter-murach/tty-cursor
13
+
14
+ > Terminal cursor movement and manipulation of cursor properties such as visibility.
15
+
16
+ The purpose of this library is to help move terminal cursor around using intuitive commands and help in clearing terminal screen.
17
+
18
+ **TTY::Cursor** provides independent cursor movement component for [TTY](https://github.com/peter-murach/tty) toolkit.
19
+
20
+ ## Installation
21
+
22
+ Add this line to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem 'tty-cursor'
26
+ ```
27
+
28
+ And then execute:
29
+
30
+ $ bundle
31
+
32
+ Or install it yourself as:
33
+
34
+ $ gem install tty-cursor
35
+
36
+ ## Contents
37
+
38
+ * [1. Usage](#1-usage)
39
+ * [2. Interface](#2-interface)
40
+ * [2.1 Cursor control](#21-cursor-control)
41
+ * [2.1.1 move_to(x, y)](#211-move_tox-y)
42
+ * [2.1.2 move(x, y)](#212-movex-y)
43
+ * [2.1.3 up(count)](#213-upcount)
44
+ * [2.1.4 down(count)](#214-downcount)
45
+ * [2.1.5 forward(count)](#215-forwardcount)
46
+ * [2.1.6 backward(count)](#216-backwardcount)
47
+ * [2.1.7 save](#217-save)
48
+ * [2.1.8 restore](#218-restore)
49
+ * [2.1.9 current](#219-current)
50
+ * [2.1.10 next_line](#2110-next_line)
51
+ * [2.1.11 prev_line](#2111-prev_line)
52
+ * [2.1.12 show](#2112-show)
53
+ * [2.1.13 hide](#2113-hide)
54
+ * [2.1.14 invisible(stream)](#2114-invisiblestream)
55
+ * [2.2 Clearing text](#22-clearing-text)
56
+ * [2.2.1 clear_line](#221-clear_line)
57
+ * [2.2.2 clear_lines(count, direction)](#222-clear_linescount-direction)
58
+ * [2.2.3 clear_screen_down](#223-clear_screen_down)
59
+ * [2.2.4 clear_screen_up](#224-clear_screen_up)
60
+ * [2.2.5 clear_screen](#225-clear_screen)
61
+
62
+ ## 1. Usage
63
+
64
+ **TTY::Cursor** is just a module hence you can reference it for later like so:
65
+
66
+ ```ruby
67
+ cursor = TTY::Cursor
68
+ ```
69
+
70
+ and then to move cursor 5 lines up and 2 rows to the right do:
71
+
72
+ ```ruby
73
+ print cursor.up(5) + cursor.right(2)
74
+ ```
75
+
76
+ or simple call `move` to move cursor relative to current position:
77
+
78
+ ```ruby
79
+ print cursor.move(5, 2)
80
+ ```
81
+
82
+ ## 2. Interface
83
+
84
+ ### 2.1 Cursor control
85
+
86
+ #### 2.1.1 move_to(x, y)
87
+
88
+ Set the cursor absolute position where subsequent text will begin.
89
+
90
+ If no row/column parameters are provided, the cursor will move to the home position, at the upper left of the screen:
91
+
92
+ ```ruby
93
+ cursor.move_to
94
+ ```
95
+
96
+ #### 2.1.2 move(x, y)
97
+
98
+ Move cursor by x columns and y rows relative to its current position.
99
+
100
+ #### 2.1.3 up(count)
101
+
102
+ Move the cursor up by `count` rows; the default count is `1`.
103
+
104
+ #### 2.1.4 down(count)
105
+
106
+ Move the cursor down by `count` rows; the default count is `1`.
107
+
108
+ #### 2.1.5 forward(count)
109
+
110
+ Move the cursor forward by `count` columns; the default count is `1`.
111
+
112
+ #### 2.1.6 backward(count)
113
+
114
+ Move the cursor backward by COUNT columns; the default count is `1`.
115
+
116
+ #### 2.1.7 save
117
+
118
+ Save current cursor position.
119
+
120
+ #### 2.1.8 restore
121
+
122
+ Restore cursor position after a save cursor was called.
123
+
124
+ #### 2.1.9 current
125
+
126
+ Query current cursor position
127
+
128
+ #### 2.1.10 next_line
129
+
130
+ Move the cursor to the next line.
131
+
132
+ #### 2.1.11 prev_line
133
+
134
+ Move the cursor to the previous line.
135
+
136
+ #### 2.1.12 show
137
+
138
+ Show cursor
139
+
140
+ #### 2.1.13 hide
141
+
142
+ Hide cursor
143
+
144
+ #### 2.1.14 invisible(stream)
145
+
146
+ To hide cursor for the duration of the block do:
147
+
148
+ ```ruby
149
+ cursor.invisible { ... }
150
+ ```
151
+
152
+ By default standard output will be used but you can change that by passing a different stream that responds to `print` call:
153
+
154
+ ```ruby
155
+ cursor.invisible($stderr) { .... }
156
+ ```
157
+
158
+ ### 2.2 Clearing text
159
+
160
+ #### 2.2.1 clear_line
161
+
162
+ Erase the entire current line.
163
+
164
+ #### 2.2.2 clear_lines(count, direction)
165
+
166
+ Erase `count` rows in given direction; the default direction is `:up`.
167
+
168
+ ```ruby
169
+ cursor.clear_lines(5, :down)
170
+ ```
171
+
172
+ #### 2.2.3 clear_screen_down
173
+
174
+ Erase the screen from the current line down to the bottom of the screen.
175
+
176
+ #### 2.2.4 clear_screen_up
177
+
178
+ Erase the screen from the current line up to the top of the screen.
179
+
180
+ #### 2.2.5 clear_screen
181
+
182
+ Erase the screen with the background colour and moves the cursor to home.
183
+
184
+ ## Contributing
185
+
186
+ 1. Fork it ( https://github.com/peter-murach/tty-cursor/fork )
187
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
188
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
189
+ 4. Push to the branch (`git push origin my-new-feature`)
190
+ 5. Create a new Pull Request
191
+
192
+ ## Copyright
193
+
194
+ Copyright (c) 2015 Piotr Murach. See LICENSE for further details.
@@ -0,0 +1,8 @@
1
+ # encoding: 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 ]
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+
3
+ require 'tty/cursor'
4
+ require 'tty/version'
@@ -0,0 +1,164 @@
1
+ # encoding: utf-8
2
+
3
+ module TTY
4
+ # Terminal cursor movement ANSI codes
5
+ module Cursor
6
+ module_function
7
+
8
+ ECMA_CSI = "\e[".freeze
9
+ DEC_RST = 'l'.freeze
10
+ DEC_SET = 'h'.freeze
11
+ DEC_TCEM = '?25'.freeze
12
+ ECMA_CLR = 'K'.freeze
13
+
14
+ # Make cursor visible
15
+ # @api public
16
+ def show
17
+ ECMA_CSI + DEC_TCEM + DEC_SET
18
+ end
19
+
20
+ # Hide cursor
21
+ # @api public
22
+ def hide
23
+ ECMA_CSI + DEC_TCEM + DEC_RST
24
+ end
25
+
26
+ # Switch off cursor for the block
27
+ # @api public
28
+ def invisible(stream = $stdout)
29
+ stream.print(hide)
30
+ yield
31
+ ensure
32
+ stream.print(show)
33
+ end
34
+
35
+ # Save current position
36
+ # @api public
37
+ def save
38
+ ECMA_CSI + 's'
39
+ end
40
+
41
+ # Restore cursor position
42
+ # @api public
43
+ def restore
44
+ ECMA_CSI + 'u'
45
+ end
46
+
47
+ # Query cursor current position
48
+ # @api public
49
+ def current
50
+ ECMA_CSI + '6n'
51
+ end
52
+
53
+ # Set the cursor absolute position
54
+ # @param [Integer] row
55
+ # @param [Integer] column
56
+ # @api public
57
+ def move_to(row = nil, column = nil)
58
+ return ECMA_CSI + 'H' if row.nil? && column.nil?
59
+ ECMA_CSI + "#{column + 1};#{row + 1}H"
60
+ end
61
+
62
+ # Move cursor relative to its current position
63
+ #
64
+ # @param [Integer] x
65
+ # @param [Integer] y
66
+ #
67
+ # @api public
68
+ def move(x, y)
69
+ (x < 0 ? backward(-x) : (x > 0 ? forward(x) : '')) +
70
+ (y < 0 ? down(-y) : (y > 0 ? up(y) : ''))
71
+ end
72
+
73
+ # Move cursor up by number of lines
74
+ #
75
+ # @param [Integer] count
76
+ #
77
+ # @api public
78
+ def up(count = nil)
79
+ ECMA_CSI + "#{(count || 1)}A"
80
+ end
81
+ alias_method :cursor_up, :up
82
+
83
+ # Move cursor down by number of lines
84
+ #
85
+ # @param [Integer] count
86
+ #
87
+ # @api public
88
+ def down(count = nil)
89
+ ECMA_CSI + "#{(count || 1)}B"
90
+ end
91
+ alias_method :cursor_down, :down
92
+
93
+ # Move to start of the line
94
+ #
95
+ # @api public
96
+ def move_start
97
+ backward(1000)
98
+ end
99
+
100
+ # @param [Integer] count
101
+ # how far to go left
102
+ # @api public
103
+ def backward(count = nil)
104
+ ECMA_CSI + "#{count || 1}D"
105
+ end
106
+ alias_method :cursor_backward, :backward
107
+
108
+ # @api public
109
+ def forward(count = nil)
110
+ ECMA_CSI + "#{count || 1}C"
111
+ end
112
+ alias_method :cursor_forward, :forward
113
+
114
+ # @api public
115
+ def next_line
116
+ ECMA_CSI + 'E'
117
+ end
118
+
119
+ # @api public
120
+ def prev_line
121
+ ECMA_CSI + 'F'
122
+ end
123
+
124
+ # Clear current line
125
+ # @api public
126
+ def clear_line
127
+ move_start + ECMA_CSI + ECMA_CLR
128
+ end
129
+
130
+ # Clear a number of lines
131
+ #
132
+ # @param [Integer] count
133
+ # the number of lines to clear
134
+ # @param [Symbol] :direction
135
+ # the direction to clear, default :up
136
+ #
137
+ # @api public
138
+ def clear_lines(count, direction = :up)
139
+ count.times.reduce('') do |acc|
140
+ dir = direction == :up ? up : down
141
+ acc << dir + clear_line
142
+ end
143
+ end
144
+ alias_method :clear_rows, :clear_lines
145
+
146
+ # Clear screen down from current position
147
+ # @api public
148
+ def clear_screen_down
149
+ ECMA_CSI + 'J'
150
+ end
151
+
152
+ # Clear screen up from current position
153
+ # @api public
154
+ def clear_screen_up
155
+ ECMA_CSI + '1J'
156
+ end
157
+
158
+ # Clear the screen with the background colour and moves the cursor to home
159
+ # @api public
160
+ def clear_screen
161
+ ECMA_CSI + '2J'
162
+ end
163
+ end # Cursor
164
+ end # TTY
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module TTY
4
+ module Cursor
5
+ VERSION = '0.1.0'
6
+ end # Cursor
7
+ end # TTY
@@ -0,0 +1,45 @@
1
+ # encoding: 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-cursor'
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
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ RSpec.describe TTY::Cursor, '#clear_lines' do
4
+ subject(:cursor) { described_class }
5
+
6
+ it "clears line" do
7
+ expect(cursor.clear_line).to eq("\e[1000D\e[K")
8
+ end
9
+
10
+ it "clears 5 lines up" do
11
+ expect(cursor.clear_lines(5)).to eq([
12
+ "\e[1A\e[1000D\e[K",
13
+ "\e[1A\e[1000D\e[K",
14
+ "\e[1A\e[1000D\e[K",
15
+ "\e[1A\e[1000D\e[K",
16
+ "\e[1A\e[1000D\e[K"
17
+ ].join)
18
+ end
19
+
20
+ it "clears 5 lines down" do
21
+ expect(cursor.clear_lines(5, :down)).to eq([
22
+ "\e[1B\e[1000D\e[K",
23
+ "\e[1B\e[1000D\e[K",
24
+ "\e[1B\e[1000D\e[K",
25
+ "\e[1B\e[1000D\e[K",
26
+ "\e[1B\e[1000D\e[K"
27
+ ].join)
28
+ end
29
+
30
+ it "clears screen down" do
31
+ expect(cursor.clear_screen_down).to eq("\e[J")
32
+ end
33
+
34
+ it "clears screen up" do
35
+ expect(cursor.clear_screen_up).to eq("\e[1J")
36
+ end
37
+
38
+
39
+ it "clears entire screen" do
40
+ expect(cursor.clear_screen).to eq("\e[2J")
41
+ end
42
+ end
@@ -0,0 +1,75 @@
1
+ # encoding: utf-8
2
+
3
+ RSpec.describe TTY::Cursor do
4
+ subject(:cursor) { described_class }
5
+
6
+ it "shows cursor" do
7
+ expect(cursor.show).to eq("\e[?25h")
8
+ end
9
+
10
+ it "hides cursor" do
11
+ expect(cursor.hide).to eq("\e[?25l")
12
+ end
13
+
14
+ it "saves cursor position" do
15
+ expect(cursor.save).to eq("\e[s")
16
+ end
17
+
18
+ it "restores cursor position" do
19
+ expect(cursor.restore).to eq("\e[u")
20
+ end
21
+
22
+ it "gets current cursor positoin" do
23
+ expect(cursor.current).to eq("\e[6n")
24
+ end
25
+
26
+ it "moves cursor up default by 1 line" do
27
+ expect(cursor.up).to eq("\e[1A")
28
+ end
29
+
30
+ it "moves cursor up by 5 lines" do
31
+ expect(cursor.up(5)).to eq("\e[5A")
32
+ end
33
+
34
+ it "moves cursor down default by 1 line" do
35
+ expect(cursor.down).to eq("\e[1B")
36
+ end
37
+
38
+ it "moves cursor down by 5 lines" do
39
+ expect(cursor.down(5)).to eq("\e[5B")
40
+ end
41
+
42
+ it "moves to line start" do
43
+ expect(cursor.move_start).to eq("\e[1000D")
44
+ end
45
+
46
+ it "moves cursorleft by 1 line default" do
47
+ expect(cursor.backward).to eq("\e[1D")
48
+ end
49
+
50
+ it "moves cursor left by 5" do
51
+ expect(cursor.backward(5)).to eq("\e[5D")
52
+ end
53
+
54
+ it "moves cursor right by 1 line default" do
55
+ expect(cursor.forward).to eq("\e[1C")
56
+ end
57
+
58
+ it "moves cursor right by 5 lines" do
59
+ expect(cursor.forward(5)).to eq("\e[5C")
60
+ end
61
+
62
+ it "moves cursor to next line" do
63
+ expect(cursor.next_line).to eq("\e[E")
64
+ end
65
+
66
+ it "moves cursor to previous line" do
67
+ expect(cursor.prev_line).to eq("\e[F")
68
+ end
69
+
70
+ it "hides cursor for the duration of block call" do
71
+ stream = StringIO.new
72
+ cursor.invisible(stream) { }
73
+ expect(stream.string).to eq("\e[?25l\e[?25h")
74
+ end
75
+ end
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+
3
+ RSpec.describe TTY::Cursor, '#move' do
4
+ subject(:cursor) { described_class }
5
+
6
+ it "doesn't move for point (0, 0)" do
7
+ expect(cursor.move(0, 0)).to eq('')
8
+ end
9
+
10
+ it "moves only to the right" do
11
+ expect(cursor.move(2, 0)).to eq("\e[2C")
12
+ end
13
+
14
+ it "moves right and up" do
15
+ expect(cursor.move(2, 3)).to eq("\e[2C\e[3A")
16
+ end
17
+
18
+ it "moves right and down" do
19
+ expect(cursor.move(2, -3)).to eq("\e[2C\e[3B")
20
+ end
21
+
22
+ it "moves left and up" do
23
+ expect(cursor.move(-2, 3)).to eq("\e[2D\e[3A")
24
+ end
25
+
26
+ it "moves left and down" do
27
+ expect(cursor.move(-2, -3)).to eq("\e[2D\e[3B")
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ RSpec.describe TTY::Cursor, '#move_to' do
4
+ subject(:cursor) { described_class }
5
+
6
+ it "moves to home" do
7
+ expect(cursor.move_to). to eq("\e[H")
8
+ end
9
+
10
+ it "moves to row and column" do
11
+ expect(cursor.move_to(2, 3)).to eq("\e[4;3H")
12
+ end
13
+ end
@@ -0,0 +1,10 @@
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 File.join(__FILE__, '../../lib/pastel')
8
+ ARGV.clear
9
+ IRB.start
10
+ end
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,29 @@
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
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tty/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'tty-cursor'
8
+ spec.version = TTY::Cursor::VERSION
9
+ spec.authors = ["Piotr Murach"]
10
+ spec.email = [""]
11
+ spec.summary = %q{Terminal cursor movement and manipulation of cursor properties such as visibility.}
12
+ spec.description = %q{The purpose of this library is to help move terminal cursor around using intuitive commands and help in clearing terminal screen.}
13
+ spec.homepage = 'http://peter-murach.github.io/tty/'
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tty-cursor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Murach
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-28 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ description: The purpose of this library is to help move terminal cursor around using
28
+ intuitive commands and help in clearing terminal screen.
29
+ email:
30
+ - ''
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - .gitignore
36
+ - .rspec
37
+ - .ruby-version
38
+ - .travis.yml
39
+ - Gemfile
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - lib/tty-cursor.rb
44
+ - lib/tty/cursor.rb
45
+ - lib/tty/version.rb
46
+ - spec/spec_helper.rb
47
+ - spec/unit/clear_lines_spec.rb
48
+ - spec/unit/cursor_spec.rb
49
+ - spec/unit/move_spec.rb
50
+ - spec/unit/move_to_spec.rb
51
+ - tasks/console.rake
52
+ - tasks/coverage.rake
53
+ - tasks/spec.rake
54
+ - tty-cursor.gemspec
55
+ homepage: http://peter-murach.github.io/tty/
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.0.3
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Terminal cursor movement and manipulation of cursor properties such as visibility.
79
+ test_files:
80
+ - spec/spec_helper.rb
81
+ - spec/unit/clear_lines_spec.rb
82
+ - spec/unit/cursor_spec.rb
83
+ - spec/unit/move_spec.rb
84
+ - spec/unit/move_to_spec.rb
85
+ has_rdoc: