Module: StillActive::ActivityHelper

Extended by:
ActivityHelper
Included in:
ActivityHelper
Defined in:
lib/helpers/activity_helper.rb

Instance Method Summary collapse

Instance Method Details

#activity_level(gem_data) ⇒ Object

Returns :archived, :ok, :stale, :critical, or :unknown



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/helpers/activity_helper.rb', line 12

def activity_level(gem_data)
  return :archived if gem_data[:archived]

  most_recent = [
    gem_data[:last_commit_date],
    gem_data[:latest_version_release_date],
    gem_data[:latest_pre_release_version_release_date],
  ].compact.max

  return :unknown if most_recent.nil?

  config = StillActive.config
  if most_recent >= config.no_warning_range_end.years.ago
    :ok
  elsif most_recent >= config.warning_range_end.years.ago
    :stale
  else
    :critical
  end
end