whirly 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 676e277e0721c5b27b89f72b91d218c6132ecea9
4
- data.tar.gz: c84ff19c62bc2dd2f178d266c06446465bbc2571
3
+ metadata.gz: f69b668e3ed248d4353ae4d0d45a0b1556435d18
4
+ data.tar.gz: b57f46e4c21d95ad19a29be45bf99abefc1e80fe
5
5
  SHA512:
6
- metadata.gz: 8cda16355b8fc8f217c05796bd6b9f524da98b4d9574e8b9a2827fefc05c336e706f3a2de5f5641965b9e95e88bbdfa7b89b3473b1a675c6d65d064ad6f5e205
7
- data.tar.gz: ff67f700686adcdad1dd2b2d6c661aab1ec7a0a85f0ebdf6d0a03fbef97fe157daec8970b890020aa559356577ba33344cf50643c823c74fc6456b8b3e83549c
6
+ metadata.gz: 5f25ab43a137b933d7daf44ff0ce4beedf57eaa8afa8b0d2b70ac42e94ec2a6a5b85c491d6248cf414082a3d4a080bcd573ecb50a2570a707bf93164c982971c
7
+ data.tar.gz: 7053d6533a53af42794609d0859495f70b8aaa6bee21635089dfb7f2d20f25cea155a34bf8f60c5c84ec2ef29d0b34facdfafda3827cfeff2d74f19ff5d56469
@@ -1,5 +1,11 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 0.2.4
4
+
5
+ - Fix bug that the Whirly thread will also stop when main thread throws error
6
+ (patch by @monkbroc)
7
+ - New spinner: xberg
8
+
3
9
  ### 0.2.3
4
10
 
