class ProspectusRepotimer::Timer

Helper for automatically adding timer check

Public Class Methods

new(days_ago) click to toggle source
# File lib/prospectus_repotimer.rb, line 7
def initialize(days_ago)
  @days_ago = days_ago || raise('No age specified')
end

Public Instance Methods

days_ago_array() click to toggle source
# File lib/prospectus_repotimer.rb, line 43
def days_ago_array
  @days_ago.downto(0).to_a
end
extended(other) click to toggle source
# File lib/prospectus_repotimer.rb, line 11
def extended(other) # rubocop:disable Metrics/MethodLength
  actual_val, expected_val = parse_status

  other.deps do
    item do
      name 'timer'

      expected do
        static
        set expected_val
      end

      actual do
        static
        set actual_val
      end
    end
  end
end
last_commit() click to toggle source
# File lib/prospectus_repotimer.rb, line 39
def last_commit
  @last_commit ||= Date.parse(`git show --format=%cI -s`)
end
last_commit_days_ago() click to toggle source
# File lib/prospectus_repotimer.rb, line 35
def last_commit_days_ago
  @last_commit_days_ago ||= (Date.today - last_commit).to_i
end
parse_status() click to toggle source
# File lib/prospectus_repotimer.rb, line 31
def parse_status
  [last_commit_days_ago, days_ago_array]
end