my_gems_summary 1.4 β†’ 1.9

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
  SHA256:
3
- metadata.gz: 0a5a385fdaa348ac1f9bc282270cc47159e161f3d69cfd01c8d862be33b98f1c
4
- data.tar.gz: 1e549c18397dff358916fabf8a29f5cbf1d226be5d549ccac7e2e7fcc069f3c0
3
+ metadata.gz: 7e4d06cab4aca96fbb1aed48190fa1d263ceeb9579e76606d29977008f9495d7
4
+ data.tar.gz: f57e77ad2cbb254720498728d771b8167ca33b8163935fe9cc53453382d0437c
5
5
  SHA512:
6
- metadata.gz: 37de4a35d2d6ea93243063f8c7adffe396479d75a1788bcf56569c0ae669b22ff7a2e030b1d0b94bdf583f9e6fcabfd86c6d97c24084a602d933c1019bc96d51
7
- data.tar.gz: '0943715f27e413a16b0fe85c78893ae14cf85340084ece287c24191611676633673d19ecc00f577664084e5fd69c303854c0c001a02921ec73018bb36e7f407c'
6
+ metadata.gz: cb4633be8cfa8ea985fad678c0cb272fc4eafea1bc753e75a42b81dde4e2a689e8dd6b8033079c8b8565cf11b84741a9a2f48be667948f86f6da2364d4d8976c
7
+ data.tar.gz: cd85c610ac05d9a77f26a2e7340ef9d76d77681a05774dcae470e0c3e89320d65ca8f01ab2d9ca44bc87c3595ba522a9274b1f870457c8bd96a580d595a0171f
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in underscore.gemspec
6
+ gemspec
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/bin/mygems CHANGED
@@ -4,4 +4,4 @@
4
4
  require 'bundler/setup'
5
5
  require_relative '../lib/my_gems'
6
6
 
7
- puts MyGems::show
7
+ puts MyGems.show
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/my_gems.rb ADDED
@@ -0,0 +1,37 @@
1
+ require 'gems'
2
+
3
+ GemDTO = Struct.new(:name, :downloads)
4
+
5
+ module MyGems
6
+ def self.valid_credentials?
7
+ begin
8
+ Gems.gems
9
+ rescue
10
+ puts 'πŸ₯Ί Opps, looks like we are missing your rubygems.org credentials 😭'
11
+ puts "πŸ₯Ί Let's authenticate 😭"
12
+
13
+ puts "πŸ’» Please run 'gem signin' and try again πŸ’»"
14
+ end
15
+ end
16
+
17
+ def self.show
18
+ puts "⭐ Let's see if you're a star!⭐ "
19
+ return unless valid_credentials?
20
+
21
+ puts "πŸ“š Here's your summary:"
22
+ puts "\n"
23
+
24
+ my_gems = Gems.gems.map { |gem| GemDTO.new(gem['name'], gem['downloads']) }
25
+ my_gems = my_gems.sort_by(&:downloads).reverse
26
+
27
+ gem_with_longest_name = my_gems.max_by { |gem| gem.name.length }
28
+
29
+ my_gems.each do |gem|
30
+ name_output = gem.name.ljust(gem_with_longest_name.first.length)
31
+ puts "πŸ›‘ #{name_output} πŸ” #{gem.downloads} downloads"
32
+ end
33
+
34
+ puts "\n"
35
+ puts "Bye! See you soon πŸ‘‹πŸ‘‹πŸ‘‹"
36
+ end
37
+ end
data/logo.png ADDED
Binary file
data/mygems.gif ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_gems_summary
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: '1.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinicius Kammradt
@@ -32,7 +32,13 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - Gemfile
36
+ - README.md
35
37
  - bin/mygems
38
+ - bin/setup
39
+ - lib/my_gems.rb
40
+ - logo.png
41
+ - mygems.gif
36
42
  homepage: https://github.com/kammradt/my-gems-summary-cli
37
43
  licenses:
38
44
  - MIT