Skip to content

Commit

Permalink
Basic MetadataFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jul 11, 2023
1 parent 558d758 commit dc82e72
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions swift/lib/dependabot/swift/metadata_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ class MetadataFinder < Dependabot::MetadataFinders::Base
private

def look_up_source
case new_source_type
when "git" then find_source_from_git_url
when "registry" then find_source_from_registry
else raise "Unexpected source type: #{new_source_type}"
end
end

def new_source_type
dependency.source_type
end

def find_source_from_git_url
info = dependency.source_details

url = info[:url] || info.fetch("url")
Source.from_url(url)
end

def find_source_from_registry
raise NotImplementedError
end
end
Expand Down
10 changes: 10 additions & 0 deletions swift/spec/dependabot/swift/metadata_finder_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require "spec_helper"
require "dependabot/dependency"
require "dependabot/swift/metadata_finder"
require_common_spec "metadata_finders/shared_examples_for_metadata_finders"

# RSpec.describe Dependabot::Swift::MetadataFinder do
# it_behaves_like "a dependency metadata finder"
# end

0 comments on commit dc82e72

Please sign in to comment.