diff options
author | Judson <nyarly@gmail.com> | 2017-07-02 17:55:41 -0700 |
---|---|---|
committer | Judson <nyarly@gmail.com> | 2017-07-02 17:55:41 -0700 |
commit | 728bb987ec4c3bcf7e43cb7b98db229ec52b93ed (patch) | |
tree | 57801d76da9e9a00a878b79391144351c3db101e /doc | |
parent | 0641253ae66d748b5ff0562c4edba3f9502a38e3 (diff) |
Adding docs for bundlerApp.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/ruby.xml | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/doc/languages-frameworks/ruby.xml b/doc/languages-frameworks/ruby.xml index 3c6e4f5e01a48..6a14854b5c56e 100644 --- a/doc/languages-frameworks/ruby.xml +++ b/doc/languages-frameworks/ruby.xml @@ -41,12 +41,34 @@ bundlerEnv rec { <para>Please check in the <filename>Gemfile</filename>, <filename>Gemfile.lock</filename> and the <filename>gemset.nix</filename> so future updates can be run easily. </para> -<para>Resulting derivations also have two helpful items, <literal>env</literal> and <literal>wrapper</literal>. The first one allows one to quickly drop into +<para>For tools written in Ruby - i.e. where the desire is to install a package and then execute e.g. <command>rake</command> at the command line, there is an alternative builder called <literal>bundlerApp</literal>. Set up the <filename>gemset.nix</filename> the same way, and then, for example: +</para> + +<screen> + <![CDATA[{ lib, bundlerApp }: + +bundlerApp { + pname = "corundum"; + gemdir = ./.; + exes = [ "corundum-skel" ]; + + meta = with lib; { + description = "Tool and libraries for maintaining Ruby gems."; + homepage = https://github.com/nyarly/corundum; + license = licenses.mit; + maintainers = [ maintainers.nyarly ]; + platforms = platforms.unix; + }; +}]]> + +<para>The chief advantage of <literal>bundlerApp</literal> over <literal>bundlerEnv</literal> is the the executables introduced in the environment are precisely those selected in the <literal>exes</literal> list, as opposed to <literal>bundlerEnv</literal> which adds all the executables made available by gems in the gemset, which can mean e.g. <command>rspec</command> or <command>rake</command> in unpredicable versions available from various packages. + +<para>Resulting derivations for both builders also have two helpful items, <literal>env</literal> and <literal>wrapper</literal>. The first one allows one to quickly drop into <command>nix-shell</command> with the specified environment present. E.g. <command>nix-shell -A sensu.env</command> would give you an environment with Ruby preset so it has all the libraries necessary for <literal>sensu</literal> in its paths. The second one can be used to make derivations from custom Ruby scripts which have <filename>Gemfile</filename>s with their dependencies specified. It is a derivation with <command>ruby</command> wrapped so it can find all the needed dependencies. For example, to make a derivation <literal>my-script</literal> for a <filename>my-script.rb</filename> (which should be placed in <filename>bin</filename>) you should -run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> lile this:</para> +run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> like this:</para> <programlisting> <![CDATA[let env = bundlerEnv { @@ -74,4 +96,3 @@ in stdenv.mkDerivation { </programlisting> </section> - |