Class: Dependabot::FileFetchers::Base
- Inherits:
-
Object
- Object
- Dependabot::FileFetchers::Base
- Defined in:
- lib/dependabot/file_fetchers/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #commit ⇒ Object
- #directory ⇒ Object
- #files ⇒ Object
-
#initialize(source:, credentials:) ⇒ Base
constructor
A new instance of Base.
- #repo ⇒ Object
- #target_branch ⇒ Object
Constructor Details
#initialize(source:, credentials:) ⇒ Base
Returns a new instance of Base.
24 25 26 27 28 29 |
# File 'lib/dependabot/file_fetchers/base.rb', line 24 def initialize(source:, credentials:) @source = source @credentials = credentials @submodule_directories = {} end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
14 15 16 |
# File 'lib/dependabot/file_fetchers/base.rb', line 14 def credentials @credentials end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
14 15 16 |
# File 'lib/dependabot/file_fetchers/base.rb', line 14 def source @source end |
Class Method Details
.required_files_in?(_filename_array) ⇒ Boolean
16 17 18 |
# File 'lib/dependabot/file_fetchers/base.rb', line 16 def self.required_files_in?(_filename_array) raise NotImplementedError end |
.required_files_message ⇒ Object
20 21 22 |
# File 'lib/dependabot/file_fetchers/base.rb', line 20 def self. raise NotImplementedError end |
Instance Method Details
#commit ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dependabot/file_fetchers/base.rb', line 47 def commit branch = target_branch || default_branch_for_repo @commit ||= client_for_provider.fetch_commit(repo, branch) rescue Octokit::NotFound, Gitlab::Error::NotFound, Dependabot::Clients::Bitbucket::NotFound raise Dependabot::BranchNotFound, branch rescue Octokit::Conflict => error raise unless error..include?("Repository is empty") end |
#directory ⇒ Object
35 36 37 |
# File 'lib/dependabot/file_fetchers/base.rb', line 35 def directory source.directory || "/" end |
#files ⇒ Object
43 44 45 |
# File 'lib/dependabot/file_fetchers/base.rb', line 43 def files @files ||= fetch_files end |
#repo ⇒ Object
31 32 33 |
# File 'lib/dependabot/file_fetchers/base.rb', line 31 def repo source.repo end |
#target_branch ⇒ Object
39 40 41 |
# File 'lib/dependabot/file_fetchers/base.rb', line 39 def target_branch source.branch end |