class Dependabot::Dep::FileFetcher
Public Class Methods
required_files_in?(filenames)
click to toggle source
# File lib/dependabot/dep/file_fetcher.rb, line 9 def self.required_files_in?(filenames) (%w(Gopkg.toml Gopkg.lock) - filenames).empty? end
required_files_message()
click to toggle source
# File lib/dependabot/dep/file_fetcher.rb, line 13 def self.required_files_message "Repo must contain a Gopkg.toml and Gopkg.lock." end
Private Instance Methods
fetch_files()
click to toggle source
# File lib/dependabot/dep/file_fetcher.rb, line 19 def fetch_files fetched_files = [] fetched_files << manifest if manifest fetched_files << lockfile if lockfile unless manifest raise( Dependabot::DependencyFileNotFound, File.join(directory, "Gopkg.toml") ) end unless lockfile raise( Dependabot::DependencyFileNotFound, File.join(directory, "Gopkg.lock") ) end # Fetch the main.go file if present, as this will later identify # this repo as an app. fetched_files << main if main fetched_files end
lockfile()
click to toggle source
# File lib/dependabot/dep/file_fetcher.rb, line 48 def lockfile @lockfile ||= fetch_file_if_present("Gopkg.lock") end
main()
click to toggle source
# File lib/dependabot/dep/file_fetcher.rb, line 52 def main return @main if @main go_files = repo_contents.select { |f| f.name.end_with?(".go") } go_files.each do |go_file| file = fetch_file_from_host(go_file.name, type: "package_main") next unless file.content.match?(/\s*package\s+main/) return @main = file.tap { |f| f.support_file = true } end nil end
manifest()
click to toggle source
# File lib/dependabot/dep/file_fetcher.rb, line 44 def manifest @manifest ||= fetch_file_if_present("Gopkg.toml") end