forked from dependabot/dependabot-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for hex ecosystem metrics collection (dependabot#11023)
* Add support for hex ecosystem metrics collection * Temporarily disable language requirement * Remove inconsistent language requirement
- Loading branch information
Showing
6 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/ecosystem" | ||
require "dependabot/hex/version" | ||
|
||
module Dependabot | ||
module Hex | ||
LANGUAGE = "elixir" | ||
|
||
class Language < Dependabot::Ecosystem::VersionManager | ||
extend T::Sig | ||
|
||
sig { params(raw_version: String).void } | ||
def initialize(raw_version) | ||
super(LANGUAGE, Version.new(raw_version)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/ecosystem" | ||
require "dependabot/hex/version" | ||
|
||
module Dependabot | ||
module Hex | ||
ECOSYSTEM = "hex" | ||
PACKAGE_MANAGER = "hex" | ||
SUPPORTED_HEX_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version]) | ||
|
||
# When a version is going to be unsupported, it will be added here | ||
DEPRECATED_HEX_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version]) | ||
|
||
class PackageManager < Dependabot::Ecosystem::VersionManager | ||
extend T::Sig | ||
|
||
sig { params(raw_version: String).void } | ||
def initialize(raw_version) | ||
super( | ||
PACKAGE_MANAGER, | ||
Version.new(raw_version), | ||
DEPRECATED_HEX_VERSIONS, | ||
SUPPORTED_HEX_VERSIONS | ||
) | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def deprecated? | ||
false | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def unsupported? | ||
false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/hex/language" | ||
require "dependabot/ecosystem" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::Hex::Language do | ||
subject(:language) { described_class.new(version) } | ||
|
||
let(:version) { "1.17.3" } | ||
|
||
describe "#version" do | ||
it "returns the version" do | ||
expect(language.version).to eq(Dependabot::Hex::Version.new(version)) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the name" do | ||
expect(language.name).to eq(Dependabot::Hex::LANGUAGE) | ||
end | ||
end | ||
|
||
describe "#unsupported?" do | ||
it "returns false by default" do | ||
expect(language.unsupported?).to be false | ||
end | ||
end | ||
|
||
describe "#deprecated?" do | ||
it "returns false by default" do | ||
expect(language.deprecated?).to be false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/hex/package_manager" | ||
require "dependabot/ecosystem" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::Hex::PackageManager do | ||
subject(:package_manager) { described_class.new(version) } | ||
|
||
let(:version) { "2.1.1" } | ||
|
||
describe "#version" do | ||
it "returns the version" do | ||
expect(package_manager.version).to eq(Dependabot::Hex::Version.new(version)) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the name" do | ||
expect(package_manager.name).to eq(Dependabot::Hex::PACKAGE_MANAGER) | ||
end | ||
end | ||
|
||
describe "#deprecated_versions" do | ||
it "returns deprecated versions" do | ||
expect(package_manager.deprecated_versions).to eq(Dependabot::Hex::DEPRECATED_HEX_VERSIONS) | ||
end | ||
end | ||
|
||
describe "#supported_versions" do | ||
it "returns supported versions" do | ||
expect(package_manager.supported_versions).to eq(Dependabot::Hex::SUPPORTED_HEX_VERSIONS) | ||
end | ||
end | ||
end |