summary refs log tree commit diff
path: root/pkgs/development/ruby-modules/bundler-update-script/default.nix
blob: 50d0364aa0672498dec1e3250f88a4b5027c4af4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 ]