about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix')
-rw-r--r--nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix b/nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix
new file mode 100644
index 000000000000..50d0364aa067
--- /dev/null
+++ b/nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix
@@ -0,0 +1,25 @@
+{ runtimeShell, lib, writeScript, bundix, bundler, bundler-audit, coreutils, git, nix }:
+
+attrPath:
+
+let
+  updateScript = writeScript "bundler-update-script" ''
+    #!${runtimeShell}
+    PATH=${lib.makeBinPath [ bundler bundler-audit bundix coreutils git nix ]}
+    set -o errexit
+    set -o nounset
+    set -o pipefail
+
+    attrPath=$1
+
+    toplevel=$(git rev-parse --show-toplevel)
+    position=$(nix eval -f "$toplevel" --raw "$attrPath.meta.position")
+    gemdir=$(dirname "$position")
+
+    cd "$gemdir"
+
+    bundler lock --update
+    bundler-audit check --update
+    bundix
+  '';
+in [ updateScript attrPath ]