Module: Thanks
- Defined in:
- lib/thanks.rb,
lib/thanks/version.rb,
lib/thanks/registry.rb
Constant Summary collapse
- VERSION =
"0.3.0"- REGISTRY =
{ "bundler" => "https://rubytogether.org", "gemstash" => "https://rubytogether.org", "rubocop" => "https://opencollective.com/rubocop", "split" => "https://opencollective.com/split", }
Class Method Summary collapse
Class Method Details
.bundled_gems ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/thanks.rb', line 28 def self.bundled_gems @_bundled_gems ||= `bundle list` .split("\n") .drop(1).map(&:split) .map { |words| words.drop(1) } .map(&:first) end |
.matches ⇒ Object
17 18 19 20 21 22 |
# File 'lib/thanks.rb', line 17 def self.matches @_matches ||= REGISTRY.select do |name, url| system_gems.include?(name) || bundled_gems.include?(name) end end |
.print_list ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/thanks.rb', line 5 def self.print_list if matches.any? puts "Sweet! You are using gems with donation pages!\n\n" matches.sort.each { |name, url| puts " - #{name}\t#{url}" } else puts "Man! Can't find any gems on your system to support!" end puts "\nAdd more gem donation links to our list at https://github.com/dpritchett/thanks-ruby" end |
.system_gems ⇒ Object
24 25 26 |
# File 'lib/thanks.rb', line 24 def self.system_gems @_system_gems ||= `gem list`.split("\n").map(&:split).map(&:first) end |