diff options
Diffstat (limited to 'doc/languages-frameworks/ruby.xml')
-rw-r--r-- | doc/languages-frameworks/ruby.xml | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/doc/languages-frameworks/ruby.xml b/doc/languages-frameworks/ruby.xml index 6bb809192f89..c52a72a3df4a 100644 --- a/doc/languages-frameworks/ruby.xml +++ b/doc/languages-frameworks/ruby.xml @@ -1,17 +1,19 @@ <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-language-ruby"> + <title>Ruby</title> -<title>Ruby</title> + <para> + There currently is support to bundle applications that are packaged as Ruby + gems. The utility "bundix" allows you to write a + <filename>Gemfile</filename>, let bundler create a + <filename>Gemfile.lock</filename>, and then convert this into a nix + expression that contains all Gem dependencies automatically. + </para> -<para>There currently is support to bundle applications that are packaged as -Ruby gems. The utility "bundix" allows you to write a -<filename>Gemfile</filename>, let bundler create a -<filename>Gemfile.lock</filename>, and then convert this into a nix -expression that contains all Gem dependencies automatically. -</para> - -<para>For example, to package sensu, we did:</para> + <para> + For example, to package sensu, we did: + </para> <screen> <![CDATA[$ cd pkgs/servers/monitoring @@ -42,17 +44,18 @@ bundlerEnv rec { }]]> </screen> -<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> + 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>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> + <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 }: @@ -72,31 +75,31 @@ bundlerApp { }]]> </screen> -<para>The chief advantage of <literal>bundlerApp</literal> over -<literal>bundlerEnv</literal> is 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 unpredictable -versions available from various packages. -</para> - -<para>Resulting derivations for both builders also have two helpful -attributes, <literal>env</literal> and <literal>wrappedRuby</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> like this: -</para> + <para> + The chief advantage of <literal>bundlerApp</literal> over + <literal>bundlerEnv</literal> is 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 unpredictable versions + available from various packages. + </para> + + <para> + Resulting derivations for both builders also have two helpful attributes, + <literal>env</literal> and <literal>wrappedRuby</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> like this: + </para> <programlisting> <![CDATA[let env = bundlerEnv { @@ -118,5 +121,4 @@ in stdenv.mkDerivation { ''; }]]> </programlisting> - </section> |