powerbar 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b45f823f33ebcefa93876e94ce58e6b4d3e02604
4
- data.tar.gz: 9a7ee07b6e352b6a138504144090af09b42e071e
3
+ metadata.gz: 4d7b69a940b100adf7d075d39e0e861a2fe11e52
4
+ data.tar.gz: ed6d0bb872782aca625c0883e397210f14b00b90
5
5
  SHA512:
6
- metadata.gz: 50db1bf010c6316f6a9a4401e694302dbfa8b571d87fe6e39e38053eb10c817752ec16110885887e517f81adc221611ec97d705afaff3842e4d7c6541d9d1897
7
- data.tar.gz: 644526c0d60133e02a576cdbd16e181749a40ccf6d83db19c6860d6ba3e8829cb955d50c58448225e755e621d1344dc607969e52ea48c0edb35ffc32a884d27c
6
+ metadata.gz: 38a535f86d864c4d30e9e11f7fd891f6bd0afe2af05f5039f7403080cb3c9b14585585e9fc3ebbe3725f2b6a41acc35c646d1968852883f0d80553bb19d7d2ff
7
+ data.tar.gz: deee7b06944397b0135f295ce685d2091e5a11b712f8b391c156cca505cec65ced7a8d02e9be6f1a702423d75df92a3f4cc5a879b84d3f1534b2b55aca1a29aa
@@ -1,8 +1,8 @@
1
- = PowerBar
1
+ # PowerBar
2
2
 
3
3
  This is PowerBar - The last progressbar-library you'll ever need.
4
4
 
5
- == Features
5
+ ## Features
6
6
 
7
7
  * Detects when stdout is not a terminal and automatically falls back to logging
8
8
  * Does not clutter your log-files with ansi-codes!
@@ -21,54 +21,54 @@ This is PowerBar - The last progressbar-library you'll ever need.
21
21
  multi-part operation then you can change the status-message of a running
22
22
  PowerBar to reflect the current state.
23
23
 
24
- == Screenshot
24
+ ## Demo
25
25
 
