Rename getName helper to getPluginName.
This commit is contained in:
parent
fe3073ddaf
commit
2547713ec4
2 changed files with 11 additions and 11 deletions
|
@ -17,9 +17,9 @@ let
|
||||||
3. (path) baseNameOf plugin.dir
|
3. (path) baseNameOf plugin.dir
|
||||||
|
|
||||||
Type:
|
Type:
|
||||||
getName :: Plugin -> String
|
getPluginName :: Plugin -> String
|
||||||
*/
|
*/
|
||||||
getName =
|
getPluginName =
|
||||||
plugin:
|
plugin:
|
||||||
if (plugin ? name && plugin.name != null) then
|
if (plugin ? name && plugin.name != null) then
|
||||||
assert builtins.isString plugin.name;
|
assert builtins.isString plugin.name;
|
||||||
|
@ -124,7 +124,7 @@ let
|
||||||
resolvePlugin = pluginFn: pluginFn vPlug;
|
resolvePlugin = pluginFn: pluginFn vPlug;
|
||||||
in
|
in
|
||||||
lib.pipe plugin [
|
lib.pipe plugin [
|
||||||
# Resolve dir and dependencies first so getName can resolve names
|
# Resolve dir and dependencies first so getPluginName can resolve names
|
||||||
(
|
(
|
||||||
plugin:
|
plugin:
|
||||||
plugin
|
plugin
|
||||||
|
@ -132,7 +132,7 @@ let
|
||||||
dir = runIfSet resolvePlugin "dir";
|
dir = runIfSet resolvePlugin "dir";
|
||||||
dependencies = runIfSet (
|
dependencies = runIfSet (
|
||||||
pluginListFn:
|
pluginListFn:
|
||||||
(map (pluginOrPackage: getName (pluginWrapper pluginOrPackage))) (resolvePlugin pluginListFn)
|
(map (pluginOrPackage: getPluginName (pluginWrapper pluginOrPackage))) (resolvePlugin pluginListFn)
|
||||||
) "dependencies";
|
) "dependencies";
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -141,7 +141,7 @@ let
|
||||||
plugin
|
plugin
|
||||||
// {
|
// {
|
||||||
__posArgs = runIfSet lib.flatten "short";
|
__posArgs = runIfSet lib.flatten "short";
|
||||||
name = getName plugin;
|
name = getPluginName plugin;
|
||||||
enabled = runIfSet stringLiteral "enabled";
|
enabled = runIfSet stringLiteral "enabled";
|
||||||
cond = runIfSet stringLiteral "cond";
|
cond = runIfSet stringLiteral "cond";
|
||||||
init = runIfSet stringLiteral "init";
|
init = runIfSet stringLiteral "init";
|
||||||
|
|
|
@ -21,25 +21,25 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
helpers = {
|
helpers = {
|
||||||
getName = {
|
getPluginName = {
|
||||||
testName = {
|
testName = {
|
||||||
expr = lazyUtils.helpers.getName (nullPlugin // { name = "nameTest"; });
|
expr = lazyUtils.helpers.getPluginName (nullPlugin // { name = "nameTest"; });
|
||||||
expected = "nameTest";
|
expected = "nameTest";
|
||||||
};
|
};
|
||||||
testShort = {
|
testShort = {
|
||||||
expr = lazyUtils.helpers.getName (nullPlugin // { short = "shortTest"; });
|
expr = lazyUtils.helpers.getPluginName (nullPlugin // { short = "shortTest"; });
|
||||||
expected = "shortTest";
|
expected = "shortTest";
|
||||||
};
|
};
|
||||||
testDir = {
|
testDir = {
|
||||||
expr = lazyUtils.helpers.getName (nullPlugin // { dir = ./empty.txt; });
|
expr = lazyUtils.helpers.getPluginName (nullPlugin // { dir = ./empty.txt; });
|
||||||
expected = "empty.txt";
|
expected = "empty.txt";
|
||||||
};
|
};
|
||||||
testDrv = {
|
testDrv = {
|
||||||
expr = lazyUtils.helpers.getName (nullPlugin // { dir = miniDrv; });
|
expr = lazyUtils.helpers.getPluginName (nullPlugin // { dir = miniDrv; });
|
||||||
expected = "test";
|
expected = "test";
|
||||||
};
|
};
|
||||||
testInvalidInput = {
|
testInvalidInput = {
|
||||||
expr = lazyUtils.helpers.getName { };
|
expr = lazyUtils.helpers.getPluginName { };
|
||||||
expectedError = {
|
expectedError = {
|
||||||
type = "ThrownError";
|
type = "ThrownError";
|
||||||
# For some reason there is whitespace after the newline
|
# For some reason there is whitespace after the newline
|
||||||
|
|
Loading…
Add table
Reference in a new issue