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!
Defined Under Namespace
Classes: Registry
Constant Summary collapse
- VERSION =
'0.4.2'.freeze
Class Method Summary collapse
Class Method Details
.bundled_gems ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/thanks.rb', line 34 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 27 28 |
# File 'lib/thanks.rb', line 21 def self.matches registry = Registry.new.fetch @_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
30 31 32 |
# File 'lib/thanks.rb', line 30 def self.system_gems @_system_gems ||= `gem list`.split("\n").map(&:split).map(&:first) end |