my_gems_summary 1.5 β†’ 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -0
  3. data/README.md +47 -0
  4. data/bin/setup +8 -0
  5. data/lib/my_gems.rb +54 -0
  6. data/logo.png +0 -0
  7. data/mygems.gif +0 -0
  8. metadata +7 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c06417983f9ec2b4355dd7a3f6d0a06339b5d349630d37f1f3905d3210c0307
4
- data.tar.gz: f563835d063d539d63105d8ca46258f3262190123022b25658f6e20b0230e262
3
+ metadata.gz: da9d1a6ba99119d2d1676383249150b0426eeec6e58ac96b8e8b4c0935929434
4
+ data.tar.gz: ffa25cc33a588b889b645af17ba07eca69855e57ace48492e61bcf0d0a5ec8eb
5
5
  SHA512:
6
- metadata.gz: ac62d179c806b002326fc3fcd3ae4ba2e8bf273c024486297b650cc9dc41984b2fb2aa592d806290931ff3d7a125bce55e1ed63a9d75f1cf7366d94dddfbf670
7
- data.tar.gz: 82a16233cff59eb0bc9fd03dcdd270973f3cf8f33779f76807162c27deb882f19b77ccd936921806dc83ec0b01b8bec1830a8d69acdc340f52035faa6af3c4c4
6
+ metadata.gz: 3e7dfc6280ed49334a1be4cfc18c8ef0e7226e3acb1fb932233543676d86007d2b8b2bb83cca93bf36bbdec63fe4133cc806eeb098e8a0c7a08f72131f81fd9b
7
+ data.tar.gz: 2f29383a74fb0db90a8cc0d157a9e07384619ea5ac755207ebf4018698366aeaefe9be88e90fc28d2d6048a42859033b95e8c65b79c2f96eaa9cebf88348ace6
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/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,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gems'
4
+
5
+ GemDTO = Struct.new(:name, :downloads)
6
+
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
+
36
+ def self.show
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
+
43
+ puts "πŸ“š Here's your summary:"
44
+ puts "\n"
45
+
46
+ gems.each do |gem|
47
+ name_output = gem.name.ljust(gem_with_longest_name(gems).name.length)
48
+ puts "πŸ›‘ #{name_output} πŸ” #{gem.downloads} downloads"
49
+ end
50
+
51
+ puts "\n"
52
+ puts 'Bye! See you soon πŸ‘‹πŸ‘‹πŸ‘‹'
53
+ end
54
+ 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.5'
4
+ version: '2.0'
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