rpv 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +25 -0
- data/Rakefile +10 -0
- data/lib/rpv/extensions.rb +21 -0
- data/lib/rpv/global.rb +13 -0
- data/lib/rpv/options.rb +16 -0
- data/lib/rpv/version.rb +5 -0
- data/lib/rpv.rb +17 -0
- data/sig/rpv.rbs +4 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fdb60cbf7a2013a1c3d8f226de95a1fe2504d5d783d475d693caec111100e58b
|
4
|
+
data.tar.gz: 283247bce675713e7b752461fcf6ce458c4d9e9e3d70a63d633dd943b14a7c85
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3374d40f52abb43edb38a6d27641e6b2d3d1e9080c705ece404a984b475a53257430c64361fb65f400d81f94985911eae3854dd185486e39018b686317c3723a
|
7
|
+
data.tar.gz: b684b97e157f6a7314206d30bb6d2670c3702b9b288ac463e468da1d883cfbcdb76df1f53e15f22d878518c5b9b940640cb25df864723719fd6b9b73a079d58a
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Sergio Gil
|
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,25 @@
|
|
1
|
+
# Rpv
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Install the gem and add to the application's Gemfile by executing:
|
6
|
+
|
7
|
+
$ bundle add rpv
|
8
|
+
|
9
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
10
|
+
|
11
|
+
$ gem install rpv
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
TODO: Write usage instructions here
|
16
|
+
|
17
|
+
## Development
|
18
|
+
|
19
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
20
|
+
|
21
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
Bug reports and pull requests are welcome on Codeberg at https://codeberg.org/sgilperez/rpv.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "rpv"
|
2
|
+
require "rpv/global"
|
3
|
+
|
4
|
+
module Enumerable
|
5
|
+
def with_rpv(**options)
|
6
|
+
Rpv::Global.init(size: size, **options)
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def finish_rpv
|
11
|
+
Rpv::Global.finish
|
12
|
+
self
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Object
|
17
|
+
def rpv
|
18
|
+
Rpv::Global.increment
|
19
|
+
self
|
20
|
+
end
|
21
|
+
end
|
data/lib/rpv/global.rb
ADDED
data/lib/rpv/options.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class Rpv::Options
|
2
|
+
MAPPED_OPTIONS = %w[size name interval rate_limit]
|
3
|
+
BOOLEAN_MAPPED_OPTIONS = %w[quiet progress fineta]
|
4
|
+
|
5
|
+
def self.parse(options)
|
6
|
+
options.transform_keys!(&:to_s)
|
7
|
+
args = %w[--si --line-mode --discard --cursor]
|
8
|
+
MAPPED_OPTIONS.each do |option|
|
9
|
+
args << ["--#{option.tr("_", "-")}", options[option].to_s] if options[option]
|
10
|
+
end
|
11
|
+
BOOLEAN_MAPPED_OPTIONS.each do |option|
|
12
|
+
args << "--#{option.tr("_", "-")}" if options[option]
|
13
|
+
end
|
14
|
+
args.flatten
|
15
|
+
end
|
16
|
+
end
|
data/lib/rpv/version.rb
ADDED
data/lib/rpv.rb
ADDED
data/sig/rpv.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rpv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergio Gil
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- sgilperez@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".rspec"
|
21
|
+
- ".standard.yml"
|
22
|
+
- CHANGELOG.md
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/rpv.rb
|
27
|
+
- lib/rpv/extensions.rb
|
28
|
+
- lib/rpv/global.rb
|
29
|
+
- lib/rpv/options.rb
|
30
|
+
- lib/rpv/version.rb
|
31
|
+
- sig/rpv.rbs
|
32
|
+
homepage: https://codeberg.org/sgilperez/rpv
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata:
|
36
|
+
homepage_uri: https://codeberg.org/sgilperez/rpv
|
37
|
+
source_code_uri: https://codeberg.org/sgilperez/rpv
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.0.0
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubygems_version: 3.5.3
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: Provides progress bars (including multiple parallel bars) and rate limiting
|
57
|
+
by wrapping pv
|
58
|
+
test_files: []
|