whirly 0.1.0 → 0.1.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 +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +1 -1
- data/lib/whirly.rb +9 -4
- data/{.README.md.swp → lib/whirly/.spinners.rb.swp} +0 -0
- data/lib/whirly/version.rb +1 -1
- data/{.euruko.rb.swp → spec/.whirly_spec.rb.swp} +0 -0
- data/spec/whirly_spec.rb +38 -2
- metadata +5 -5
- data/lib/.whirly.rb.swp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f12112b921f3f00166d7acf85d4d86cac8836005
|
4
|
+
data.tar.gz: ec7da03c93842811b381ca1fdfbe0df418ff05e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eccb4074399d77acf9e4454fddc27b894d08506095285f4004271d116fa03e6450d2fe2cdd3a1ff6ca8a445b634a6e6ab32a379d8cb2c4b9edc0756cb2ae2a10
|
7
|
+
data.tar.gz: 5a1e9ae823be1884e8e1f0e6783a63b2b540dbfe17d8e74c8cd6634949b69fa6df41d4cb0724fb47760b2fd45984d44c5729b5b8ef70174e264652d0cfce1d00
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/whirly.rb
CHANGED
@@ -30,9 +30,10 @@ module Whirly
|
|
30
30
|
use_color: defined?(Paint),
|
31
31
|
color_change_rate: 30,
|
32
32
|
status: nil,
|
33
|
-
hide_cursor: true
|
34
|
-
|
35
|
-
|
33
|
+
hide_cursor: true,
|
34
|
+
non_tty: false)
|
35
|
+
# only actviate if we are on a real terminal (or forced)
|
36
|
+
return false unless stream.tty? || non_tty
|
36
37
|
|
37
38
|
# ensure cursor is visible after exit
|
38
39
|
at_exit{ @stream.print CLI_COMMANDS[:show_cursor] } if !defined?(@enabled) && hide_cursor
|
@@ -45,7 +46,11 @@ module Whirly
|
|
45
46
|
@paused = false
|
46
47
|
@stream = stream
|
47
48
|
@status = status
|
48
|
-
|
49
|
+
if spinner.is_a? Hash
|
50
|
+
@spinner = spinner
|
51
|
+
else
|
52
|
+
@spinner = SPINNERS[spinner.to_s]
|
53
|
+
end
|
49
54
|
raise(ArgumentError, "Whirly: Invalid spinner given") if !@spinner || (!@spinner["frames"] && !@spinner["proc"])
|
50
55
|
@hide_cursor = hide_cursor
|
51
56
|
@interval = (interval || @spinner["interval"] || 100) * 0.001
|
Binary file
|
data/lib/whirly/version.rb
CHANGED
Binary file
|
data/spec/whirly_spec.rb
CHANGED
@@ -2,8 +2,44 @@ require_relative "../lib/whirly"
|
|
2
2
|
require "minitest/autorun"
|
3
3
|
|
4
4
|
describe Whirly do
|
5
|
-
|
6
|
-
|
5
|
+
describe "usage" do
|
6
|
+
it "outputs every frame of the spinner" do
|
7
|
+
spinner = { "frames" => ["first", "second", "third"], "interval" => 10 }
|
8
|
+
|
9
|
+
assert_output /first.*second.*third/m do
|
10
|
+
Whirly.start(spinner: spinner, non_tty: true)
|
11
|
+
sleep 0.1
|
12
|
+
Whirly.stop
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "calls spinner proc instead of frames if proc is given" do
|
17
|
+
spinner = { "proc" => ->(){ "frame" }, "interval" => 10 }
|
18
|
+
|
19
|
+
assert_output /frame/ do
|
20
|
+
Whirly.start(spinner: spinner, non_tty: true)
|
21
|
+
sleep 0.1
|
22
|
+
Whirly.stop
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe ".enabled?" do
|
28
|
+
it "returns false if whirly was not started yet" do
|
29
|
+
refute_predicate Whirly, :enabled?
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns true if whirly was started, but not yet stopped" do
|
33
|
+
Whirly.start
|
34
|
+
assert_predicate Whirly, :enabled?
|
35
|
+
Whirly.stop
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns false if whirly was stopped" do
|
39
|
+
Whirly.start
|
40
|
+
Whirly.stop
|
41
|
+
refute_predicate Whirly, :enabled?
|
42
|
+
end
|
7
43
|
end
|
8
44
|
end
|
9
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whirly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Whirly: The friendly terminal spinner'
|
14
14
|
email:
|
@@ -17,8 +17,6 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".README.md.swp"
|
21
|
-
- ".euruko.rb.swp"
|
22
20
|
- ".gitignore"
|
23
21
|
- ".gitmodules"
|
24
22
|
- ".travis.yml"
|
@@ -31,10 +29,11 @@ files:
|
|
31
29
|
- Rakefile
|
32
30
|
- data/spinners.json
|
33
31
|
- euruko.rb
|
34
|
-
- lib/.whirly.rb.swp
|
35
32
|
- lib/whirly.rb
|
33
|
+
- lib/whirly/.spinners.rb.swp
|
36
34
|
- lib/whirly/spinners.rb
|
37
35
|
- lib/whirly/version.rb
|
36
|
+
- spec/.whirly_spec.rb.swp
|
38
37
|
- spec/whirly_spec.rb
|
39
38
|
- whirly.gemspec
|
40
39
|
homepage: https://github.com/janlelis/whirly
|
@@ -62,4 +61,5 @@ signing_key:
|
|
62
61
|
specification_version: 4
|
63
62
|
summary: 'Whirly: The friendly terminal spinner'
|
64
63
|
test_files:
|
64
|
+
- spec/.whirly_spec.rb.swp
|
65
65
|
- spec/whirly_spec.rb
|
data/lib/.whirly.rb.swp
DELETED
Binary file
|