cli_spinnable 0.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 +7 -0
- data/.codeclimate.yml +17 -0
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +77 -0
- data/Rakefile +6 -0
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/cli_spinner.gemspec +30 -0
- data/examples/example1.rb +34 -0
- data/examples/example2.rb +30 -0
- data/examples/example3.rb +28 -0
- data/lib/cli_spinnable.rb +21 -0
- data/lib/cli_spinnable/cli_spinnable_error.rb +3 -0
- data/lib/cli_spinnable/line.rb +47 -0
- data/lib/cli_spinnable/line/colourable_string.rb +15 -0
- data/lib/cli_spinnable/line/sign.rb +58 -0
- data/lib/cli_spinnable/version.rb +3 -0
- data/lib/cli_spinnable/writer.rb +72 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b57d77c25a5bb808706cb92487a5877fa2c32121
|
4
|
+
data.tar.gz: f59c00a22d6b5958b6a2183f10fbd6a1728ffa11
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 64cd82f07433483e87807de0268ceec2cb175f129b5adacad2d4bea007c09b8d4c72230b0434d312361db7de0a5bd2085337e1d8a496a5d3d454b78080bb03d8
|
7
|
+
data.tar.gz: 0b77ed47dde390e9977b9549c9ee200eb9b7a2c4c924e698366e36ccb07943437e2103fe12d236cd0421d095901eefb7cb1a6c7681a6ec53404e7e84c0565cf6
|
data/.codeclimate.yml
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at krzysztof.maicher@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Krzysztof Maicher
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# CliSpinnable
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/cli_spinnable)
|
4
|
+
[](https://travis-ci.org/maicher/cli_spinnable)
|
5
|
+
[](https://codeclimate.com/github/maicher/cli_spinnable)
|
6
|
+
[](https://codeclimate.com/github/maicher/cli_spinnable/coverage)
|
7
|
+
|
8
|
+
CliSpinnable, a module that enriches ruby command line interface with rotating spinner, check mark (✓) and and fail mark (×).
|
9
|
+
|
10
|
+
## Dependencies
|
11
|
+
|
12
|
+
* Ruby >= 2.1
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'cli_spinnable'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install cli_spinnable
|
29
|
+
|
30
|
+
## How to use
|
31
|
+
|
32
|
+
1. Mix-in CliSpinnable module into YourClass
|
33
|
+
|
34
|
+
class YourClass
|
35
|
+
include CliSpinnable
|
36
|
+
|
37
|
+
2. Call `with_spinner` inside `your_method` providing a block
|
38
|
+
|
39
|
+
def your_method
|
40
|
+
with_spinner do |cli|
|
41
|
+
# ...
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
3. Use `#print` and `#tick` methods
|
46
|
+
|
47
|
+
with_spinner do |cli|
|
48
|
+
cli.print 'Downloading something'
|
49
|
+
sleep 1 # some long operation
|
50
|
+
cli.print '...downloaded 1MB'
|
51
|
+
cli.tick
|
52
|
+
cli.print 'Processing data'
|
53
|
+
sleep 1 # other long operation
|
54
|
+
cli.tick
|
55
|
+
end
|
56
|
+
|
57
|
+
4. If operation will fail (exception raised within the block), × will be printed
|
58
|
+
|
59
|
+
with_spinner do |cli|
|
60
|
+
cli.print 'Trying to do something that can fail'
|
61
|
+
1 / 0 # raise Error
|
62
|
+
cli.tick # you will not see the tick
|
63
|
+
end
|
64
|
+
|
65
|
+
## Development
|
66
|
+
|
67
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
68
|
+
|
69
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/maicher/cli_spinnable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/cli_spinner.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cli_spinnable/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cli_spinnable'
|
8
|
+
spec.version = CliSpinnable::VERSION
|
9
|
+
spec.authors = ['Krzysztof Maicher']
|
10
|
+
spec.email = ['krzysztof.maicher@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'CliSpinnable, a module that enriches ruby command line interface'
|
13
|
+
spec.summary += ' with rotating spinner, check mark (✓) and and fail mark (×).'
|
14
|
+
spec.description = 'CliSpinnable, a module that enriches ruby command line interface'
|
15
|
+
spec.description += ' with rotating spinner, check mark (✓) and and fail mark (×).'
|
16
|
+
spec.homepage = 'https://github.com/maicher/cli_spinnable'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
spec.required_ruby_version = '>= 2.1.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.44'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
27
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.12'
|
29
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'cli_spinnable'
|
4
|
+
|
5
|
+
class Foo
|
6
|
+
include CliSpinnable
|
7
|
+
|
8
|
+
def call
|
9
|
+
puts 'HAPPY RUN (ending with success):'
|
10
|
+
with_spinner do |cli|
|
11
|
+
cli.print 'Downloading something'
|
12
|
+
sleep 1
|
13
|
+
cli.print '...downloaded 1MB'
|
14
|
+
cli.tick
|
15
|
+
cli.print 'Processing data'
|
16
|
+
sleep 1
|
17
|
+
cli.tick
|
18
|
+
end
|
19
|
+
|
20
|
+
puts 'SAD RUN (ending with fail):'
|
21
|
+
with_spinner do |cli|
|
22
|
+
cli.print 'Downloading something'
|
23
|
+
sleep 1
|
24
|
+
cli.print '...downloaded 1MB'
|
25
|
+
cli.tick
|
26
|
+
cli.print 'Processing data'
|
27
|
+
sleep 1
|
28
|
+
1 / 0
|
29
|
+
cli.tick
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Foo.new.call
|
@@ -0,0 +1,30 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'cli_spinnable'
|
4
|
+
|
5
|
+
module Foo
|
6
|
+
extend CliSpinnable
|
7
|
+
end
|
8
|
+
|
9
|
+
puts 'HAPPY RUN (ending with success):'
|
10
|
+
Foo.with_spinner do |cli|
|
11
|
+
cli.print 'Downloading something'
|
12
|
+
sleep 1
|
13
|
+
cli.print '...downloaded 1MB'
|
14
|
+
cli.tick
|
15
|
+
cli.print 'Processing data'
|
16
|
+
sleep 1
|
17
|
+
cli.tick
|
18
|
+
end
|
19
|
+
|
20
|
+
puts 'SAD RUN (ending with fail):'
|
21
|
+
Foo.with_spinner do |cli|
|
22
|
+
cli.print 'Downloading something'
|
23
|
+
sleep 1
|
24
|
+
cli.print '...downloaded 1MB'
|
25
|
+
cli.tick
|
26
|
+
cli.print 'Processing data'
|
27
|
+
sleep 1
|
28
|
+
1 / 0
|
29
|
+
cli.tick
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'cli_spinnable'
|
4
|
+
|
5
|
+
include CliSpinnable
|
6
|
+
|
7
|
+
puts 'HAPPY RUN (ending with success):'
|
8
|
+
with_spinner do |cli|
|
9
|
+
cli.print 'Downloading something'
|
10
|
+
sleep 1
|
11
|
+
cli.print '...downloaded 1MB'
|
12
|
+
cli.tick
|
13
|
+
cli.print 'Processing data'
|
14
|
+
sleep 1
|
15
|
+
cli.tick
|
16
|
+
end
|
17
|
+
|
18
|
+
puts 'SAD RUN (ending with fail):'
|
19
|
+
with_spinner do |cli|
|
20
|
+
cli.print 'Downloading something'
|
21
|
+
sleep 1
|
22
|
+
cli.print '...downloaded 1MB'
|
23
|
+
cli.tick
|
24
|
+
cli.print 'Processing data'
|
25
|
+
sleep 1
|
26
|
+
1 / 0
|
27
|
+
cli.tick
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'cli_spinnable/version'
|
2
|
+
require 'cli_spinnable/cli_spinnable_error'
|
3
|
+
require 'cli_spinnable/line/colourable_string'
|
4
|
+
require 'cli_spinnable/line/sign'
|
5
|
+
require 'cli_spinnable/line'
|
6
|
+
require 'cli_spinnable/writer'
|
7
|
+
|
8
|
+
module CliSpinnable
|
9
|
+
def with_spinner
|
10
|
+
writer = Writer.new(STDOUT, Line.new)
|
11
|
+
yield writer
|
12
|
+
writer.finalize
|
13
|
+
self
|
14
|
+
rescue CliSpinnableError => e
|
15
|
+
raise e
|
16
|
+
rescue StandardError => e
|
17
|
+
writer.failure
|
18
|
+
writer.finalize
|
19
|
+
raise e
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module CliSpinnable
|
2
|
+
class Line
|
3
|
+
class Error < CliSpinnableError; end
|
4
|
+
|
5
|
+
CARRIAGE_RETURN = "\r".freeze
|
6
|
+
NEWLINE = "\n".freeze
|
7
|
+
|
8
|
+
attr_accessor :newline
|
9
|
+
|
10
|
+
def initialize(str = nil, sign = nil, newline = nil)
|
11
|
+
self.str = str
|
12
|
+
@sign = Sign.new(sign)
|
13
|
+
self.newline = newline
|
14
|
+
end
|
15
|
+
|
16
|
+
def sign=(sym)
|
17
|
+
sign.sign = sym
|
18
|
+
end
|
19
|
+
|
20
|
+
def <<(arg)
|
21
|
+
str << ensure_single_line(String(arg))
|
22
|
+
end
|
23
|
+
|
24
|
+
def str=(arg)
|
25
|
+
@str = ensure_single_line(String(arg))
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_s_resetting_newline
|
29
|
+
[CARRIAGE_RETURN, sign, str, newline_with_reset].join
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :str, :sign
|
35
|
+
|
36
|
+
def ensure_single_line(str)
|
37
|
+
raise Error, 'Multiline strings not allowed' if str.include?(NEWLINE)
|
38
|
+
str
|
39
|
+
end
|
40
|
+
|
41
|
+
def newline_with_reset
|
42
|
+
return unless newline
|
43
|
+
self.newline = false
|
44
|
+
NEWLINE
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module CliSpinnable
|
2
|
+
class Line
|
3
|
+
class Sign
|
4
|
+
using ColourableString
|
5
|
+
|
6
|
+
class Error < CliSpinnableError; end
|
7
|
+
|
8
|
+
SPIN = %w(- \\ | /).freeze
|
9
|
+
TICK = "\u2713".green.freeze
|
10
|
+
FAIL = "\u00d7".red.freeze
|
11
|
+
BLANK = ''.freeze
|
12
|
+
|
13
|
+
AVAILABLE_SIGNS = %i(spin tick fail blank).freeze
|
14
|
+
|
15
|
+
def initialize(sign = nil)
|
16
|
+
self.sign = sign || :blank
|
17
|
+
end
|
18
|
+
|
19
|
+
def sign=(sign)
|
20
|
+
raise Error, "Unavailable sign: #{sign || 'nil'}" unless AVAILABLE_SIGNS.include?(sign)
|
21
|
+
@sign = sign
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
send(sign) + separator
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :sign
|
32
|
+
|
33
|
+
def separator
|
34
|
+
sign == :blank ? '' : ' '
|
35
|
+
end
|
36
|
+
|
37
|
+
def spin
|
38
|
+
spinner_enum.next
|
39
|
+
end
|
40
|
+
|
41
|
+
def tick
|
42
|
+
TICK
|
43
|
+
end
|
44
|
+
|
45
|
+
def fail
|
46
|
+
FAIL
|
47
|
+
end
|
48
|
+
|
49
|
+
def blank
|
50
|
+
BLANK
|
51
|
+
end
|
52
|
+
|
53
|
+
def spinner_enum
|
54
|
+
@spinner_enum ||= SPIN.cycle
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module CliSpinnable
|
2
|
+
class Writer
|
3
|
+
class Error < CliSpinnableError; end
|
4
|
+
|
5
|
+
REFRESH_DELAY_IN_SECONDS = 0.1
|
6
|
+
|
7
|
+
def initialize(output, line)
|
8
|
+
@output = output
|
9
|
+
@line = line
|
10
|
+
@queue = Queue.new
|
11
|
+
@session = start_session
|
12
|
+
end
|
13
|
+
|
14
|
+
def print(str)
|
15
|
+
push(:sign=, :spin)
|
16
|
+
push(:<<, str)
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def tick
|
21
|
+
push(:sign=, :tick)
|
22
|
+
push(:newline=, true)
|
23
|
+
push(:str=, '')
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def failure
|
28
|
+
push(:sign=, :fail)
|
29
|
+
push(:newline=, true)
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
def finalize
|
34
|
+
push(:sign=, :blank)
|
35
|
+
push(:str=, '')
|
36
|
+
finalize_session
|
37
|
+
self
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
attr_reader :output, :line, :queue, :session
|
43
|
+
|
44
|
+
def push(attr, val)
|
45
|
+
raise Error, 'Session finalized' unless session.status
|
46
|
+
queue.push([attr, val])
|
47
|
+
end
|
48
|
+
|
49
|
+
def start_session
|
50
|
+
Thread.new do
|
51
|
+
loop do
|
52
|
+
loop do
|
53
|
+
output.write reload_line.to_s_resetting_newline
|
54
|
+
break if queue.empty?
|
55
|
+
end
|
56
|
+
break if Thread.current[:finalize]
|
57
|
+
sleep REFRESH_DELAY_IN_SECONDS
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def reload_line
|
63
|
+
line.public_send(*queue.pop) unless queue.empty?
|
64
|
+
line
|
65
|
+
end
|
66
|
+
|
67
|
+
def finalize_session
|
68
|
+
session[:finalize] = true
|
69
|
+
session.join
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cli_spinnable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Krzysztof Maicher
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-17 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.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.44'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.44'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.12'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.12'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: codeclimate-test-reporter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
description: CliSpinnable, a module that enriches ruby command line interface with
|
112
|
+
rotating spinner, check mark (✓) and and fail mark (×).
|
113
|
+
email:
|
114
|
+
- krzysztof.maicher@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".codeclimate.yml"
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".rubocop.yml"
|
123
|
+
- ".travis.yml"
|
124
|
+
- CODE_OF_CONDUCT.md
|
125
|
+
- Gemfile
|
126
|
+
- LICENSE.txt
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/setup
|
131
|
+
- cli_spinner.gemspec
|
132
|
+
- examples/example1.rb
|
133
|
+
- examples/example2.rb
|
134
|
+
- examples/example3.rb
|
135
|
+
- lib/cli_spinnable.rb
|
136
|
+
- lib/cli_spinnable/cli_spinnable_error.rb
|
137
|
+
- lib/cli_spinnable/line.rb
|
138
|
+
- lib/cli_spinnable/line/colourable_string.rb
|
139
|
+
- lib/cli_spinnable/line/sign.rb
|
140
|
+
- lib/cli_spinnable/version.rb
|
141
|
+
- lib/cli_spinnable/writer.rb
|
142
|
+
homepage: https://github.com/maicher/cli_spinnable
|
143
|
+
licenses:
|
144
|
+
- MIT
|
145
|
+
metadata: {}
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 2.1.0
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.4.8
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: CliSpinnable, a module that enriches ruby command line interface with rotating
|
166
|
+
spinner, check mark (✓) and and fail mark (×).
|
167
|
+
test_files: []
|