Skip to content

Commit

Permalink
Update files to match the release
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Nov 17, 2024
1 parent e26bc2f commit 74b3a92
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GEMSPECS = %w(
silent/dependabot-silent.gemspec
swift/dependabot-swift.gemspec
devcontainers/dependabot-devcontainers.gemspec
dotnet_sdk/dependabot-dotnet_sdk.gemspec
).freeze

def run_command(command)
Expand Down
1 change: 1 addition & 0 deletions updater/bin/update_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
require "dependabot/cargo"
require "dependabot/composer"
require "dependabot/docker"
require "dependabot/dotnet_sdk"
require "dependabot/elm"
require "dependabot/git_submodules"
require "dependabot/github_actions"
Expand Down
18 changes: 9 additions & 9 deletions updater/lib/dependabot/dependency_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def dependencies
T.must(@dependencies[@current_directory])
end

sig { returns(T.nilable(Dependabot::PackageManagerBase)) }
def package_manager
@package_manager[@current_directory]
sig { returns(T.nilable(Dependabot::Ecosystem)) }
def ecosystem
@ecosystem[@current_directory]
end

sig { returns(T::Array[Dependabot::Notice]) }
Expand Down Expand Up @@ -181,7 +181,7 @@ def initialize(job:, base_commit_sha:, dependency_files:) # rubocop:disable Metr
@current_directory = T.let("", String)

@dependencies = T.let({}, T::Hash[String, T::Array[Dependabot::Dependency]])
@package_manager = T.let({}, T::Hash[String, T.nilable(Dependabot::PackageManagerBase)])
@ecosystem = T.let({}, T::Hash[String, T.nilable(Dependabot::Ecosystem)])
@notices = T.let({}, T::Hash[String, T::Array[Dependabot::Notice]])

directories.each do |dir|
Expand Down Expand Up @@ -241,12 +241,12 @@ def dependency_file_parser
reject_external_code: job.reject_external_code?,
options: job.experiments
)
# Add 'package_manager' to the dependency_snapshot to use it in operations
package_manager = parser.package_manager
# Add 'ecosystem' to the dependency_snapshot to use it in operations
ecosystem = parser.ecosystem
# Raise an error if the package manager version is unsupported
package_manager&.raise_if_unsupported!
ecosystem&.raise_if_unsupported!

@package_manager[@current_directory] = package_manager
@ecosystem[@current_directory] = ecosystem

# Log deprecation notices if the package manager is deprecated
# and add them to the notices array
Expand All @@ -255,7 +255,7 @@ def dependency_file_parser
# add deprecation notices for the package manager
add_deprecation_notice(
notices: notices_for_current_directory,
package_manager: package_manager
package_manager: ecosystem&.package_manager
)
@notices[@current_directory] = notices_for_current_directory

Expand Down
8 changes: 4 additions & 4 deletions updater/lib/dependabot/notices_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

require "sorbet-runtime"
require "dependabot/notices"
require "dependabot/package_manager"
require "dependabot/ecosystem"

# This module extracts helpers for notice generations that can be used
# for showing notices in logs, pr messages and alert ui page.
Expand All @@ -20,7 +20,7 @@ module NoticesHelpers
sig do
params(
notices: T::Array[Dependabot::Notice],
package_manager: T.nilable(PackageManagerBase)
package_manager: T.nilable(Ecosystem::VersionManager)
)
.void
end
Expand Down Expand Up @@ -58,11 +58,11 @@ def log_notice(notice)

private

sig { params(package_manager: T.nilable(PackageManagerBase)).returns(T.nilable(Dependabot::Notice)) }
sig { params(package_manager: T.nilable(Ecosystem::VersionManager)).returns(T.nilable(Dependabot::Notice)) }
def create_deprecation_notice(package_manager)
return unless package_manager

return unless package_manager.is_a?(PackageManagerBase)
return unless package_manager.is_a?(Ecosystem::VersionManager)

Notice.generate_pm_deprecation_notice(
package_manager
Expand Down
2 changes: 2 additions & 0 deletions updater/lib/dependabot/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
terraform|
elm|
docker|
dotnet_sdk|
git_submodules|
github_actions|
composer|
Expand Down Expand Up @@ -60,6 +61,7 @@
require "dependabot/terraform"
require "dependabot/elm"
require "dependabot/docker"
require "dependabot/dotnet_sdk"
require "dependabot/git_submodules"
require "dependabot/github_actions"
require "dependabot/composer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def check_and_update_pull_request(dependencies)
# Dependabot::Experiments.register(:lead_security_dependency, true)

if Dependabot::Experiments.enabled?(:lead_security_dependency)
lead_dep_name = security_advisory_dependency
lead_dep_name = security_advisory_dependency.downcase

# telemetry data collection
Dependabot.logger.info(
Expand Down
1 change: 1 addition & 0 deletions updater/lib/tinglesoftware/dependabot/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
require "dependabot/terraform"
require "dependabot/elm"
require "dependabot/docker"
require "dependabot/dotnet_sdk"
require "dependabot/git_submodules"
require "dependabot/github_actions"
require "dependabot/composer"
Expand Down
25 changes: 10 additions & 15 deletions updater/spec/support/dummy_pkg_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: false
# frozen_string_literal: true

require "dependabot/package_manager"
require "dependabot/ecosystem"
require "dependabot/dependency_file"

# This module provides some shortcuts for working with our two mock RubyGems packages:
Expand Down Expand Up @@ -63,22 +63,17 @@ def updated_bundler_files_hash(fixture: "bundler")
updated_bundler_files(fixture: fixture).map(&:to_h)
end

# Stub PackageManagerBase
class StubPackageManager < Dependabot::PackageManagerBase
def initialize(name:, version:, deprecated_versions: [], unsupported_versions: [], supported_versions: [])
@name = name
@version = version
@deprecated_versions = deprecated_versions
@unsupported_versions = unsupported_versions
@supported_versions = supported_versions
# Stub Ecosystem::VersionManager
class StubPackageManager < Dependabot::Ecosystem::VersionManager
def initialize(name:, version:, deprecated_versions: [], supported_versions: [])
super(
name,
Dependabot::Version.new(version),
deprecated_versions,
supported_versions
)
end

attr_reader :name
attr_reader :version
attr_reader :deprecated_versions
attr_reader :unsupported_versions
attr_reader :supported_versions

sig { override.returns(T::Boolean) }
def deprecated?
# If the version is unsupported, the unsupported error is getting raised separately.
Expand Down

0 comments on commit 74b3a92

Please sign in to comment.