Module: Thanks
- Defined in:
- lib/thanks.rb,
lib/thanks/version.rb,
lib/thanks/registry.rb
Overview
Let’s thank people for making the Ruby code we depend on!
Constant Summary collapse
- VERSION =
'0.3.2'.freeze
- REGISTRY =
{ 'bundler' => 'https://rubytogether.org', 'gemstash' => 'https://rubytogether.org', 'rubocop' => 'https://opencollective.com/rubocop', 'split' => 'https://opencollective.com/split' }.freeze
Class Method Summary collapse
Class Method Details
.bundled_gems ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/thanks.rb', line 32 def self.bundled_gems @_bundled_gems ||= `bundle list` .split("\n") .drop(1).map(&:split) .map { |words| words.drop(1) } .map(&:first) end |
.matches ⇒ Object
21 22 23 24 25 26 |
# File 'lib/thanks.rb', line 21 def self.matches @_matches ||= REGISTRY.select do |name, _url| system_gems.include?(name) || bundled_gems.include?(name) end end |
.print_list ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/thanks.rb', line 6 def self.print_list if matches.any? puts "\nSweet! You are using gems with donation pages!\n\n" matches.sort.each { |name, url| puts " - #{name}\t#{url}" } else puts "\nMan! Can't find any gems on your system to support!" end puts "\nYou can also donate to help the Ruby language itself" puts "\thttps://bugs.ruby-lang.org/projects/ruby/wiki/Donation" puts "\nAdd more gem donation links to our list at" puts "\thttps://github.com/dpritchett/thanks-ruby" end |
.system_gems ⇒ Object
28 29 30 |
# File 'lib/thanks.rb', line 28 def self.system_gems @_system_gems ||= `gem list`.split("\n").map(&:split).map(&:first) end |