discourse.mkDiscoursePlugin: Handle repos with gems
directories
Some plugin repos already have a `gems` directory. This lets the packager choose whether it should be kept and the nix packaged ruby gems should be copied into it or if it should be removed in favor of our ruby gems. (cherry picked from commit 04e6b03fa91603c7f1961cfcdcf5880c91fe6b05)
This commit is contained in:
parent
fd169abf9b
commit
ba5434c984
@ -55,6 +55,7 @@ let
|
||||
, version ? null
|
||||
, meta ? null
|
||||
, bundlerEnvArgs ? {}
|
||||
, preserveGemsDir ? false
|
||||
, src
|
||||
, ...
|
||||
}@args:
|
||||
@ -71,11 +72,20 @@ let
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
'' + lib.optionalString (bundlerEnvArgs != {}) ''
|
||||
ln -sf ${rubyEnv}/lib/ruby/gems $out/gems
|
||||
'' + ''
|
||||
'' + lib.optionalString (bundlerEnvArgs != {}) (
|
||||
if preserveGemsDir then ''
|
||||
cp -r ${rubyEnv}/lib/ruby/gems/* $out/gems/
|
||||
''
|
||||
else ''
|
||||
if [[ -e $out/gems ]]; then
|
||||
echo "Warning: The repo contains a 'gems' directory which will be removed!"
|
||||
echo " If you need to preserve it, set 'preserveGemsDir = true'."
|
||||
rm -r $out/gems
|
||||
fi
|
||||
ln -sf ${rubyEnv}/lib/ruby/gems $out/gems
|
||||
'' + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
'');
|
||||
});
|
||||
|
||||
rake = runCommandNoCC "discourse-rake" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user