summaryrefslogtreecommitdiff
path: root/v1.3/bundle_config.html
blob: a8ce908c97603d7b519a508445fce64c41df0628 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html>
<html>
  <head>
    <title>Bundler: The best way to manage a Ruby application's gems</title>
    <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
    <meta content='276VSYOko8B8vIu1i8i5qbj7_ql5PXo0dU69XQy-SL' name='globalsign-domain-verification'>
    <link href='/images/favicon.png' rel='shortcut icon' type='image/png'>
    <link href="/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <div id='body'>
      <div id='header'>
        <a class="image" href="/"><img width="725" alt="The best way to manage your application's dependencies" src="/images/gembundler.png" /></a>
      </div>
      <div id='container'>
        <div id='contents'>
          <h2>bundle config</h2>
          <div class='contents'>
            <div class='bullet'>
              <div class='description'>
                Retrieve or set a configuration value
              </div>
              <pre class="highlight plaintext">$ bundle config [NAME [VALUE]] [--local] [--global] [--delete]</pre>
              <div class='notes'>
                <p>
                  Options:
                </p>
                <p>
                  <code>--local</code>: Get/set local configuration
                </p>
                <p>
                  <code>--global</code>: Get/set global configuration
                </p>
                <p>
                  <code>--delete</code>: Delete <code>NAME</code> value
                </p>
              </div>
              <div class='description'>
                <p>
                  Retrieves or sets a configuration value. If only parameter is provided,
                  retrieve the value. If two parameters are provided, replace the existing
                  value with the newly provided one.
                </p>
                <p>
                  By default, setting a configuration value sets it for all projects on
                  the machine.
                </p>
                <p>
                  If a global setting is superceded by local configuration, this command
                  will show the current value, as well as any superceded values and where
                  they were specified.
                </p>
              </div>
            </div>
            <div class='bullet' id='config'>
              <div class='description'>
                Get your bundle configuration.
              </div>
              <div class='how'>
                <pre class="highlight plaintext">$ bundle config</pre>
                <div class='notes'>
                  Executing <code>bundle config</code> with no parameters will print a
                  list of all bundler configuration for the current bundle, and where
                  that configuration was set.
                </div>
              </div>
            </div>
            <div class='bullet' id='get'>
              <div class='description'>
                Get your bundle configuration for <code>NAME</code> variable.
              </div>
              <div class='how'>
                <pre class="highlight plaintext">$ bundle config NAME</pre>
                <div class='notes'>
                  Will print the value of that configuration setting for
                  <code>NAME</code>, and where it was set. Will print both local and
                  global configuration.
                </div>
              </div>
            </div>
            <div class='bullet' id='set'>
              <div class='description'>
                Set your bundle configuration for <code>NAME</code> variable to
                <code>VALUE</code>.
              </div>
              <div class='how'>
                <pre class="highlight plaintext">$ bundle config NAME VALUE</pre>
                <div class='notes'>
                  Will set <code>NAME</code> to <code>VALUE</code> for all bundles
                  executed as the current user (i.e. global setting). The configuration
                  will be stored in  <code>~/.bundle/config</code>. If <code>NAME</code>
                  already is set, <code>NAME</code> will be overridden and user will be
                  warned.
                </div>
              </div>
            </div>
            <div class='bullet' id='global'>
              <div class='description'>
                Set your bundle global/user configuration for <code>NAME</code> variable
                to <code>VALUE</code>.
              </div>
              <div class='how'>
                <pre class="highlight plaintext">$ bundle config --global NAME VALUE </pre>
                <div class='notes'>
                  Works the same as the command above.
                </div>
              </div>
            </div>
            <div class='bullet' id='local'>
              <div class='description'>
                Set your bundle local configuration for <code>NAME</code> variable to
                <code>VALUE</code>.
              </div>
              <div class='how'>
                <pre class="highlight plaintext">$ bundle config --local NAME VALUE </pre>
                <div class='notes'>
                  Works the same as the two command above but for the local application.
                  The configuration will be stored in <code>app/.bundle/config</code>.
                </div>
              </div>
            </div>
            <div class='bullet' id='delete'>
              <div class='description'>
                Delete the configuration for <code>NAME</code> in both local and global sources.
              </div>
              <div class='how'>
                <pre class="highlight plaintext">$ bundle config --delete NAME</pre>
                <div class='notes'>
                  Will delete the configuration for <code>NAME</code> variable in both local and global sources. Not compatible with --global or --local flag.
                </div>
              </div>
            </div>
          </div>
          <h2>Build options</h2>
          <div class='contents'>
            <div class='bullet' id='build_options'>
              <div class='description'>
                <p>
                  You can use <code>bundle config</code> to give bundler the flags to
                  pass to the gem installer every time bundler tries to install a
                  particular gem.
                </p>
                <p>
                  A very common example, the <code>mysql</code> gem, requires Snow
                  Leopard users to pass configuration flags to <code>gem install</code>
                  to specify where to find the <code>mysql_config</code> executable.
                </p>
                <div class='how'>
                  <pre class="highlight plaintext">$ gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config&#x000A;</pre>
                </div>
                <p>
                  Since the specific location of that executable can change from machine
                  to machine, you can specify these flags on a per-machine basis.
                </p>
                <div class='how'>
                  <pre class="highlight plaintext">$ bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config</pre>
                </div>
                <p>
                  After running this command, every time bundler needs to install the
                  <code>mysql</code> gem, it will pass along the flags you specified.
                </p>
              </div>
            </div>
          </div>
          <h2>Configuration keys</h2>
          <div class='contents'>
            <div class='bullet' id='configuration_keys'>
              <div class='description'>
                <p>
                  Configuration keys in bundler have two forms: the canonical form and
                  the environment variable form.
                </p>
                <p>
                  For instance, passing the <code>--without</code> flag to
                  <code>bundle install</code> prevents Bundler from installing
                  certain groups specified in the <code>Gemfile</code>. Bundler persists
                  this value in <code>app/.bundle/config</code> so that calls to
                  <code>Bundler.setup</code> do not try to find gems from the
                  <code>Gemfile</code> that you didn't install. Additionally, subsequent
                  calls to <code>bundle install</code> remember this setting and
                  skip those groups.
                </p>
                <p>
                  The canonical form of this configuration is <code>"without"</code>. To
                  convert the canonical form to the environment variable form, capitalize
                  it, and prepend <code>BUNDLE_</code>. The environment variable form of
                  <code>"without"</code> is <code>BUNDLE_WITHOUT</code>.
                </p>
              </div>
            </div>
          </div>
          <h2>List of available keys</h2>
          <div class='contents'>
            <div class='bullet' id='available_keys'>
              <div class='description'>
                <p>
                  The following is a list of all configuration keys and their purpose.
                  You can learn more about their operation in
                  <code>bundle install</code>.
                </p>
                <ul>
                  <li>
                    <code>path</code> (<code>BUNDLE_PATH</code>): The location on disk
                    to install gems. Defaults to <code>$GEM_HOME</code> in development
                    and <code>vendor/bundle</code> when <code>--deployment</code> is used.
                  </li>
                  <li>
                    <code>frozen</code> (<code>BUNDLE_FROZEN</code>): Disallow changes to
                    the <code>Gemfile</code>. Defaults to <code>true</code> when
                    <code>--deployment</code> is used.
                  </li>
                  <li>
                    <code>without</code> (<code>BUNDLE_WITHOUT</code>): A
                    <code>:</code>-separated list of groups whose gems bundler should not
                    installer
                  </li>
                  <li>
                    <code>bin</code> (<code>BUNDLE_BIN</code>): Install executables from
                    gems in the bundle to the specified directory. Defaults to
                    <code>false</code>.
                  </li>
                  <li>
                    <code>gemfile</code> (<code>BUNDLE_GEMFILE</code>): The name of the
                    file that bundler should use as the <code>Gemfile</code>. This location
                    of this file also sets the root of the project, which is used to
                    resolve relative paths in the <code>Gemfile</code>, among other things.
                    By default, bundler will search up from the current working directory
                    until it finds a <code>Gemfile</code>.
                  </li>
                </ul>
                <p>
                  In general, you should set these settings per-application by using the
                  applicable flag to the <code>bundle install</code> command.
                </p>
                <p>
                  You can set them globally either via environment variables or
                  <code>bundle config</code>, whichever is preferable for your setup. If
                  you use both, environment variables will take preference over global
                  settings.
                </p>
              </div>
            </div>
          </div>
          <h2>Local git repositories</h2>
          <div class='contents'>
            <div class='bullet' id='local_git_repos'>
              <div class='description'>
                <p>
                  Bundler also allows you to work against a git repository locally
                  instead of using the remote version. This can be achieved by setting
                  up a local override:
                </p>
                <pre class="highlight plaintext">$ bundle config local.GEM_NAME /path/to/local/git/repository&#x000A;</pre>
                <p>
                  For example, in order to use a local Rack repository, a developer
                  could call:
                </p>
                <pre class="highlight plaintext">$ bundle config local.rack ~/Work/git/rack&#x000A;</pre>
                <p>
                  Now instead of checking out the remote git repository, the local
                  override will be used. Similar to a path source, every time the local
                  git repository change, changes will be automatically picked up by
                  Bundler. This means a commit in the local git repo will update the
                  revision in the <code>Gemfile.lock</code> to the local git repo
                  revision. This requires the same attention as git submodules. Before
                  pushing to the remote, you need to ensure the local override was
                  pushed, otherwise you may point to a commit that only exists in your
                  local machine.
                </p>
                <p>
                  Bundler does many checks to ensure a developer won't work with
                  invalid references. Particularly, we force a developer to specify a
                  branch in the <code>Gemfile</code> in order to use this feature. If the
                  branch specified in the `Gemfile` and the current branch in the local
                  git repository do not match, Bundler will abort. This ensures that a
                  developer is always working against the correct branches, and prevents
                  accidental locking to a different branch.
                </p>
                <p>
                  Finally, Bundler also ensures that the current revision in the
                  <code>Gemfile.lock</code> exists in the local git repository. By doing
                  this, Bundler forces you to fetch the latest changes in the remotes.
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div id='footer'>
      <img src="/images/emocow.png" />
      <img src="/images/panda.jpg" />
      <div class='spacer'></div>
      <div id='credits'>
        <p>
          Many thanks to Bundler's <a href="/contributors.html">contributors</a>
          and <a href="/sponsors.html">sponsors</a>
        </p>
      </div>
      <div class='spacer'></div>
      <img src="/images/bundler-small.png" />
    </div>
    <a href='http://github.com/bundler/bundler/' id='github'>
      <img alt='Fork me on GitHub' src='http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png'>
    </a>
    <div id='prod-versions'>
      Docs:
      <a href="/v0.9/">v0.9</a>
      <a href="/v1.0/">v1.0</a>
      <a href="/v1.1/">v1.1</a>
      <a href="/v1.2/">v1.2</a>
      <a class="current" href="/v1.3/">v1.3</a>
      <a href="/v1.5/index.html">v1.5</a>
      <a href="/">v1.6</a>
    </div>
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-39559982-1', 'bundler.io');
      ga('send', 'pageview');
    </script>
  </body>
</html>