summary refs log tree commit diff
path: root/pkgs/development/ruby-modules
diff options
context:
space:
mode:
authorNick Novitski <github@nicknovitski.com>2019-07-22 05:02:47 -0700
committerzimbatm <zimbatm@zimbatm.com>2019-07-22 12:02:47 +0000
commit7136e0d0a6f61734994c566e2cc72fd75733b873 (patch)
treefcaeaea68f596a81fb885790ce87c3aac4bd52ba /pkgs/development/ruby-modules
parentb24841dd2260516bfde0b9029619a0f9ef87e97c (diff)
downloadnixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.tar
nixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.tar.gz
nixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.tar.bz2
nixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.tar.lz
nixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.tar.xz
nixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.tar.zst
nixpkgs-7136e0d0a6f61734994c566e2cc72fd75733b873.zip
bundlerUpdateScript: init and use (#64822)
Diffstat (limited to 'pkgs/development/ruby-modules')
-rw-r--r--pkgs/development/ruby-modules/bundler-env/default.nix3
-rw-r--r--pkgs/development/ruby-modules/bundler-update-script/default.nix25
-rw-r--r--pkgs/development/ruby-modules/solargraph/default.nix6
3 files changed, 31 insertions, 3 deletions
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;
   };
 }