Module: BusFactor
- Defined in:
- lib/bus_factor.rb,
lib/bus_factor/version.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
- .owner_cache ⇒ Object
- .owners_of(geem) ⇒ Object
- .sorted_specs ⇒ Object
-
.worst ⇒ Object
TODO: how often updated?.
Class Method Details
.owner_cache ⇒ Object
44 45 46 47 48 49 |
# File 'lib/bus_factor.rb', line 44 def owner_cache @owner_cache ||= Hash.new do |hash, key| uri = "https://rubygems.org/api/v1/gems/#{key}/owners.json" hash[key] = JSON.parse(RestClient.get uri) end end |
.owners_of(geem) ⇒ Object
39 40 41 42 |
# File 'lib/bus_factor.rb', line 39 def owners_of(geem) geem = geem.name if geem.respond_to? :name owner_cache[geem] end |
.sorted_specs ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/bus_factor.rb', line 31 def sorted_specs specs = Bundler.locked_gems.specs.map(&:__materialize__) specs.sort_by do |spec| owners_of(spec).length end specs end |
.worst ⇒ Object
TODO: how often updated?
22 23 24 25 26 27 28 29 |
# File 'lib/bus_factor.rb', line 22 def worst sorted_specs.map do |spec| Result.new( spec.name, owners_of(spec).map { |o| o['email'] } ) end end |