progress_download 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -5
- data/bin/progress-download +2 -2
- data/lib/progress_download.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 235c52cf3d6ac47f73ca74486c4c09986af9e0a6a1f30c83c8b70fd150e5f764
|
4
|
+
data.tar.gz: 03dc9fb00adb6ed6334666ff6b0eef302ef63af8a094ca27dde7f01c6fda7561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8efbd0317b2118c262caab4b6db1800f4312e62879c1e195af653d68ae6a55ac1f3b2dc889c42da79db3ac0f4f21c60c6ab120b2f2ccaeb1e5c2de275111ca0f
|
7
|
+
data.tar.gz: 7fcaf289d84cc77270da37353c4da6bbf9733dd5ae4382043e7592c4bcbc55d2f61bc70eb21d875e49da4353b132b628c6a067421b0b35c20904f851c2734a9b
|
data/README.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Progress Download
|
2
|
-
> Simple customisable progress bar in Ruby.
|
2
|
+
> Simple customisable progress bar for downloading remote files in Ruby.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
In your shell:
|
6
|
+
```shell
|
7
|
+
gem install progress_download
|
8
|
+
```
|
9
|
+
or, form source
|
10
|
+
```shell
|
11
|
+
git clone https://github.com/Demonstrandum/progress_download.git
|
12
|
+
cd progress_download/
|
13
|
+
```
|
14
|
+
Then install it:
|
15
|
+
```shell
|
16
|
+
gem build progress_download.gemspec
|
17
|
+
gem install progress_download-*
|
18
|
+
```
|
19
|
+
or use it directly:
|
20
|
+
```shell
|
21
|
+
ruby -Ilib bin/* [OPTIONS] ... [URL]
|
22
|
+
# or just copy the lib direcotry to where you need it
|
23
|
+
```
|
3
24
|
|
4
25
|
## Usage
|
5
26
|
You may test it out in your terminal by doing:
|
@@ -8,7 +29,16 @@ progress-download [STYLE] [URI]
|
|
8
29
|
# For example
|
9
30
|
progress-download --style pump http://ipv4.download.thinkbroadband.com/10MB.zip
|
10
31
|
```
|
11
|
-
|
32
|
+
Output should look something like:
|
33
|
+
```shell
|
34
|
+
‘10MB.zip’ — 8.44 / 10.0 MiB at 1.76 MiB/s in 4.78s
|
35
|
+
⠴ [ █████████████████████████████████████████████▒▒▒▒▒▒▒▒▒ ] 84%
|
36
|
+
# ...
|
37
|
+
‘10MB.zip’ — 10.00 / 10.0 MiB at 1.85 MiB/s in 5.41s
|
38
|
+
⠶ [ ██████████████████████████████████████████████████████ ] 100%
|
39
|
+
```
|
40
|
+
where the bar fills the entier width of the terminal
|
41
|
+
### In Ruby
|
12
42
|
```ruby
|
13
43
|
# Basic usage
|
14
44
|
url = 'http://ipv4.download.thinkbroadband.com/10MB.zip'
|
@@ -21,7 +51,6 @@ ProgressBar.download url, :location => '~/Downloads', :style => :classic, :speed
|
|
21
51
|
- `:style` is `:dots`
|
22
52
|
- `:speed` is `1`
|
23
53
|
and
|
24
|
-
- `:refresh` is 0.125
|
54
|
+
- `:refresh` is `0.125`
|
25
55
|
|
26
|
-
`:refresh` is the amount of time between '
|
27
|
-
`:speed` must be 1 or less, 1 meaning that the spinner advances one step for every 'frame' drawn, and 0.5 would be every second frame, etc.
|
56
|
+
`:refresh` is the amount of time between each 'frame' in seconds, by this, `:speed` is how many times the spinner updates per frame drawn, meaning thusly that `:speed` must be 1 or less, 1 meaning that the spinner advances one step for every 'frame' drawn, and 0.5 would be every second frame, etc.
|
data/bin/progress-download
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require '
|
2
|
+
require 'progress_download'
|
3
3
|
|
4
4
|
style = ARGV.include?('--style') ? ARGV[ARGV.index('--style') + 1] : :dots
|
5
5
|
if ARGV.include? '--style'
|
@@ -7,4 +7,4 @@ if ARGV.include? '--style'
|
|
7
7
|
ARGV.delete '--style'
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
ProgressDownload.download ARGV[0], :spinner => style
|
data/lib/progress_download.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Dir["#{File.dirname __FILE__}/progress_download/*.rb"].each { |f| require f }
|
2
2
|
|
3
3
|
module ProgressDownload
|
4
|
-
VERSIONS = { :major => 0, :minor => 1, :tiny =>
|
4
|
+
VERSIONS = { :major => 0, :minor => 1, :tiny => 1 }.freeze
|
5
5
|
|
6
6
|
def self.version *args
|
7
7
|
VERSIONS.flatten.select.with_index { |_, i| i.odd? }.join '.'
|