Class: Dependabot::GithubActions::Helpers::Githelper

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/github_actions/helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, credentials:, ignored_versions: [], raise_on_ignored: false, consider_version_branches_pinned: false, dependency_source_details: nil) ⇒ Githelper

Returns a new instance of Githelper.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dependabot/github_actions/helpers.rb', line 33

def initialize(
  dependency:,
  credentials:,
  ignored_versions: [],
  raise_on_ignored: false,
  consider_version_branches_pinned: false,
  dependency_source_details: nil
)
  @dependency = dependency
  @credentials = credentials
  @ignored_versions = ignored_versions
  @raise_on_ignored = raise_on_ignored
  @consider_version_branches_pinned = consider_version_branches_pinned
  @dependency_source_details = dependency_source_details
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



53
54
55
# File 'lib/dependabot/github_actions/helpers.rb', line 53

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



50
51
52
# File 'lib/dependabot/github_actions/helpers.rb', line 50

def dependency
  @dependency
end

#ignored_versionsObject (readonly)

Returns the value of attribute ignored_versions.



56
57
58
# File 'lib/dependabot/github_actions/helpers.rb', line 56

def ignored_versions
  @ignored_versions
end

#raise_on_ignoredObject (readonly)

Returns the value of attribute raise_on_ignored.



59
60
61
# File 'lib/dependabot/github_actions/helpers.rb', line 59

def raise_on_ignored
  @raise_on_ignored
end

Instance Method Details

#git_commit_checkerObject



62
63
64
65
66
67
# File 'lib/dependabot/github_actions/helpers.rb', line 62

def git_commit_checker
  @git_commit_checker ||= T.let(
    git_commit_checker_for(nil),
    T.nilable(Dependabot::GitCommitChecker)
  )
end

#git_commit_checker_for(source) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/dependabot/github_actions/helpers.rb', line 70

def git_commit_checker_for(source)
  @git_commit_checkers ||= T.let(
    {},
    T.nilable(T::Hash[T.nilable(T::Hash[Symbol, String]), Dependabot::GitCommitChecker])
  )

  @git_commit_checkers[source] ||= Dependabot::GitCommitChecker.new(
    dependency: dependency,
    credentials: credentials,
    ignored_versions: ignored_versions,
    raise_on_ignored: raise_on_ignored,
    consider_version_branches_pinned: true,
    dependency_source_details: source
  )
end