bundler 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- data/.gitignore +12 -0
- data/CHANGELOG.md +28 -6
- data/ISSUES.md +1 -1
- data/README.md +7 -5
- data/Rakefile +173 -0
- data/UPGRADING.md +103 -0
- data/bundler.gemspec +28 -0
- data/lib/bundler.rb +1 -0
- data/lib/bundler/capistrano.rb +2 -31
- data/lib/bundler/cli.rb +18 -16
- data/lib/bundler/deployment.rb +37 -0
- data/lib/bundler/dsl.rb +3 -3
- data/lib/bundler/gem_helper.rb +4 -7
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/installer.rb +1 -0
- data/lib/bundler/lockfile_parser.rb +1 -1
- data/lib/bundler/man/bundle +1 -1
- data/lib/bundler/man/bundle-config +92 -0
- data/lib/bundler/man/bundle-config.txt +72 -30
- data/lib/bundler/man/bundle-exec +1 -1
- data/lib/bundler/man/bundle-exec.txt +1 -1
- data/lib/bundler/man/bundle-install +1 -1
- data/lib/bundler/man/bundle-install.txt +1 -1
- data/lib/bundler/man/bundle-package +1 -1
- data/lib/bundler/man/bundle-package.txt +1 -1
- data/lib/bundler/man/bundle-update +1 -1
- data/lib/bundler/man/bundle-update.txt +1 -1
- data/lib/bundler/man/bundle.txt +1 -1
- data/lib/bundler/man/gemfile.5 +2 -2
- data/lib/bundler/man/gemfile.5.txt +2 -2
- data/lib/bundler/settings.rb +2 -2
- data/lib/bundler/source.rb +2 -3
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -12
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +9 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +98 -0
- data/man/bundle-install.ronn +310 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +77 -0
- data/man/gemfile.5.ronn +254 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +205 -0
- data/spec/cache/git_spec.rb +9 -0
- data/spec/cache/path_spec.rb +27 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +171 -0
- data/spec/install/deprecated_spec.rb +43 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +272 -0
- data/spec/install/gems/groups_spec.rb +209 -0
- data/spec/install/gems/locked_spec.rb +48 -0
- data/spec/install/gems/packed_spec.rb +72 -0
- data/spec/install/gems/platform_spec.rb +181 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +709 -0
- data/spec/install/gems/sudo_spec.rb +77 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +96 -0
- data/spec/install/git_spec.rb +552 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +335 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/flex_spec.rb +625 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +102 -0
- data/spec/other/exec_spec.rb +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +116 -0
- data/spec/other/help_spec.rb +36 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +24 -0
- data/spec/other/open_spec.rb +51 -0
- data/spec/other/show_spec.rb +99 -0
- data/spec/pack/gems_spec.rb +22 -0
- data/spec/quality_spec.rb +55 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +57 -0
- data/spec/runtime/environment_rb_spec.rb +170 -0
- data/spec/runtime/executable_spec.rb +110 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +261 -0
- data/spec/runtime/setup_spec.rb +412 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +81 -0
- data/spec/support/builders.rb +566 -0
- data/spec/support/helpers.rb +243 -0
- data/spec/support/indexes.rb +113 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +71 -0
- data/spec/support/platforms.rb +49 -0
- data/spec/support/ruby_ext.rb +19 -0
- data/spec/support/rubygems_ext.rb +30 -0
- data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +86 -0
- data/spec/update/git_spec.rb +159 -0
- data/spec/update/source_spec.rb +50 -0
- metadata +170 -32
- data/ROADMAP.md +0 -36
@@ -0,0 +1,59 @@
|
|
1
|
+
bundle-package(1) -- Package your needed `.gem` files into your application
|
2
|
+
===========================================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`bundle package`
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
|
10
|
+
Copy all of the `.gem` files needed to run the application into the
|
11
|
+
`vendor/cache` directory. In the future, when running [bundle install(1)][bundle-install],
|
12
|
+
use the gems in the cache in preference to the ones on `rubygems.org`.
|
13
|
+
|
14
|
+
## GIT AND PATH GEMS
|
15
|
+
|
16
|
+
In Bundler 1.0, the `bundle package` command only packages `.gem` files,
|
17
|
+
not gems specified using the `:git` or `:path` options. This will likely
|
18
|
+
change in the future.
|
19
|
+
|
20
|
+
## REMOTE FETCHING
|
21
|
+
|
22
|
+
By default, if you simply run [bundle install(1)][bundle-install] after running
|
23
|
+
[bundle package(1)][bundle-package], bundler will still connect to `rubygems.org`
|
24
|
+
to check whether a platform-specific gem exists for any of the gems
|
25
|
+
in `vendor/cache`.
|
26
|
+
|
27
|
+
For instance, consider this Gemfile(5):
|
28
|
+
|
29
|
+
source "http://rubygems.org"
|
30
|
+
|
31
|
+
gem "nokogiri"
|
32
|
+
|
33
|
+
If you run `bundle package` under C Ruby, bundler will retrieve
|
34
|
+
the version of `nokogiri` for the `"ruby"` platform. If you deploy
|
35
|
+
to JRuby and run `bundle install`, bundler is forced to check to
|
36
|
+
see whether a `"java"` platformed `nokogiri` exists.
|
37
|
+
|
38
|
+
Even though the `nokogiri` gem for the Ruby platform is
|
39
|
+
_technically_ acceptable on JRuby, it actually has a C extension
|
40
|
+
that does not run on JRuby. As a result, bundler will, by default,
|
41
|
+
still connect to `rubygems.org` to check whether it has a version
|
42
|
+
of one of your gems more specific to your platform.
|
43
|
+
|
44
|
+
This problem is also not just limited to the `"java"` platform.
|
45
|
+
A similar (common) problem can happen when developing on Windows
|
46
|
+
and deploying to Linux, or even when developing on OSX and
|
47
|
+
deploying to Linux.
|
48
|
+
|
49
|
+
If you know for sure that the gems packaged in `vendor/cache`
|
50
|
+
are appropriate for the platform you are on, you can run
|
51
|
+
`bundle install --local` to skip checking for more appropriate
|
52
|
+
gems, and just use the ones in `vendor/cache`.
|
53
|
+
|
54
|
+
One way to be sure that you have the right platformed versions
|
55
|
+
of all your gems is to run `bundle package` on an identical
|
56
|
+
machine and check in the gems. For instance, you can run
|
57
|
+
`bundle package` on an identical staging box during your
|
58
|
+
staging process, and check in the `vendor/cache` before
|
59
|
+
deploying to production.
|
@@ -0,0 +1,176 @@
|
|
1
|
+
bundle-update(1) -- Update your gems to the latest available versions
|
2
|
+
=====================================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`bundle update` <*gems> [--source=NAME]
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
|
10
|
+
Update the gems specified (all gems, if none are specified), ignoring
|
11
|
+
the previously installed gems specified in the `Gemfile.lock`. In
|
12
|
+
general, you should use [bundle install(1)][bundle-install] to install the same exact
|
13
|
+
gems and versions across machines.
|
14
|
+
|
15
|
+
You would use `bundle update` to explicitly update the version of a
|
16
|
+
gem.
|
17
|
+
|
18
|
+
## OPTIONS
|
19
|
+
|
20
|
+
* `--source=<name>`:
|
21
|
+
The name of a `:git` or `:path` source used in the Gemfile(5). For
|
22
|
+
instance, with a `:git` source of `http://github.com/rails/rails.git`,
|
23
|
+
you would call `bundle update --source rails`
|
24
|
+
|
25
|
+
## UPDATING ALL GEMS
|
26
|
+
|
27
|
+
If you run `bundle update` with no parameters, bundler will ignore
|
28
|
+
any previously installed gems and resolve all dependencies again
|
29
|
+
based on the latest versions of all gems available in the sources.
|
30
|
+
|
31
|
+
Consider the following Gemfile(5):
|
32
|
+
|
33
|
+
source "http://rubygems.org"
|
34
|
+
|
35
|
+
gem "rails", "3.0.0.rc"
|
36
|
+
gem "nokogiri"
|
37
|
+
|
38
|
+
When you run [bundle install(1)][bundle-install] the first time, bundler will resolve
|
39
|
+
all of the dependencies, all the way down, and install what you need:
|
40
|
+
|
41
|
+
Fetching source index for http://rubygems.org/
|
42
|
+
Installing rake (0.8.7)
|
43
|
+
Installing abstract (1.0.0)
|
44
|
+
Installing activesupport (3.0.0.rc)
|
45
|
+
Installing builder (2.1.2)
|
46
|
+
Installing i18n (0.4.1)
|
47
|
+
Installing activemodel (3.0.0.rc)
|
48
|
+
Installing erubis (2.6.6)
|
49
|
+
Installing rack (1.2.1)
|
50
|
+
Installing rack-mount (0.6.9)
|
51
|
+
Installing rack-test (0.5.4)
|
52
|
+
Installing tzinfo (0.3.22)
|
53
|
+
Installing actionpack (3.0.0.rc)
|
54
|
+
Installing mime-types (1.16)
|
55
|
+
Installing polyglot (0.3.1)
|
56
|
+
Installing treetop (1.4.8)
|
57
|
+
Installing mail (2.2.5)
|
58
|
+
Installing actionmailer (3.0.0.rc)
|
59
|
+
Installing arel (0.4.0)
|
60
|
+
Installing activerecord (3.0.0.rc)
|
61
|
+
Installing activeresource (3.0.0.rc)
|
62
|
+
Installing bundler (1.0.0.rc.3)
|
63
|
+
Installing nokogiri (1.4.3.1) with native extensions
|
64
|
+
Installing thor (0.14.0)
|
65
|
+
Installing railties (3.0.0.rc)
|
66
|
+
Installing rails (3.0.0.rc)
|
67
|
+
|
68
|
+
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
|
69
|
+
|
70
|
+
As you can see, even though you have just two gems in the Gemfile(5), your application
|
71
|
+
actually needs 25 different gems in order to run. Bundler remembers the exact versions
|
72
|
+
it installed in `Gemfile.lock`. The next time you run [bundle install(1)][bundle-install], bundler skips
|
73
|
+
the dependency resolution and installs the same gems as it installed last time.
|
74
|
+
|
75
|
+
After checking in the `Gemfile.lock` into version control and cloning it on another
|
76
|
+
machine, running [bundle install(1)][bundle-install] will _still_ install the gems that you installed
|
77
|
+
last time. You don't need to worry that a new release of `erubis` or `mail` changes
|
78
|
+
the gems you use.
|
79
|
+
|
80
|
+
However, from time to time, you might want to update the gems you are using to the
|
81
|
+
newest versions that still match the gems in your Gemfile(5).
|
82
|
+
|
83
|
+
To do this, run `bundle update`, which will ignore the `Gemfile.lock`, and resolve
|
84
|
+
all the dependencies again. Keep in mind that this process can result in a significantly
|
85
|
+
different set of the 25 gems, based on the requirements of new gems that the gem
|
86
|
+
authors released since the last time you ran `bundle update`.
|
87
|
+
|
88
|
+
## UPDATING A LIST OF GEMS
|
89
|
+
|
90
|
+
Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the
|
91
|
+
gems that you specified locked to the versions in the `Gemfile.lock`.
|
92
|
+
|
93
|
+
For instance, in the scenario above, imagine that `nokogiri` releases version `1.4.4`, and
|
94
|
+
you want to update it _without_ updating Rails and all of its dependencies. To do this,
|
95
|
+
run `bundle update nokogiri`.
|
96
|
+
|
97
|
+
Bundler will update `nokogiri` and any of its dependencies, but leave alone Rails and
|
98
|
+
its dependencies.
|
99
|
+
|
100
|
+
## OVERLAPPING DEPENDENCIES
|
101
|
+
|
102
|
+
Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same
|
103
|
+
second-level dependency. For instance, consider the case of `thin` and
|
104
|
+
`rack-perftools-profiler`.
|
105
|
+
|
106
|
+
source "http://rubygems.org"
|
107
|
+
|
108
|
+
gem "thin"
|
109
|
+
gem "rack-perftools-profiler"
|
110
|
+
|
111
|
+
The `thin` gem depends on `rack >= 1.0`, while `rack-perftools-profiler` depends
|
112
|
+
on `rack ~> 1.0`. If you run bundle install, you get:
|
113
|
+
|
114
|
+
Fetching source index for http://rubygems.org/
|
115
|
+
Installing daemons (1.1.0)
|
116
|
+
Installing eventmachine (0.12.10) with native extensions
|
117
|
+
Installing open4 (1.0.1)
|
118
|
+
Installing perftools.rb (0.4.7) with native extensions
|
119
|
+
Installing rack (1.2.1)
|
120
|
+
Installing rack-perftools_profiler (0.0.2)
|
121
|
+
Installing thin (1.2.7) with native extensions
|
122
|
+
Using bundler (1.0.0.rc.3)
|
123
|
+
|
124
|
+
In this case, the two gems have their own set of dependencies, but they share
|
125
|
+
`rack` in common. If you run `bundle update thin`, bundler will update `daemons`,
|
126
|
+
`eventmachine` and `rack`, which are dependencies of `thin`, but not `open4` or
|
127
|
+
`perftools.rb`, which are dependencies of `rack-perftools_profiler`. Note that
|
128
|
+
`bundle update thin` will update `rack` even though it's _also_ a dependency of
|
129
|
+
`rack-perftools_profiler`.
|
130
|
+
|
131
|
+
`In short`, when you update a gem using `bundle update`, bundler will update all
|
132
|
+
dependencies of that gem, including those that are also dependencies of another gem.
|
133
|
+
|
134
|
+
In this scenario, updating the `thin` version manually in the Gemfile(5),
|
135
|
+
and then running [bundle install(1)][bundle-install] will only update `daemons` and `eventmachine`,
|
136
|
+
but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section
|
137
|
+
of [bundle install(1)][bundle-install].
|
138
|
+
|
139
|
+
## RECOMMENDED WORKFLOW
|
140
|
+
|
141
|
+
In general, when working with an application managed with bundler, you should
|
142
|
+
use the following workflow:
|
143
|
+
|
144
|
+
* After you create your Gemfile(5) for the first time, run
|
145
|
+
|
146
|
+
$ bundle install
|
147
|
+
|
148
|
+
* Check the resulting `Gemfile.lock` into version control
|
149
|
+
|
150
|
+
$ git add Gemfile.lock
|
151
|
+
|
152
|
+
* When checking out this repository on another development machine, run
|
153
|
+
|
154
|
+
$ bundle install
|
155
|
+
|
156
|
+
* When checking out this repository on a deployment machine, run
|
157
|
+
|
158
|
+
$ bundle install --deployment
|
159
|
+
|
160
|
+
* After changing the Gemfile(5) to reflect a new or update dependency, run
|
161
|
+
|
162
|
+
$ bundle install
|
163
|
+
|
164
|
+
* Make sure to check the updated `Gemfile.lock` into version control
|
165
|
+
|
166
|
+
$ git add Gemfile.lock
|
167
|
+
|
168
|
+
* If [bundle install(1)][bundle-install] reports a conflict, manually update the specific
|
169
|
+
gems that you changed in the Gemfile(5)
|
170
|
+
|
171
|
+
$ bundle update rails thin
|
172
|
+
|
173
|
+
* If you want to update all the gems to the latest possible versions that
|
174
|
+
still match the gems listed in the Gemfile(5), run
|
175
|
+
|
176
|
+
$ bundle update
|
data/man/bundle.ronn
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
bundle(1) -- Ruby Dependency Management
|
2
|
+
=======================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`bundle` [--no-color] COMMAND [ARGS]
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
|
10
|
+
Bundler manages an `application's dependencies` through its entire life
|
11
|
+
across many machines systematically and repeatably.
|
12
|
+
|
13
|
+
See [the bundler website](http://gembundler.com) for information on getting
|
14
|
+
started, and Gemfile(5) for more information on the `Gemfile` format.
|
15
|
+
|
16
|
+
## OPTIONS
|
17
|
+
|
18
|
+
* `--no-color`:
|
19
|
+
Prints all output without color
|
20
|
+
|
21
|
+
## BUNDLE COMMANDS
|
22
|
+
|
23
|
+
We divide `bundle` subcommands into primary commands and utilities.
|
24
|
+
|
25
|
+
## PRIMARY COMMANDS
|
26
|
+
|
27
|
+
* [bundle install(1)][bundle-install]:
|
28
|
+
Install the gems specified by the `Gemfile` or `Gemfile.lock`
|
29
|
+
|
30
|
+
* [bundle update(1)][bundle-update]:
|
31
|
+
Update dependencies to their latest versions
|
32
|
+
|
33
|
+
* [bundle package(1)][bundle-package]:
|
34
|
+
Package the .gem files required by your application into the
|
35
|
+
`vendor/cache` directory
|
36
|
+
|
37
|
+
* [bundle exec(1)][bundle-exec]:
|
38
|
+
Execute a script in the context of the current bundle
|
39
|
+
|
40
|
+
* [bundle config(1)][bundle-config]:
|
41
|
+
Specify and read configuration options for bundler
|
42
|
+
|
43
|
+
## UTILITIES
|
44
|
+
|
45
|
+
* `bundle check(1)`:
|
46
|
+
Determine whether the requirements for your application are installed
|
47
|
+
and available to bundler
|
48
|
+
|
49
|
+
* `bundle list(1)`:
|
50
|
+
Show all of the gems in the current bundle
|
51
|
+
|
52
|
+
* `bundle show(1)`:
|
53
|
+
Show the source location of a particular gem in the bundle
|
54
|
+
|
55
|
+
* `bundle console(1)`:
|
56
|
+
Start an IRB session in the context of the current bundle
|
57
|
+
|
58
|
+
* `bundle open(1)`:
|
59
|
+
Open an installed gem in the editor
|
60
|
+
|
61
|
+
* `bundle viz(1)`:
|
62
|
+
Generate a visual representation of your dependencies
|
63
|
+
|
64
|
+
* `bundle init(1)`:
|
65
|
+
Generate a simple `Gemfile`, placed in the current directory
|
66
|
+
|
67
|
+
* `bundle gem(1)`:
|
68
|
+
Create a simple gem, suitable for development with bundler
|
69
|
+
|
70
|
+
## OBSOLETE
|
71
|
+
|
72
|
+
These commands are obsolete and should no longer be used
|
73
|
+
|
74
|
+
* `bundle lock(1)`
|
75
|
+
* `bundle unlock(1)`
|
76
|
+
* `bundle cache(1)`
|
77
|
+
|
data/man/gemfile.5.ronn
ADDED
@@ -0,0 +1,254 @@
|
|
1
|
+
Gemfile(5) -- A format for describing gem dependencies for Ruby programs
|
2
|
+
========================================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
A `Gemfile` describes the gem dependencies required to execute associated
|
7
|
+
Ruby code.
|
8
|
+
|
9
|
+
Place the `Gemfile` in the root of the directory containing the associated
|
10
|
+
code. For instance, in a Rails application, place the `Gemfile` in the same
|
11
|
+
directory as the `Rakefile`.
|
12
|
+
|
13
|
+
## SYNTAX
|
14
|
+
|
15
|
+
A `Gemfile` is evaluated as Ruby code, in a context which makes available
|
16
|
+
a number of methods used to describe the gem requirements.
|
17
|
+
|
18
|
+
## SOURCES (#source)
|
19
|
+
|
20
|
+
At the top of the `Gemfile`, add one line for each `Rubygems` source that
|
21
|
+
might contain the gems listed in the `Gemfile`.
|
22
|
+
|
23
|
+
source "http://rubygems.org"
|
24
|
+
source "http://gems.github.com"
|
25
|
+
|
26
|
+
Each of these _source_s `MUST` be a valid Rubygems repository.
|
27
|
+
|
28
|
+
## GEMS (#gem)
|
29
|
+
|
30
|
+
Specify gem requirements using the `gem` method, with the following arguments.
|
31
|
+
All parameters are `OPTIONAL` unless otherwise specified.
|
32
|
+
|
33
|
+
### NAME (required)
|
34
|
+
|
35
|
+
For each gem requirement, list a single _gem_ line.
|
36
|
+
|
37
|
+
gem "nokogiri"
|
38
|
+
|
39
|
+
### VERSION
|
40
|
+
|
41
|
+
Each _gem_ `MAY` have one or more version specifiers.
|
42
|
+
|
43
|
+
gem "nokogiri", ">= 1.4.2"
|
44
|
+
gem "RedCloth", ">= 4.1.0", "< 4.2.0"
|
45
|
+
|
46
|
+
### REQUIRE AS (:require)
|
47
|
+
|
48
|
+
Each _gem_ `MAY` specify its main file, which should be used when autorequiring
|
49
|
+
(`Bundler.require`).
|
50
|
+
|
51
|
+
gem "sqlite3-ruby", :require => "sqlite3"
|
52
|
+
|
53
|
+
This defaults to the name of the gem itself. For instance, these are identical:
|
54
|
+
|
55
|
+
gem "nokogiri"
|
56
|
+
gem "nokogiri", :require => "nokogiri"
|
57
|
+
|
58
|
+
### GROUPS (:group or :groups)
|
59
|
+
|
60
|
+
Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
|
61
|
+
not specify membership in any group is placed in the `default` group.
|
62
|
+
|
63
|
+
gem "rspec", :group => :test
|
64
|
+
gem "wirble", :groups => [:development, :test]
|
65
|
+
|
66
|
+
The Bundler runtime allows its two main methods, `Bundler.setup` and
|
67
|
+
`Bundler.require`, to limit their impact to particular groups.
|
68
|
+
|
69
|
+
# setup adds gems to Ruby's load path
|
70
|
+
Bundler.setup # defaults to all groups
|
71
|
+
require "bundler/setup" # same as Bundler.setup
|
72
|
+
Bundler.setup(:default) # only set up the _default_ group
|
73
|
+
Bundler.setup(:test) # only set up the _test_ group (but `not` _default_)
|
74
|
+
Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
|
75
|
+
|
76
|
+
# require requires all of the gems in the specified groups
|
77
|
+
Bundler.require # defaults to just the _default_ group
|
78
|
+
Bundler.require(:default) # identical
|
79
|
+
Bundler.require(:default, :test) # requires the _default_ and _test_ groups
|
80
|
+
Bundler.require(:test) # requires just the _test_ group
|
81
|
+
|
82
|
+
The Bundler CLI allows you to specify a list of groups whose gems `bundle install` should
|
83
|
+
not install with the `--without` option. To specify multiple groups to ignore, specify a
|
84
|
+
list of groups separated by spaces.
|
85
|
+
|
86
|
+
bundle install --without test
|
87
|
+
bundle install --without development test
|
88
|
+
|
89
|
+
After running `bundle install --without test`, bundler will remember that you excluded
|
90
|
+
the test group in the last installation. The next time you run `bundle install`,
|
91
|
+
without any `--without option`, bundler will recall it.
|
92
|
+
|
93
|
+
Also, calling `Bundler.setup` with no parameters, or calling `require "bundler/setup"`
|
94
|
+
will setup all groups except for the ones you excluded via `--without` (since they
|
95
|
+
are obviously not available).
|
96
|
+
|
97
|
+
Note that on `bundle install`, bundler downloads and evaluates all gems, in order to
|
98
|
+
create a single canonical list of all of the required gems and their dependencies.
|
99
|
+
This means that you cannot list different versions of the same gems in different
|
100
|
+
groups. For more details, see [Understanding Bundler](http://gembundler.com/rationale.html).
|
101
|
+
|
102
|
+
### PLATFORMS (:platforms)
|
103
|
+
|
104
|
+
If a gem should only be used in a particular platform or set of platforms, you can
|
105
|
+
specify them. Platforms are essentially identical to groups, except that you do not
|
106
|
+
need to use the `--without` install-time flag to exclude groups of gems for other
|
107
|
+
platforms.
|
108
|
+
|
109
|
+
There are a number of `Gemfile` platforms:
|
110
|
+
|
111
|
+
* `ruby`:
|
112
|
+
C Ruby (MRI) or Rubinius, but `NOT` Windows
|
113
|
+
* `ruby_18`:
|
114
|
+
_ruby_ `AND` version 1.8
|
115
|
+
* `ruby_19`:
|
116
|
+
_ruby_ `AND` version 1.9
|
117
|
+
* `mri`:
|
118
|
+
Same as _ruby_, but not Rubinius
|
119
|
+
* `mri_18`:
|
120
|
+
_mri_ `AND` version 1.8
|
121
|
+
* `mri_19`:
|
122
|
+
_mri_ `AND` version 1.9
|
123
|
+
* `jruby`:
|
124
|
+
JRuby
|
125
|
+
* `mswin`:
|
126
|
+
Windows
|
127
|
+
|
128
|
+
As with groups, you can specify one or more platforms:
|
129
|
+
|
130
|
+
gem "weakling", :platforms => :jruby
|
131
|
+
gem "ruby-debug", :platforms => :mri_18
|
132
|
+
gem "nokogiri", :platforms => [:mri_18, :jruby]
|
133
|
+
|
134
|
+
All operations involving groups (`bundle install`, `Bundler.setup`,
|
135
|
+
`Bundler.require`) behave exactly the same as if any groups not
|
136
|
+
matching the current platform were explicitly excluded.
|
137
|
+
|
138
|
+
### GIT (:git)
|
139
|
+
|
140
|
+
If necessary, you can specify that a gem is located at a particular
|
141
|
+
git repository. The repository can be public (`http://github.com/rails/rails.git`)
|
142
|
+
or private (`git@github.com:rails/rails.git`). If the repository is private,
|
143
|
+
the user that you use to run `bundle install` `MUST` have the appropriate
|
144
|
+
keys available in their `$HOME/.ssh`.
|
145
|
+
|
146
|
+
Git repositories are specified using the `:git` parameter. The `group`,
|
147
|
+
`platforms`, and `require` options are available and behave exactly the same
|
148
|
+
as they would for a normal gem.
|
149
|
+
|
150
|
+
gem "rails", :git => "git://github.com/rails/rails.git"
|
151
|
+
|
152
|
+
A git repository `SHOULD` have at least one file, at the root of the
|
153
|
+
directory containing the gem, with the extension `.gemspec`. This file
|
154
|
+
`MUST` contain a valid gem specification, as expected by the `gem build`
|
155
|
+
command. It `MUST NOT` have any dependencies, other than on the files in
|
156
|
+
the git repository itself and any built-in functionality of Ruby or Rubygems.
|
157
|
+
|
158
|
+
If a git repository does not have a `.gemspec`, bundler will attempt to
|
159
|
+
create one, but it will not contain any dependencies, executables, or
|
160
|
+
C extension compilation instructions. As a result, it may fail to properly
|
161
|
+
integrate into your application.
|
162
|
+
|
163
|
+
If a git repository does have a `.gemspec` for the gem you attached it
|
164
|
+
to, a version specifier, if provided, means that the git repository is
|
165
|
+
only valid if the `.gemspec` specifies a version matching the version
|
166
|
+
specifier. If not, bundler will print a warning.
|
167
|
+
|
168
|
+
gem "rails", "2.3.8", :git => "git://github.com/rails/rails.git"
|
169
|
+
# bundle install will fail, because the .gemspec in the rails
|
170
|
+
# repository's master branch specifies version 3.0.0
|
171
|
+
|
172
|
+
If a git repository does `not` have a `.gemspec` for the gem you attached
|
173
|
+
it to, a version specifier `MUST` be provided. Bundler will use this
|
174
|
+
version in the simple `.gemspec` it creates.
|
175
|
+
|
176
|
+
Git repositories support a number of additional options.
|
177
|
+
|
178
|
+
* `branch`, `tag`, and `ref`:
|
179
|
+
You `MUST` only specify at most one of these options. The default
|
180
|
+
is `:branch => "master"`
|
181
|
+
* `submodules`:
|
182
|
+
Specify `:submodules => true` to cause bundler to expand any
|
183
|
+
submodules included in the git repository
|
184
|
+
|
185
|
+
If a git repository contains multiple `.gemspecs`, each `.gemspec`
|
186
|
+
represents a gem located at the same place in the file system as
|
187
|
+
the `.gemspec`.
|
188
|
+
|
189
|
+
|~rails [git root]
|
190
|
+
| |-rails.gemspec [rails gem located here]
|
191
|
+
|~actionpack
|
192
|
+
| |-actionpack.gemspec [actionpack gem located here]
|
193
|
+
|~activesupport
|
194
|
+
| |-activesupport.gemspec [activesupport gem located here]
|
195
|
+
...
|
196
|
+
|
197
|
+
To install a gem located in a git repository, bundler changes to
|
198
|
+
the directory containing the gemspec, runs `gem build name.gemspec`
|
199
|
+
and then installs the resulting gem. The `gem build` command,
|
200
|
+
which comes standard with Rubygems, evaluates the `.gemspec` in
|
201
|
+
the context of the directory in which it is located.
|
202
|
+
|
203
|
+
### PATH (:path)
|
204
|
+
|
205
|
+
You can specify that a gem is located in a particular location
|
206
|
+
on the file system. Relative paths are resolved relative to the
|
207
|
+
directory containing the `Gemfile`.
|
208
|
+
|
209
|
+
Similar to the semantics of the `:git` option, the `:path`
|
210
|
+
option requires that the directory in question either contains
|
211
|
+
a `.gemspec` for the gem, or that you specify an explicit
|
212
|
+
version that bundler should use.
|
213
|
+
|
214
|
+
Unlike `:git`, bundler does not compile C extensions for
|
215
|
+
gems specified as paths.
|
216
|
+
|
217
|
+
gem "rails", :path => "vendor/rails"
|
218
|
+
|
219
|
+
## BLOCK FORM OF GIT, PATH, GROUP and PLATFORMS
|
220
|
+
|
221
|
+
The `:git`, `:path`, `:group`, and `:platforms` options may be
|
222
|
+
applied to a group of gems by using block form.
|
223
|
+
|
224
|
+
git "git://github.com/rails/rails.git" do
|
225
|
+
gem "activesupport"
|
226
|
+
gem "actionpack"
|
227
|
+
end
|
228
|
+
|
229
|
+
platforms :ruby do
|
230
|
+
gem "ruby-debug"
|
231
|
+
gem "sqlite3-ruby"
|
232
|
+
end
|
233
|
+
|
234
|
+
group :development do
|
235
|
+
gem "wirble"
|
236
|
+
gem "faker"
|
237
|
+
end
|
238
|
+
|
239
|
+
In the case of the `git` block form, the `:ref`, `:branch`, `:tag`,
|
240
|
+
and `:submodules` options may be passed to the `git` method, and
|
241
|
+
all gems in the block will inherit those options.
|
242
|
+
|
243
|
+
## SOURCE PRIORITY
|
244
|
+
|
245
|
+
When attempting to locate a gem to satisfy a gem requirement,
|
246
|
+
bundler uses the following priority order:
|
247
|
+
|
248
|
+
1. The source explicitly attached to the gem (using `:path` or `:git`)
|
249
|
+
2. For implicit gems (dependencies of explicit gems), any git or path
|
250
|
+
repository otherwise declared. This results in bundler prioritizing the
|
251
|
+
ActiveSupport gem from the Rails git repository over ones from
|
252
|
+
`rubygems.org`
|
253
|
+
3. The sources specified via `source`, in the order in which they were
|
254
|
+
declared in the `Gemfile`.
|