5
11
  - Fix bug that in some cases whirly output would be shown on non-ttys
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Whirly 😀 [![[version]](https://badge.fury.io/rb/whirly.svg)](http://badge.fury.io/rb/whirly) [![[travis]](https://travis-ci.org/janlelis/whirly.png)](https://travis-ci.org/janlelis/whirly)
1
+ # Whirly 😀 [![[version]](https://badge.fury.io/rb/whirly.svg)](http://badge.fury.io/rb/whirly) [![[travis]](https://travis-ci.org/janlelis/whirly.svg)](https://travis-ci.org/janlelis/whirly)
2
2
 
3
- A simple, colorful and customizable terminal spinner library for Ruby. It comes with 23 custom spinners and also includes those from the [cli-spinners](https://github.com/sindresorhus/cli-spinners) project.
3
+ A simple, colorful and customizable terminal spinner library for Ruby. It comes with 24 custom spinners and also includes those from the [cli-spinners](https://github.com/sindresorhus/cli-spinners) project.
4
4
 
5
5
  ## Demonstration
6
6
 
@@ -60,7 +60,7 @@ Whirly.stop
60
60
  The `start` method takes a lot of options, like which spinner to use or an initial status. See further below for the full description of available options.
61
61
 
62
62
  ```ruby
63
- Whirly.start spinner: "pong", use_color: false, status: "The Game of Pong" do
63
+ Whirly.start spinner: "pong", color: false, status: "The Game of Pong" do
64
64
  sleep 10
65
65
  end
66
66
  ```
@@ -221,5 +221,54 @@
221
221
  "🞎",
222
222
  "🞔"
223
223
  ]
224
+ },
225
+ "xberg": {
226
+ "interval": 150,
227
+ "mode": "random",
228
+ "frames": [
229
+ "⨯",
230
+ "⛰",
231
+ "⛰",
232
+ "⛰",
233
+ "⛰",
234
+ "⛰",
235
+ "⛰"
236
+ ]
237
+ },
238
+ "circled_letter": {
239
+ "interval": 120,
240
+ "mode": "random",
241
+ "frames": [
242
+ "Ⓐ", "Ⓑ", "Ⓒ", "Ⓓ", "Ⓔ", "Ⓕ", "Ⓖ", "Ⓗ", "Ⓘ",
243
+ "Ⓙ", "Ⓚ", "Ⓛ", "Ⓜ", "Ⓝ", "Ⓞ", "Ⓟ", "Ⓠ", "Ⓡ",
244
+ "Ⓢ", "Ⓣ", "Ⓤ", "Ⓥ", "Ⓦ", "Ⓧ", "Ⓨ", "Ⓩ"
245
+ ]
246
+ },
247
+ "circled_number": {
248
+ "interval": 120,
249
+ "mode": "random",
250
+ "frames": [
251
+ "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"
252
+ ]
253
+ },
254
+ "letter_with_parens": {
255
+ "interval": 150,
256
+ "mode": "random",
257
+ "frames": [
258
+ "🄐", "🄑", "🄒", "🄓", "🄔", "🄕", "🄖", "🄗", "🄘",
259
+ "🄙", "🄚", "🄛", "🄜", "🄝", "🄞", "🄟", "🄠", "🄡",
260
+ "🄢", "🄣", "🄤", "🄥", "🄦", "🄧", "🄨", "🄩"
261
+ ]
262
+ },
263
+ "starlike": {
264
+ "interval": 120,
265
+ "mode": "random",
266
+ "frames": [
267
+ "✩", "✪", "✫", "✬", "✭", "✮", "✯", "✰",
268
+ "✱", "✲", "✳", "✴", "✵", "✶", "✷", "✸",
269
+ "✹", "✺", "✻", "✼", "✽", "✾", "✿", "❀",
270
+ "❁", "❂", "❃", "❄", "❅", "❆", "❇", "❈",
271
+ "❉", "❊"
272
+ ]
224
273
  }
225
274
  }
@@ -45,7 +45,7 @@ sleep 5
45
45
  print "\033c"
46
46
  puts Paint["Pong", :underline]
47
47
 
48
- Whirly.start spinner: "pong", use_color: false, status: "Two computers in a game of Pong" do
48
+ Whirly.start spinner: "pong", color: false, status: "Two computers in a game of Pong" do
49
49
  sleep 9
50
50
  end
51
51
 
@@ -3,4 +3,4 @@ require "paint"
3
3
 
4
4
  # Call a single spinner from the command-line
5
5
 
6
- Whirly.start(spinner: $*[0], status: $*[2] || $*[0], use_color: false){ sleep(($*[1] || 10).to_i) }
6
+ Whirly.start(spinner: $*[0], status: $*[2] || $*[0], color: false){ sleep(($*[1] || 10).to_i) }
Binary file
@@ -167,8 +167,11 @@ module Whirly
167
167
 
168
168
  # idiomatic block syntax support
169
169
  if block_given?
170
- yield
171
- Whirly.stop
170
+ begin
171
+ yield
172
+ ensure
173
+ Whirly.stop
174
+ end
172
175
  end
173
176
 
174
177
  true
@@ -4,13 +4,9 @@ module Whirly
4
4
  module Spinners
5
5
  WHIRLY = {
6
6
  "random_dots" => { "proc" => ->(){ [ 0x2800 + rand(256)].pack("U") }, "interval" => 100 },
7
- "circled_letter" => { "proc" => ->(){ [ 0x24B6 + rand(26) ].pack("U") }, "interval" => 120 },
8
- "circled_number" => { "proc" => ->(){ [ 0x2460 + rand(9) ].pack("U") }, "interval" => 120 },
9
- "starlike" => { "proc" => ->(){ [ 0x2729 + rand(34) ].pack("U") }, "interval" => 120 },
10
7
  "mahjong" => { "proc" => ->(){ [0x1F000 + rand(44)].pack("U") }, "interval" => 200 },
11
8
  "domino" => { "proc" => ->(){ [0x1F030 + rand(50)].pack("U") }, "interval" => 200 },
12
- "vertical_domino" => { "proc" => ->(){ [0x1F062 + rand(50)].pack("U") }, "interval" => 200 },
13
- "letters_with_parens" => { "proc" => ->(){ [0x1F110 + rand(26)].pack("U") }, "interval" => 150 },
9
+ "vertical_domino" => { "proc" => ->(){ [0x1F062 + rand(50)].pack("U") }, "interval" => 200 }
14
10
  }
15
11
  WHIRLY.merge! JSON.load(File.read(File.dirname(__FILE__) + "/../../../data/whirly-static-spinners.json"))
16
12
 
@@ -1,3 +1,3 @@
1
1
  module Whirly
2
- VERSION = "0.2.3".freeze
2
+ VERSION = "0.2.4".freeze
3
3
  end
@@ -376,4 +376,18 @@ describe Whirly do
376
376
  refute_predicate Whirly, :enabled?
377
377
  end
378
378
  end
379
+
380
+ describe "Error Handling" do
381
+ it "stops the spinner, when the main thread threw an exception [gh#3]" do
382
+ begin
383
+ Whirly.start status: "working" do
384
+ short_sleep
385
+ raise 'error!'
386
+ end
387
+ rescue
388
+ end
389
+
390
+ refute_predicate Whirly, :enabled?
391
+ end
392
+ end
379
393
  end
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.2.3
4
+ version: 0.2.4
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-10-08 00:00:00.000000000 Z
11
+ date: 2016-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unicode-display_width
@@ -50,6 +50,7 @@ files:
50
50
  - examples/multi_lines.rb
51
51
  - examples/single.rb
52
52
  - examples/status.rb
53
+ - lib/.whirly.rb.swp
53
54
  - lib/whirly.rb
54
55
  - lib/whirly/spinners.rb
55
56
  - lib/whirly/spinners/cli.rb