module GitFeats::Checker

Public Instance Methods

check(args) click to toggle source

Main interface for checking feats

# File lib/git-feats/checker.rb, line 7
def check(args)

  # Load history and completed
  Completed.unserialize
  History.unserialize

  # request flag
  upload = false

  # Check for feats and update history
  Feats.all.each do |pattern, feats|
    if args.match?(pattern)
      History.add(pattern)

      feats.each do |feat, value|
        if History.count(pattern) >= value[:count]
          unless Completed.exists?(feat)
            Completed.add(feat) 
            Reporter.report(value)
            upload = true
          end
        end
      end
    end
  end

  # upload feats if the request flag is set
  upload_feats if upload

  # Write out history and completed feats
  Completed.serialize
  History.serialize
end

Private Instance Methods

upload_feats() click to toggle source

call upload feats from API if config values exist

# File lib/git-feats/checker.rb, line 44
def upload_feats
  API.upload_feats if Config.exists?
end