Class: Dependabot::Source
- Inherits:
-
Object
- Object
- Dependabot::Source
- Defined in:
- lib/hack/dependabot-core/common/lib/dependabot/source.rb
Instance Method Summary collapse
-
#default_api_endpoint(provider) ⇒ Object
override.
-
#default_hostname(provider) ⇒ Object
override.
-
#url_with_directory ⇒ Object
override.
Instance Method Details
#default_api_endpoint(provider) ⇒ Object
override
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hack/dependabot-core/common/lib/dependabot/source.rb', line 41 def default_api_endpoint(provider) case provider when "github" then "https://api.github.com/" when "bitbucket" then "https://api.bitbucket.org/2.0/" when "gitlab" then "https://gitlab.com/api/v4" when "azure" then "https://dev.azure.com/" when "gitea" then "http://localhost:3000/api/v1" when "codecommit" then nil else raise "Unexpected provider '#{provider}'" end end |
#default_hostname(provider) ⇒ Object
override
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/hack/dependabot-core/common/lib/dependabot/source.rb', line 28 def default_hostname(provider) case provider when "github" then "github.com" when "bitbucket" then "bitbucket.org" when "gitlab" then "gitlab.com" when "azure" then "dev.azure.com" when "gitea" then "localhost:3000" when "codecommit" then "us-east-1" else raise "Unexpected provider '#{provider}'" end end |
#url_with_directory ⇒ Object
override
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hack/dependabot-core/common/lib/dependabot/source.rb', line 6 def url_with_directory return url if [nil, ".", "/"].include?(directory) case provider when "github", "gitlab" when "github", "gitlab", "gitea" path = Pathname.new(File.join("tree/#{branch || 'HEAD'}", directory)). cleanpath.to_path url + "/" + path when "bitbucket" path = Pathname.new(File.join("src/#{branch || 'default'}", directory)). cleanpath.to_path url + "/" + path when "azure" url + "?path=#{directory}" when "codecommit" raise "The codecommit provider does not utilize URLs" else raise "Unexpected repo provider '#{provider}'" end end |