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.
This commit is contained in:
@@ -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 = runCommand "discourse-rake" {
|
||||
|
||||
Reference in New Issue
Block a user