tmg 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f467a477f7a99744caf4f7c8a562fc320dd4661f1e428e79f9a2d40be3fca29e
4
+ data.tar.gz: dc6e554273df6cea215052166917030b58ba5be8ddee24aaacb897842731ab6b
5
+ SHA512:
6
+ metadata.gz: eb82bd055d86191a46fb84e8dac41893efbaf2281e857d95b6fc4ac16bb956a8385df1955f5c9eb6ecd8ab17c8136fb3d35f92a364fb998ecfd65549efaf6362
7
+ data.tar.gz: f4ba9adda4d1b1cfab6a7980d560b3fdec8e9bf952041b2c9cea6fa757baa3123036d029850a60e5bf5e15e1975da1562eb1a0ca4b89cdd2920855f57625ecb7
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+
5
+ ---
6
+
7
+ **Describe the bug**
8
+ A clear and concise description of what the bug is.
9
+
10
+ **To Reproduce**
11
+ Steps to reproduce the behavior:
12
+ 1. Call this argument
13
+ 2. Remove configuration file
14
+ 3. Call argument again with some flag
15
+
16
+ **Expected behavior**
17
+ A clear and concise description of what you expected to happen.
18
+
19
+ **Screenshots**
20
+ If applicable, add screenshots to help explain your problem.
21
+
22
+ **Desktop (please complete the following information):**
23
+ - OS: [e.g. Ubuntu/Windows/Fedora/Arch/OSX]
24
+ - Version [e.g. 0.4.1]
25
+
26
+ **Additional context**
27
+ Add any other context about the problem here.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+
5
+ ---
6
+
7
+ **Is your feature request related to a problem? Please describe.**
8
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9
+
10
+ **Describe the solution you'd like**
11
+ A clear and concise description of what you want to happen.
12
+
13
+ **Describe alternatives you've considered**
14
+ A clear and concise description of any alternative solutions or features you've considered.
15
+
16
+ **Additional context**
17
+ Add any other context or screenshots about the feature request here.
data/.gitignore ADDED
@@ -0,0 +1,90 @@
1
+
2
+ # Created by https://www.gitignore.io/api/sublimetext,ruby
3
+
4
+ ### Ruby ###
5
+ *.gem
6
+ *.rbc
7
+ /.config
8
+ /coverage/
9
+ /InstalledFiles
10
+ /pkg/
11
+ /spec/reports/
12
+ /spec/examples.txt
13
+ /test/tmp/
14
+ /test/version_tmp/
15
+ /tmp/
16
+
17
+ # Used by dotenv library to load environment variables.
18
+ # .env
19
+
20
+ ## Specific to RubyMotion:
21
+ .dat*
22
+ .repl_history
23
+ build/
24
+ *.bridgesupport
25
+ build-iPhoneOS/
26
+ build-iPhoneSimulator/
27
+
28
+ ## Specific to RubyMotion (use of CocoaPods):
29
+ #
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33
+ #
34
+ # vendor/Pods/
35
+
36
+ ## Documentation cache and generated files:
37
+ /.yardoc/
38
+ /_yardoc/
39
+ /doc/
40
+ /rdoc/
41
+
42
+ ## Environment normalization:
43
+ /.bundle/
44
+ /vendor/bundle
45
+ /lib/bundler/man/
46
+
47
+ # for a library or gem, you might want to ignore these files since the code is
48
+ # intended to run in multiple environments; otherwise, check them in:
49
+ Gemfile.lock
50
+ # .ruby-version
51
+ # .ruby-gemset
52
+
53
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
54
+ .rvmrc
55
+
56
+ ### SublimeText ###
57
+ # Cache files for Sublime Text
58
+ *.tmlanguage.cache
59
+ *.tmPreferences.cache
60
+ *.stTheme.cache
61
+
62
+ # Workspace files are user-specific
63
+ *.sublime-workspace
64
+
65
+ # Project files should be checked into the repository, unless a significant
66
+ # proportion of contributors will probably not be using Sublime Text
67
+ # *.sublime-project
68
+
69
+ # SFTP configuration file
70
+ sftp-config.json
71
+
72
+ # Package control specific files
73
+ Package Control.last-run
74
+ Package Control.ca-list
75
+ Package Control.ca-bundle
76
+ Package Control.system-ca-bundle
77
+ Package Control.cache/
78
+ Package Control.ca-certs/
79
+ Package Control.merged-ca-bundle
80
+ Package Control.user-ca-bundle
81
+ oscrypto-ca-bundle.crt
82
+ bh_unicode_properties.cache
83
+
84
+ # Sublime-github package stores a github token in this file
85
+ # https://packagecontrol.io/packages/sublime-github
86
+ GitHub.sublime-settings
87
+
88
+
89
+ # End of https://www.gitignore.io/api/sublimetext,ruby
90
+ .env
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_gem:
2
+ relaxed-rubocop: .rubocop.yml
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.16.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at franccesco@codingdose.info. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
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 tmg.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Franccesco Orozco
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,53 @@
1
+ # Tmg
2
+ A CLI built in Ruby to track your gems stats on RubyGems.org.
3
+
4
+ This is mostly a personal project to **keep track of my gems** and also to **checkout the latest version information of another gem.** I grew tired of going to the rubygems.org website or the github repo of a project to check what's the latest version of a gem to add it to my project.
5
+
6
+ ## Installation
7
+
8
+ Install it yourself as:
9
+
10
+ $ gem install tmg
11
+
12
+ ## Usage
13
+ ![TMG Usage](assets/tmg_usage.gif)
14
+
15
+ ### Login to RubyGems.org
16
+ First you have to login to the RubyGems.org repository with:
17
+
18
+ $ tmg login
19
+
20
+ Input your username and password and you should good to go.
21
+
22
+ ### Commands
23
+ ```sh
24
+ $ tmg help
25
+ Commands:
26
+ tmg about # Displays version number and information.
27
+ tmg documentation # Open browser to gem's documentation
28
+ tmg help [COMMAND] # Describe available commands or one specific command
29
+ tmg homepage # Open browser to gem's homepage
30
+ tmg info [GEM] # Shows information about a specific gem.
31
+ tmg list # Show a list of your published gems.
32
+ tmg login # Request access to RubyGems.org
33
+ tmg user [USERNAME] # Shows gems owned by another username
34
+ tmg version [gems] # Displays latest version of gems.
35
+ tmg wiki # Open browser to gem's wiki
36
+ ```
37
+
38
+ ## Development
39
+ If you're interested and want to invest your time in this project you can fork the repository and submit changes to the **develop** branch!
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/franccesco/tmg. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the Tmg project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tmg/blob/master/CODE_OF_CONDUCT.md).
52
+
53
+ ![About](assets/tmg_about.png)
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
Binary file
Binary file
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tmg"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
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/exe/tmg ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'tmg/cli'
3
+
4
+ Tmg::CLI.start
@@ -0,0 +1,16 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'about', 'Displays version number and information.'
4
+ # Displays information about the installed TMG gem such as:
5
+ # version, author, developer twitter profile and blog, and a banner.
6
+ def about
7
+ puts Tmg::BANNER.bold.red
8
+ puts 'version: '.bold + Tmg::VERSION.green
9
+ puts 'author: '.bold + 'Franccesco Orozco'.green
10
+ puts 'Twitter: '.bold + '@__franccesco'.green
11
+ puts 'homepage: '.bold + 'https://github.com/franccesco/tmg'.green
12
+ puts 'learn more: '.bold + 'https://codingdose.info'.green
13
+ puts # extra line, somehow I like them.
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'documentation', 'Open browser to gem\'s documentation'
4
+ # Open browser and navigates to gem's documentation
5
+ def documentation(gem)
6
+ documentation_uri = Gems.info(gem)['documentation_uri']
7
+ if documentation_uri.nil?
8
+ puts "No documentation page for ".red.bold + gem.yellow.bold
9
+ exit(1)
10
+ else
11
+ puts 'Opening documentation for: '.green.bold + gem
12
+ Launchy.open(documentation_uri)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'homepage', 'Open browser to gem\'s homepage'
4
+ # Open browser and navigates to gem's homepage
5
+ def homepage(gem)
6
+ homepage_uri = Gems.info(gem)['homepage_uri']
7
+ if homepage_uri.nil?
8
+ puts "No homepage for ".red.bold + gem.yellow.bold
9
+ exit(1)
10
+ else
11
+ puts 'Opening homepage of: '.green.bold + gem
12
+ Launchy.open(homepage_uri)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'info [GEM]', 'Shows information about a specific gem.'
4
+ method_option :dependencies,
5
+ aliases: '-d',
6
+ type: :boolean,
7
+ desc: 'Show dependencies.'
8
+ # Displays information about a gem, optionally displaying
9
+ # runtime dependencies and development dependencies.
10
+ def info(gem)
11
+ display_gem_info(false, options[:dependencies], gem)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'list', 'Show a list of your published gems.'
4
+ method_option :dependencies,
5
+ aliases: '-d',
6
+ type: :boolean,
7
+ desc: 'Show dependencies.'
8
+ # Shows a list of your gems published on RubyGems.org
9
+ # If forces you to login first if it's unable to find the credentials
10
+ # under your home folder. After that, it retrieves a summary consisting
11
+ # in the most relevant information only such as info, downloads, version,
12
+ # and homepage.
13
+ def list
14
+ unless File.file?(@@credentials_file)
15
+ login
16
+ end
17
+ display_gem_info(true, options[:dependencies])
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,43 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'login', 'Request access to RubyGems.org'
4
+ # Retrieves the API key for the user and writes it to ~/.gem/credentials.
5
+ # It also makes sure to set the permissions to 0600 as adviced on the
6
+ # RubyGems.org webpage. If the credentials file is on the system,
7
+ # then it should warn the user before overwriting the file.
8
+ def login
9
+ # check if file credential exists
10
+ if File.file?(@@credentials_file)
11
+ puts 'Credentials file found!'.bold
12
+ unless yes?("Overwrite #{@@credentials_file}? |no|".bold.yellow)
13
+ puts "Aborted.".red.bold
14
+ exit
15
+ end
16
+ end
17
+
18
+ # Ask for username and password, mask the password and make it
19
+ # green if it's the correct password, red if the access was denied.
20
+ # Aborts if the password is empty.
21
+ puts 'Write your username and password for ' + 'RubyGems.org'.yellow.bold
22
+ username = ask('Username:'.yellow.bold)
23
+ password = ask('Password:'.yellow.bold, echo: false)
24
+ (puts "Aborted.".red.bold; exit) if password.empty?
25
+
26
+ # fakes a masked password as long as the username,
27
+ # for style purposes only.
28
+ masked_password = '*' * username.length
29
+ print masked_password unless options[:show_password]
30
+
31
+ begin
32
+ Tmg.write_credentials(username, password)
33
+ rescue RuntimeError
34
+ puts "\b" * masked_password.length + masked_password.red.bold
35
+ puts 'Access Denied.'.red.bold
36
+ exit
37
+ else
38
+ puts "\b" * masked_password.length + masked_password.green.bold
39
+ puts "Credentials written to #{@@credentials_file}".green.bold
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,14 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'user [USERNAME]', 'Shows gems owned by another username'
4
+ method_option :dependencies,
5
+ aliases: '-d',
6
+ type: :boolean,
7
+ desc: 'Show dependencies.'
8
+ # Displays the gems that belongs to another user, optionally flag
9
+ # the dependencies (runtime and development)
10
+ def user(username)
11
+ display_gem_info(false, options[:dependencies], nil, username)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,30 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'version [gems]', 'Displays latest version of gems.'
4
+ method_option 'invalid',
5
+ aliases: '-i',
6
+ type: :boolean,
7
+ desc: 'Show invalid gems.'
8
+ # Displays the latest versions of gems
9
+ def version(*gems)
10
+ (puts 'No gems provided'.red.bold; exit ) if gems.empty?
11
+ gems_versions = {}
12
+ gems.each do |gem_name|
13
+ gems_versions[gem_name] = Thread.new {
14
+ Thread.current[gem_name] = Gems.latest_version(gem_name)['version']
15
+ }
16
+ end
17
+
18
+ puts "\nGems:".upcase.yellow.bold
19
+ gems_versions.each do |gem_name, version|
20
+ version.join
21
+ if version[gem_name] != 'unknown'
22
+ puts '✔ '.green.bold + gem_name.bold + ' → '.green.bold + version[gem_name].green
23
+ else
24
+ puts "✘ #{gem_name} → ".red.bold + version[gem_name].yellow if options[:invalid]
25
+ end
26
+ end
27
+ puts
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,16 @@
1
+ module Tmg
2
+ class CLI < Thor
3
+ desc 'wiki', 'Open browser to gem\'s wiki'
4
+ # Open browser and navigates to gem's wiki
5
+ def wiki(gem)
6
+ wiki_uri = Gems.info(gem)['wiki_uri']
7
+ if wiki_uri.nil? || wiki_uri.empty?
8
+ puts "No wiki page for ".red.bold + gem.yellow.bold
9
+ exit(1)
10
+ else
11
+ puts 'Opening wiki for: '.green.bold + gem
12
+ Launchy.open(wiki_uri)
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/tmg/cli.rb ADDED
@@ -0,0 +1,110 @@
1
+ require 'tmg'
2
+ require 'thor'
3
+ require 'gems'
4
+ require 'colorize'
5
+ require 'launchy'
6
+
7
+ # CLI modules
8
+ require 'tmg/cli/about'
9
+ require 'tmg/cli/list'
10
+ require 'tmg/cli/login'
11
+ require 'tmg/cli/info'
12
+ require 'tmg/cli/user'
13
+ require 'tmg/cli/version'
14
+ require 'tmg/cli/homepage'
15
+ require 'tmg/cli/documentation'
16
+ require 'tmg/cli/wiki'
17
+
18
+ trap('INT') { puts "\nAborted".red.bold; exit }
19
+
20
+ module Tmg
21
+ # Commands:
22
+ # tmg about # Displays version number and information.
23
+ # tmg help [COMMAND] # Describe available commands or one specific command
24
+ # tmg info [GEM] # Shows information about a specific gem.
25
+ # tmg list # Show a list of your published gems.
26
+ # tmg login # Request access to RubyGems.org
27
+ ##
28
+ # Colorize:
29
+ # Yellow = Warnings || Things that needs your attention
30
+ # Green = Notice || Messages of interest
31
+ # White = Regular strings
32
+ # Red = Errors || Really important things. Red banner looks cool though.
33
+ class CLI < Thor
34
+ default_task :list
35
+ @@credentials_file = "#{Dir.home}/.gem/credentials"
36
+
37
+ no_commands do
38
+ # Non-CLI method to display gem information without duplicating code
39
+ # on the other CLI methods. Exits if no gems or users where found.
40
+ def display_gem_info(mygems = true, deps = false, ugem = nil, user = nil)
41
+ no_gems = 'Your profile as no gems.'.red.bold if mygems
42
+ no_user = 'User '.red.bold + user.yellow.bold + \
43
+ ' not found.'.red.bold if user
44
+ no_gem = 'Gem '.red.bold + ugem.yellow.bold + \
45
+ ' not found.'.red.bold if ugem
46
+ if mygems
47
+ gems = Gems.gems
48
+ (puts no_gems; exit ) if gems.empty?
49
+ elsif user
50
+ gems = Gems.gems(user)
51
+ (puts no_user; exit) if gems.include? 'error'
52
+ else
53
+ gems = [Gems.info(ugem)]
54
+ (puts no_gem; exit) if gems[0].empty?
55
+ end
56
+
57
+ gems.each do |gem|
58
+ authors = gem['authors']
59
+ gem_name = gem['name']
60
+ downloads = gem['downloads']
61
+ version = gem['version']
62
+ info = gem['info']
63
+ gem_page = gem['project_uri']
64
+ homepage = gem['homepage_uri']
65
+ dependencies = gem['dependencies']
66
+ documentation = gem['documentation_uri']
67
+ wiki = gem['wiki_uri']
68
+ licenses = gem['licenses']
69
+ runtime_deps = dependencies['runtime']
70
+ development_deps = dependencies['development']
71
+
72
+ puts
73
+ puts gem_name.upcase.yellow.bold
74
+ puts '- Authors: '.green.bold + authors unless mygems
75
+ puts '- Info: '.green.bold + info
76
+ puts '- Downloads: '.green.bold + downloads.to_s
77
+ puts '- Version: '.green.bold + version
78
+ puts '- Gem page: '.green.bold + gem_page unless mygems
79
+ puts '- Homepage: '.green.bold + homepage if homepage
80
+ puts '- Wiki: '.green.bold + wiki if wiki && !wiki.empty?
81
+ puts '- Docs: '.green.bold + documentation if documentation
82
+ puts '- Licenses: '.green.bold + licenses.join(', ') if licenses && !licenses.empty?
83
+
84
+ next unless deps
85
+
86
+ if runtime_deps.empty? && development_deps.empty?
87
+ puts "⤷ No dependencies".yellow.bold
88
+ else
89
+ puts "⤷ Dependencies".yellow.bold
90
+ end
91
+ unless runtime_deps.empty?
92
+ puts "\s⤷ Runtime dependencies".yellow.bold
93
+
94
+ dependencies['runtime'].each do |dep|
95
+ puts "\s\s⤷ #{dep['name']} → ".green.bold + dep['requirements'][3..-1]
96
+ end
97
+ end
98
+ unless development_deps.empty?
99
+ puts "\s⤷ Development dependencies".yellow.bold
100
+
101
+ dependencies['development'].each do |dep|
102
+ puts "\s\s⤷ #{dep['name']} → ".green.bold + dep['requirements'][3..-1]
103
+ end
104
+ end
105
+ end
106
+ puts
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,10 @@
1
+ module Tmg
2
+ VERSION = "0.5.4"
3
+ BANNER = '''
4
+ ______ __ __ ______
5
+ /\__ _\ /\ "-./ \ /\ ___\
6
+ \/_/\ \/ \ \ \-./\ \ \ \ \__ \
7
+ \ \_\ \ \_\ \ \_\ \ \_____\
8
+ \/_/ \/_/ \/_/ \/_____/
9
+ '''
10
+ end
data/lib/tmg.rb ADDED
@@ -0,0 +1,23 @@
1
+ require "tmg/version"
2
+ require 'yaml'
3
+ require 'httparty'
4
+ require 'gems'
5
+
6
+ module Tmg
7
+ def self.write_credentials(username,
8
+ password,
9
+ outdir = "#{Dir.home}/.gem",
10
+ outfile = 'credentials')
11
+ # Write credentials rubygems.org API access key to:
12
+ # /home/username/.gem/credentials
13
+ auth = { username: username, password: password }
14
+ yaml = HTTParty.get('https://rubygems.org/api/v1/api_key.yaml',
15
+ basic_auth: auth)
16
+ raise 'Access Denied' if yaml.code == 401
17
+
18
+ File.open("#{outdir}/#{outfile}", "w") { |file| file.write(yaml) }
19
+ FileUtils.chmod 0600, "#{outdir}/#{outfile}"
20
+ api_key = YAML.load_file("#{outdir}/#{outfile}")
21
+ Gems.configure { |config| config.key = api_key[:rubygems_api_key] }
22
+ end
23
+ end
data/tmg.gemspec ADDED
@@ -0,0 +1,45 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "tmg/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tmg"
8
+ spec.version = Tmg::VERSION
9
+ spec.authors = ["Franccesco Orozco"]
10
+ spec.email = ["franccesco@codingdose.info"]
11
+
12
+ spec.summary = %q{Track your gem stats with ease!}
13
+ spec.homepage = "https://github.com/franccesco/tmg"
14
+ spec.license = "MIT"
15
+ spec.metadata = {
16
+ "wiki_uri" => "https://github.com/franccesco/dmp/wiki"
17
+ }
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_dependency 'thor', '~> 0'
29
+ spec.add_dependency 'colorize', '~> 0'
30
+ spec.add_dependency 'httparty', '~> 0'
31
+ spec.add_dependency 'gems', '~> 1'
32
+ spec.add_dependency 'launchy', '~> 2'
33
+
34
+ spec.add_development_dependency 'simplecov', '~> 0'
35
+ spec.add_development_dependency 'byebug', '~> 10'
36
+ spec.add_development_dependency 'dotenv', '~> 2'
37
+ spec.add_development_dependency 'simplecov-console', '~> 0'
38
+ spec.add_development_dependency 'coveralls', '~> 0'
39
+ spec.add_development_dependency 'cucumber', '~> 3'
40
+ spec.add_development_dependency 'aruba', '~> 0'
41
+ spec.add_development_dependency "bundler", "~> 1.16"
42
+ spec.add_development_dependency "rake", "~> 10.0"
43
+ spec.add_development_dependency "minitest", "~> 5.0"
44
+ spec.add_development_dependency "minitest-reporters", "~> 1"
45
+ end
metadata ADDED
@@ -0,0 +1,298 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tmg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.4
5
+ platform: ruby
6
+ authors:
7
+ - Franccesco Orozco
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gems
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: launchy
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: dotenv
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov-console
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: coveralls
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: cucumber
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '3'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '3'
167
+ - !ruby/object:Gem::Dependency
168
+ name: aruba
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: bundler
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.16'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.16'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rake
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '10.0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '10.0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: minitest
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '5.0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '5.0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: minitest-reporters
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '1'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '1'
237
+ description:
238
+ email:
239
+ - franccesco@codingdose.info
240
+ executables:
241
+ - tmg
242
+ extensions: []
243
+ extra_rdoc_files: []
244
+ files:
245
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
246
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
247
+ - ".gitignore"
248
+ - ".rubocop.yml"
249
+ - ".travis.yml"
250
+ - CODE_OF_CONDUCT.md
251
+ - Gemfile
252
+ - LICENSE.txt
253
+ - README.md
254
+ - Rakefile
255
+ - assets/tmg_about.png
256
+ - assets/tmg_usage.gif
257
+ - bin/console
258
+ - bin/setup
259
+ - exe/tmg
260
+ - lib/tmg.rb
261
+ - lib/tmg/cli.rb
262
+ - lib/tmg/cli/about.rb
263
+ - lib/tmg/cli/documentation.rb
264
+ - lib/tmg/cli/homepage.rb
265
+ - lib/tmg/cli/info.rb
266
+ - lib/tmg/cli/list.rb
267
+ - lib/tmg/cli/login.rb
268
+ - lib/tmg/cli/user.rb
269
+ - lib/tmg/cli/version.rb
270
+ - lib/tmg/cli/wiki.rb
271
+ - lib/tmg/version.rb
272
+ - tmg.gemspec
273
+ homepage: https://github.com/franccesco/tmg
274
+ licenses:
275
+ - MIT
276
+ metadata:
277
+ wiki_uri: https://github.com/franccesco/dmp/wiki
278
+ post_install_message:
279
+ rdoc_options: []
280
+ require_paths:
281
+ - lib
282
+ required_ruby_version: !ruby/object:Gem::Requirement
283
+ requirements:
284
+ - - ">="
285
+ - !ruby/object:Gem::Version
286
+ version: '0'
287
+ required_rubygems_version: !ruby/object:Gem::Requirement
288
+ requirements:
289
+ - - ">="
290
+ - !ruby/object:Gem::Version
291
+ version: '0'
292
+ requirements: []
293
+ rubyforge_project:
294
+ rubygems_version: 2.7.7
295
+ signing_key:
296
+ specification_version: 4
297
+ summary: Track your gem stats with ease!
298
+ test_files: []