Skip to content

Commit

Permalink
feat: Add plugin for Ruby (#10)
Browse files Browse the repository at this point in the history
* Add plugin for ruby

* Increase python test coverage
  • Loading branch information
sestrella authored Nov 24, 2023
1 parent 18a199a commit b0e58ce
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 3 deletions.
96 changes: 96 additions & 0 deletions plugins/ruby/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions plugins/ruby/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
inputs.nixpkgs-ruby.url = "github:bobvanderlinden/nixpkgs-ruby";

outputs = { self, nixpkgs-ruby }: {
lib = {
hasVersion = { version, system ? builtins.currentSystem }:
builtins.hasAttr "ruby-${version}" nixpkgs-ruby.packages.${system};
packageFromVersion = { version, system ? builtins.currentSystem }:
nixpkgs-ruby.packages.${system}."ruby-${version}";
};
};
}
16 changes: 13 additions & 3 deletions tests/plugins/python/lib_test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ let
in
[
{
name = "When the version exists";
actual = (lib.packageFromVersion { version = "3.12.0"; }).version;
expected = "3.12.0";
name = "When the version exists returns true";
actual = lib.hasVersion { version = "3.12.0"; };
expected = true;
}
{
name = "When the version does not exist returns false";
actual = lib.hasVersion { version = "0.0.0"; };
expected = false;
}
{
name = "When the version exists returns a package";
actual = (lib.packageFromVersion { version = "3.12.0"; }).name;
expected = "python3-3.12.0";
}
]
20 changes: 20 additions & 0 deletions tests/plugins/ruby/lib_test.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let
lib = (builtins.getFlake (builtins.toString ./../../../plugins/ruby)).lib;
in
[
{
name = "When the version exists returns true";
actual = lib.hasVersion { version = "3.2.2"; };
expected = true;
}
{
name = "When the version does not exist returns false";
actual = lib.hasVersion { version = "0.0.0"; };
expected = false;
}
{
name = "When the version exists returns a package";
actual = (lib.packageFromVersion { version = "3.2.2"; }).name;
expected = "ruby-3.2.2";
}
]

0 comments on commit b0e58ce

Please sign in to comment.