From 7136e0d0a6f61734994c566e2cc72fd75733b873 Mon Sep 17 00:00:00 2001 From: Nick Novitski Date: Mon, 22 Jul 2019 05:02:47 -0700 Subject: bundlerUpdateScript: init and use (#64822) --- .../ruby-modules/bundler-env/default.nix | 3 ++- .../ruby-modules/bundler-update-script/default.nix | 25 ++++++++++++++++++++++ .../ruby-modules/solargraph/default.nix | 6 ++++-- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/ruby-modules/bundler-update-script/default.nix (limited to 'pkgs/development/ruby-modules') diff --git a/pkgs/development/ruby-modules/bundler-env/default.nix b/pkgs/development/ruby-modules/bundler-env/default.nix index 5d1489ba200..b3f91b678c4 100644 --- a/pkgs/development/ruby-modules/bundler-env/default.nix +++ b/pkgs/development/ruby-modules/bundler-env/default.nix @@ -13,6 +13,7 @@ , document ? [] , meta ? {} , ignoreCollisions ? false +, passthru ? {} , ... }@args: @@ -55,5 +56,5 @@ in passthru = basicEnv.passthru // { inherit basicEnv; inherit (basicEnv) env; - }; + } // passthru; }) diff --git a/pkgs/development/ruby-modules/bundler-update-script/default.nix b/pkgs/development/ruby-modules/bundler-update-script/default.nix new file mode 100644 index 00000000000..50d0364aa06 --- /dev/null +++ b/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 ] diff --git a/pkgs/development/ruby-modules/solargraph/default.nix b/pkgs/development/ruby-modules/solargraph/default.nix index 2f60dacd358..0cfd8c5d66b 100644 --- a/pkgs/development/ruby-modules/solargraph/default.nix +++ b/pkgs/development/ruby-modules/solargraph/default.nix @@ -1,15 +1,17 @@ -{ lib, bundlerApp }: +{ lib, bundlerApp, bundlerUpdateScript }: bundlerApp rec { pname = "solargraph"; exes = ["solargraph" "solargraph-runtime"]; gemdir = ./.; + passthru.updateScript = bundlerUpdateScript "solargraph"; + meta = with lib; { description = "IDE tools for the Ruby language"; homepage = http://www.github.com/castwide/solargraph; license = licenses.mit; - maintainers = with maintainers; [ worldofpeace ]; + maintainers = with maintainers; [ worldofpeace nicknovitski ]; platforms = platforms.unix; }; } -- cgit 1.4.1