Skip to content

Commit

Permalink
update versions to keep the raw version
Browse files Browse the repository at this point in the history
  • Loading branch information
kbukum1 committed Oct 21, 2024
1 parent 96e2840 commit faf6223
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions bundler/lib/dependabot/bundler/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,14 @@ def gemspecs
.select { |file| file.name.end_with?(".gemspec") }
end

sig { returns(T::Array[Dependabot::DependencyFile]) }
def imported_ruby_files
dependency_files
.select { |f| f.name.end_with?(".rb") }
.reject { |f| f.name == "gems.rb" }
end

sig { returns(String) }
def bundler_version
@bundler_version ||= Helpers.bundler_version(lockfile)
end
Expand Down
7 changes: 4 additions & 3 deletions bundler/lib/dependabot/bundler/package_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ module Bundler
class PackageManager < PackageManagerBase
extend T::Sig

sig { params(version: T.any(String, Dependabot::Version)).void }
def initialize(version)
sig { params(raw_version: String).void }
def initialize(raw_version)
super(
ECOSYSTEM,
PACKAGE_MANAGER,
Version.new(version),
raw_version,
Version.new(raw_version),
DEPRECATED_BUNDLER_VERSIONS,
SUPPORTED_BUNDLER_VERSIONS
)
Expand Down
14 changes: 12 additions & 2 deletions common/lib/dependabot/package_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,31 @@ class PackageManagerBase
# Initialize common attributes for all package managers
# @param ecosystem [String] the name of the ecosystem (e.g., "npm_and_yarn", "composer").
# @param name [String] the name of the package manager (e.g., "npm", "bundler").
# @param version [Dependabot::Version] the version of the package manager (e.g., "6.0.0").
# @param raw_version [String] the version of the package manager (e.g., "6.0.0").
# @param version [Dependabot::Version] the version of the package manager Version.new("1.0.0").
# @param deprecated_versions [Array<Dependabot::Version>] an array of deprecated versions.
# @param supported_versions [Array<Dependabot::Version>] an array of supported versions.
sig do
params(
ecosystem: String,
name: String,
raw_version: String,
version: Dependabot::Version,
deprecated_versions: T::Array[Dependabot::Version],
supported_versions: T::Array[Dependabot::Version]
).void
end
def initialize(
def initialize( # rubocop:disable Metrics/ParameterLists
ecosystem,
name,
raw_version,
version,
deprecated_versions = [],
supported_versions = []
)
@ecosystem = T.let(ecosystem, String)
@name = T.let(name, String)
@raw_version = T.let(raw_version, String)
@version = T.let(version, Dependabot::Version)
@deprecated_versions = T.let(deprecated_versions, T::Array[Dependabot::Version])
@supported_versions = T.let(supported_versions, T::Array[Dependabot::Version])
Expand All @@ -51,6 +55,12 @@ def initialize(
sig { returns(String) }
attr_reader :name

# The version of the package manager (e.g., "6.0.0").
# @example
# package_manager.version #=> "6.0.0"
sig { returns(String) }
attr_reader :raw_version

# The version of the package manager (e.g., "6.0.0").
# @example
# package_manager.version #=> "6.0.0"
Expand Down
7 changes: 4 additions & 3 deletions composer/lib/dependabot/composer/package_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ module Composer
class PackageManager < PackageManagerBase
extend T::Sig

sig { params(version: T.any(String, Dependabot::Version)).void }
def initialize(version)
sig { params(raw_version: String).void }
def initialize(raw_version)
super(
ECOSYSTEM,
PACKAGE_MANAGER,
Version.new(version),
raw_version,
Version.new(raw_version),
DEPRECATED_COMPOSER_VERSIONS,
SUPPORTED_COMPOSER_VERSIONS
)
Expand Down

0 comments on commit faf6223

Please sign in to comment.