26
- {screenshot}[http://github.com/busyloop/powerbar/raw/master/ass/screenshot.png]
26
+ ![screencast](https://github.com/busyloop/powerbar/raw/master/ass/screencast.gif?raw=true)
27
27
 
28
+ ## Installation
28
29
 
29
- == Installation
30
+ `gem install powerbar`
30
31
 
31
- gem install powerbar
32
-
33
- == Getting Started
32
+ ## Getting Started
34
33
 
35
34
  Watch the demo that was installed along with the gem:
36
35
 
37
- powerbar-demo
36
+ `powerbar-demo`
38
37
 
39
- Then look at the {source-code}[https://github.com/busyloop/powerbar/blob/master/bin/powerbar-demo] of the demo. Pretty much all use-cases are covered in there, including templates and how to hook in your own logger.
38
+ Then look at the [source-code](https://github.com/busyloop/powerbar/blob/master/bin/powerbar-demo) of the demo. Pretty much all use-cases are covered in there, including templates and how to hook in your own logger.
40
39
 
41
40
 
42
- == Example (for the impatient)
41
+ ## Example (for the impatient)
43
42
 
44
- #!/usr/bin/env ruby
43
+ ```
44
+ #!/usr/bin/env ruby
45
45
 
46
- require 'powerbar'
46
+ require 'powerbar'
47
47
 
48
- total = 100000
49
- step = 1000
48
+ total = 100000
49
+ step = 1000
50
50
 
51
- p = PowerBar.new
51
+ p = PowerBar.new
52
52
 
53
- # Override some defaults to demonstrate how the settings work
54
- p.settings.tty.finite.template.barchar = '*'
55
- p.settings.tty.finite.template.padchar = '.'
53
+ # Override some defaults to demonstrate how the settings work
54
+ p.settings.tty.finite.template.barchar = '*'
55
+ p.settings.tty.finite.template.padchar = '.'
56
56
 
57
- # Dummy loop to simulate some progress
58
- (0..total).step(step).each do |i|
59
- p.show(:msg => 'DEMO 1 - Ten seconds of progress', :done => i, :total => total)
60
- sleep 0.1
61
- end
62
- p.close
57
+ # Dummy loop to simulate some progress
58
+ (0..total).step(step).each do |i|
59
+ p.show(:msg => 'DEMO 1 - Ten seconds of progress', :done => i, :total => total)
60
+ sleep 0.1
61
+ end
62
+ p.close
63
+ ```
63
64
 
64
- == Documentation?
65
+ ## Documentation?
65
66
 
66
- Use the {source}[https://github.com/busyloop/powerbar/blob/master/lib/powerbar.rb], Luke!
67
+ Use the [source](https://github.com/busyloop/powerbar/blob/master/lib/powerbar.rb), Luke!
67
68
 
68
- == License (MIT)
69
+ ## License (MIT)
69
70
 
70
71
  Copyright (C) 2011 by moe@busyloop.net
71
-
72
72
  Permission is hereby granted, free of charge, to any person obtaining a copy
73
73
  of this software and associated documentation files (the "Software"), to deal
74
74
  in the Software without restriction, including without limitation the rights
Binary file
@@ -37,7 +37,7 @@ class PowerBar
37
37
  :time_last_show => Time.at(0), # <- don't mess with us
38
38
  :time_last_update => Time.at(0), # <- unless you know
39
39
  :time_start => nil, # <- what you're doing!
40
- :time_now => nil, # <-
40
+ :time_now => nil, # <-
41
41
  :msg => 'PowerBar!',
42
42
  :done => 0,
43
43
  :total => :unknown,
@@ -199,7 +199,7 @@ class PowerBar
199
199
  state.time_start ||= Time.now
200
200
  state.time_now = Time.now
201
201
 
202
- @rate ||= PowerBar::Rate.new(state.time_now,
202
+ @rate ||= PowerBar::Rate.new(state.time_now,
203
203
  state.settings.rate_sample_window,
204
204
  state.settings.rate_sample_max_interval)
205
205
  @rate.append(state.time_now, state.done)
@@ -309,7 +309,14 @@ class PowerBar
309
309
  end
310
310
 
311
311
  def terminal_width
312
- ANSI::Terminal.terminal_width - 1
312
+ if /solaris/ =~ RUBY_PLATFORM && (`stty` =~ /\brows = (\d+).*\bcolumns = (\d+)/)
313
+ w, r = [$2, $1]
314
+ else
315
+ w, r = `stty size 2>/dev/null`.split.reverse
316
+ end
317
+ w = `tput cols` unless w
318
+ w = w.to_i if w
319
+ w
313
320
  end
314
321
 
315
322
  private
@@ -353,7 +360,7 @@ class PowerBar
353
360
 
354
361
  HQ_UNITS = %w(b k M G T).freeze
355
362
  def humanize_quantity(number, format='%n%u')
356
- return nil if number.nil?
363
+ return nil if number.nil?
357
364
  return nil if number.is_a? Float and (number.nan? or number.infinite?)
358
365
  kilo = settings.kilo
359
366
  return number if number.to_i < kilo
@@ -1,3 +1,3 @@
1
1
  class Powerbar
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  end
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
12
12
  s.description = %q{The last progressbar-library you'll ever need}
13
13
  s.license = "MIT"
14
14
 
15
- s.add_dependency "ansi", "~> 1.5.0"
16
15
  s.add_dependency "hashie", ">= 1.1.0"
17
16
 
18
17
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powerbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-17 00:00:00.000000000 Z
11
+ date: 2015-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: ansi
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 1.5.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 1.5.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: hashie
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -48,8 +34,9 @@ extra_rdoc_files: []
48
34
  files:
49
35
  - ".gitignore"
50
36
  - Gemfile
51
- - README.rdoc
37
+ - README.MD
52
38
  - Rakefile
39
+ - ass/screencast.gif
53
40
  - ass/screenshot.png
54
41
  - bin/powerbar-demo
55
42
  - lib/powerbar.rb