Class: GemsStatus::NotASecurityAlertChecker

Inherits:
GemChecker
  • Object
show all
Defined in:
lib/gems-status/checkers/not_a_security_alert_checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conf) ⇒ NotASecurityAlertChecker

Returns a new instance of NotASecurityAlertChecker.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gems-status/checkers/not_a_security_alert_checker.rb', line 13

def initialize(conf)
  Utils::check_parameters('NotASecurityAlertChecker', conf, ["fixed", "source_repos", "email_username", "email_password", "mailing_lists", "email_to"])
  @fixed = conf["fixed"]
  @source_repos = conf["source_repos"]
  @security_messages = {}
  @email_username = conf["email_username"]
  @email_password = conf["email_password"]
  @mailing_lists = conf["mailing_lists"]
  @email_to = conf["email_to"]
  @emails = {}
  @gem = nil
  @emails = Utils.download_emails(@email_username, @email_password, @mailing_lists)
end

Instance Attribute Details

#gemObject (readonly)

Returns the value of attribute gem.



12
13
14
# File 'lib/gems-status/checkers/not_a_security_alert_checker.rb', line 12

def gem
  @gem
end

#security_messagesObject (readonly)

Returns the value of attribute security_messages.



12
13
14
# File 'lib/gems-status/checkers/not_a_security_alert_checker.rb', line 12

def security_messages
  @security_messages
end

Instance Method Details

#check?(gem) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/gems-status/checkers/not_a_security_alert_checker.rb', line 27

def check?(gem)
  @gem = gem
  #ignore upstream checks
  return true if gem.origin == gem.gems_url

  @security_messages = {}
  look_in_scm(gem)
  look_in_emails(gem)
  filter_security_messages_already_fixed(gem.version, gem.date)
  send_emails(gem)
  return @security_messages.length == 0
end

#descriptionObject



40
41
42
43
44
45
46
# File 'lib/gems-status/checkers/not_a_security_alert_checker.rb', line 40

def description
  if !@gem
    Utils::log_debug("No gem. That means that check method has not been called in NotASecurityAlertChecker")
    return
  end
  message(@gem)
end