my_gems_summary 1.6 β 2.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 +47 -0
- data/lib/my_gems.rb +41 -6
- data/logo.png +0 -0
- data/mygems.gif +0 -0
- metadata +5 -3
- data/Gemfile.lock +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b32f3bb93fd160b0a6a9de002ba664ee9382e41f0228fcc7166f79c69eb1f072
|
4
|
+
data.tar.gz: 0e4ab8fd17602db42550bfb5ea8ebd4bcd1e61870c1d1e1f99791b783c6180d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a0582694ff5d411efce960ea4c8a5ab487c374db33502348eb012b023988e0e5c5901fc16ee8e4e178a1a0a884ea583ad9b442415920b9ede4b56b396088105
|
7
|
+
data.tar.gz: dc71e831347ae639f1a8b27f7ce24af01c1cd24a8842fe7c6fa9cbc834800cf0dcd2a0c38fb6d48bbc94c2c49bac28eb7b5105a49d988072e8140949c7567f5d
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
<h1 align="center">Welcome to my-gems-summary-cli π</h1>
|
2
|
+
|
3
|
+
|
4
|
+
<div align="center">
|
5
|
+
<img alt="logo" src="logo.png" />
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<img alt="Version" src="https://img.shields.io/badge/version-4-blue.svg?cacheSeconds=2592000" />
|
10
|
+
<a href="https://twitter.com/kammzinho" target="_blank">
|
11
|
+
<img alt="Twitter: kammzinho" src="https://img.shields.io/twitter/follow/kammzinho.svg?style=social" />
|
12
|
+
</a>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
> A gem to get a summary of your gems.
|
16
|
+
|
17
|
+
|
18
|
+
## Install
|
19
|
+
|
20
|
+
```sh
|
21
|
+
gem install my_gems_summary
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
```sh
|
27
|
+
mygems
|
28
|
+
```
|
29
|
+
|
30
|
+
<div align="center">
|
31
|
+
<img alt="usage" src="mygems.gif" />
|
32
|
+
</div>
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
## Author
|
37
|
+
|
38
|
+
π€ **VinΓcius Kammradt**
|
39
|
+
|
40
|
+
* Website: https://kammradt.super.site
|
41
|
+
* Twitter: [@kammzinho](https://twitter.com/kammzinho)
|
42
|
+
* Github: [@kammradt](https://github.com/kammradt)
|
43
|
+
* LinkedIn: [@vinicius-kammradt](https://linkedin.com/in/vinicius-kammradt)
|
44
|
+
|
45
|
+
## Show your support
|
46
|
+
|
47
|
+
Give a βοΈ if this project helped you!
|
data/lib/my_gems.rb
CHANGED
@@ -1,22 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'gems'
|
2
4
|
|
3
5
|
GemDTO = Struct.new(:name, :downloads)
|
4
6
|
|
5
7
|
module MyGems
|
8
|
+
def self.valid_credentials?
|
9
|
+
Gems.gems
|
10
|
+
rescue StandardError
|
11
|
+
puts 'π₯Ί Opps, looks like we are missing your rubygems.org credentials π'
|
12
|
+
puts "π₯Ί Let's authenticate π"
|
13
|
+
|
14
|
+
puts "π» Please run 'gem signin' and try again π»"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.my_gems
|
18
|
+
gems = Gems.gems.map { |gem| GemDTO.new(gem['name'], gem['downloads']) }
|
19
|
+
gems.sort_by(&:downloads).reverse
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.valid_gems?(gems)
|
23
|
+
return gems unless gems.empty?
|
24
|
+
|
25
|
+
puts 'π₯Ί Opps, looks like you have no gems π'
|
26
|
+
puts "π₯Ί Let's add some π»"
|
27
|
+
|
28
|
+
puts "π» Please run 'gem build & gem push' and try again π»"
|
29
|
+
puts "π» Maybe you can find some funny stuff here github.com/kammradt π»"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.gem_with_longest_name(gems)
|
33
|
+
gems.max_by { |gem| gem.name.length }
|
34
|
+
end
|
35
|
+
|
6
36
|
def self.show
|
7
37
|
puts "β Let's see if you're a star!β "
|
38
|
+
return unless valid_credentials?
|
39
|
+
|
40
|
+
gems = my_gems
|
41
|
+
return unless valid_gems?(gems)
|
42
|
+
|
8
43
|
puts "π Here's your summary:"
|
9
44
|
puts "\n"
|
10
45
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
my_gems.each do |gem|
|
15
|
-
name_output = gem.name.ljust(gem_with_longest_name.first.length)
|
46
|
+
gems.each do |gem|
|
47
|
+
name_output = gem.name.ljust(gem_with_longest_name(gems).name.length)
|
16
48
|
puts "π #{name_output} π #{gem.downloads} downloads"
|
17
49
|
end
|
50
|
+
puts "\n"
|
51
|
+
|
52
|
+
puts "π You're a star with #{gems.map(&:downloads).sum} total downloads π"
|
18
53
|
|
19
54
|
puts "\n"
|
20
|
-
puts
|
55
|
+
puts 'Bye! See you soon πππ'
|
21
56
|
end
|
22
57
|
end
|
data/logo.png
ADDED
Binary file
|
data/mygems.gif
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_gems_summary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1
|
4
|
+
version: '2.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinicius Kammradt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gems
|
@@ -33,10 +33,12 @@ extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
35
|
- Gemfile
|
36
|
-
-
|
36
|
+
- README.md
|
37
37
|
- bin/mygems
|
38
38
|
- bin/setup
|
39
39
|
- lib/my_gems.rb
|
40
|
+
- logo.png
|
41
|
+
- mygems.gif
|
40
42
|
homepage: https://github.com/kammradt/my-gems-summary-cli
|
41
43
|
licenses:
|
42
44
|
- MIT
|
data/Gemfile.lock
DELETED