You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/languages-frameworks/ruby.xml
+41-13
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,14 @@
4
4
5
5
<title>Ruby</title>
6
6
7
-
<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
8
-
this into a nix expression that contains all Gem dependencies automatically.</para>
7
+
<para>There currently is support to bundle applications that are packaged as
8
+
Ruby gems. The utility "bundix" allows you to write a
9
+
<filename>Gemfile</filename>, let bundler create a
10
+
<filename>Gemfile.lock</filename>, and then convert this into a nix
11
+
expression that contains all Gem dependencies automatically.
12
+
</para>
9
13
10
-
<para>For example, to package sensu, we did:</para>
14
+
<para>For example, to package sensu, we did:</para>
11
15
12
16
<screen>
13
17
<![CDATA[$ cd pkgs/servers/monitoring
@@ -38,14 +42,20 @@ bundlerEnv rec {
38
42
}]]>
39
43
</screen>
40
44
41
-
<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.
45
+
<para>Please check in the <filename>Gemfile</filename>,
46
+
<filename>Gemfile.lock</filename> and the
47
+
<filename>gemset.nix</filename> so future updates can be run easily.
42
48
</para>
43
49
44
-
<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:
50
+
<para>For tools written in Ruby - i.e. where the desire is to install
51
+
a package and then execute e.g. <command>rake</command> at the command
52
+
line, there is an alternative builder called <literal>bundlerApp</literal>.
53
+
Set up the <filename>gemset.nix</filename> the same way, and then, for
54
+
example:
45
55
</para>
46
56
47
57
<screen>
48
-
<![CDATA[{ lib, bundlerApp }:
58
+
<![CDATA[{ lib, bundlerApp }:
49
59
50
60
bundlerApp {
51
61
pname = "corundum";
@@ -60,15 +70,33 @@ bundlerApp {
60
70
platforms = platforms.unix;
61
71
};
62
72
}]]>
73
+
</screen>
63
74
64
-
<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.
75
+
<para>The chief advantage of <literal>bundlerApp</literal> over
76
+
<literal>bundlerEnv</literal> is the executables introduced in the
77
+
environment are precisely those selected in the <literal>exes</literal>
78
+
list, as opposed to <literal>bundlerEnv</literal> which adds all the
79
+
executables made available by gems in the gemset, which can mean e.g.
80
+
<command>rspec</command> or <command>rake</command> in unpredictable
81
+
versions available from various packages.
82
+
</para>
65
83
66
-
<para>Resulting derivations for both builders also have two helpful attributes, <literal>env</literal> and <literal>wrapper</literal>. The first one allows one to quickly drop into
67
-
<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
68
-
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
69
-
<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.
70
-
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
71
-
run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> like this:</para>
84
+
<para>Resulting derivations for both builders also have two helpful
85
+
attributes, <literal>env</literal> and <literal>wrapper</literal>.
86
+
The first one allows one to quickly drop into
87
+
<command>nix-shell</command> with the specified environment present.
88
+
E.g. <command>nix-shell -A sensu.env</command> would give you an
89
+
environment with Ruby preset so it has all the libraries necessary
90
+
for <literal>sensu</literal> in its paths. The second one can be
91
+
used to make derivations from custom Ruby scripts which have
92
+
<filename>Gemfile</filename>s with their dependencies specified. It is
93
+
a derivation with <command>ruby</command> wrapped so it can find all
94
+
the needed dependencies. For example, to make a derivation
95
+
<literal>my-script</literal> for a <filename>my-script.rb</filename>
96
+
(which should be placed in <filename>bin</filename>) you should run
97
+
<command>bundix</command> as specified above and then use
0 commit comments