rkh-bundler 1.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +42 -0
  3. data/CHANGELOG.md +1105 -0
  4. data/ISSUES.md +67 -0
  5. data/LICENSE +23 -0
  6. data/README.md +31 -0
  7. data/Rakefile +208 -0
  8. data/UPGRADING.md +103 -0
  9. data/bin/bundle +31 -0
  10. data/bundler.gemspec +31 -0
  11. data/lib/bundler.rb +353 -0
  12. data/lib/bundler/capistrano.rb +11 -0
  13. data/lib/bundler/cli.rb +693 -0
  14. data/lib/bundler/definition.rb +568 -0
  15. data/lib/bundler/dep_proxy.rb +43 -0
  16. data/lib/bundler/dependency.rb +134 -0
  17. data/lib/bundler/deployment.rb +58 -0
  18. data/lib/bundler/dsl.rb +256 -0
  19. data/lib/bundler/endpoint_specification.rb +78 -0
  20. data/lib/bundler/environment.rb +47 -0
  21. data/lib/bundler/fetcher.rb +225 -0
  22. data/lib/bundler/gem_helper.rb +162 -0
  23. data/lib/bundler/gem_helpers.rb +23 -0
  24. data/lib/bundler/gem_installer.rb +9 -0
  25. data/lib/bundler/gem_tasks.rb +2 -0
  26. data/lib/bundler/graph.rb +148 -0
  27. data/lib/bundler/index.rb +187 -0
  28. data/lib/bundler/installer.rb +190 -0
  29. data/lib/bundler/lazy_specification.rb +79 -0
  30. data/lib/bundler/lockfile_parser.rb +127 -0
  31. data/lib/bundler/match_platform.rb +13 -0
  32. data/lib/bundler/psyched_yaml.rb +15 -0
  33. data/lib/bundler/remote_specification.rb +57 -0
  34. data/lib/bundler/resolver.rb +486 -0
  35. data/lib/bundler/ruby_version.rb +94 -0
  36. data/lib/bundler/rubygems_ext.rb +153 -0
  37. data/lib/bundler/rubygems_integration.rb +394 -0
  38. data/lib/bundler/runtime.rb +233 -0
  39. data/lib/bundler/settings.rb +128 -0
  40. data/lib/bundler/setup.rb +23 -0
  41. data/lib/bundler/shared_helpers.rb +71 -0
  42. data/lib/bundler/source.rb +869 -0
  43. data/lib/bundler/spec_set.rb +137 -0
  44. data/lib/bundler/templates/Executable +16 -0
  45. data/lib/bundler/templates/Executable.standalone +12 -0
  46. data/lib/bundler/templates/Gemfile +4 -0
  47. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  48. data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
  49. data/lib/bundler/templates/newgem/README.md.tt +29 -0
  50. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  51. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  52. data/lib/bundler/templates/newgem/gitignore.tt +17 -0
  53. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
  54. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  55. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
  56. data/lib/bundler/ui.rb +88 -0
  57. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  58. data/lib/bundler/vendor/net/http/persistent.rb +468 -0
  59. data/lib/bundler/vendor/thor.rb +358 -0
  60. data/lib/bundler/vendor/thor/actions.rb +314 -0
  61. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  62. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  63. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  64. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  65. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
  66. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
  67. data/lib/bundler/vendor/thor/base.rb +576 -0
  68. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  69. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  70. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  71. data/lib/bundler/vendor/thor/error.rb +30 -0
  72. data/lib/bundler/vendor/thor/group.rb +273 -0
  73. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  74. data/lib/bundler/vendor/thor/parser.rb +4 -0
  75. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  76. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  77. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  78. data/lib/bundler/vendor/thor/parser/options.rb +172 -0
  79. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  80. data/lib/bundler/vendor/thor/runner.rb +309 -0
  81. data/lib/bundler/vendor/thor/shell.rb +88 -0
  82. data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
  83. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  84. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  85. data/lib/bundler/vendor/thor/task.rb +113 -0
  86. data/lib/bundler/vendor/thor/util.rb +229 -0
  87. data/lib/bundler/vendor/thor/version.rb +3 -0
  88. data/lib/bundler/vendored_thor.rb +7 -0
  89. data/lib/bundler/version.rb +6 -0
  90. data/lib/bundler/vlad.rb +11 -0
  91. data/man/bundle-config.ronn +130 -0
  92. data/man/bundle-exec.ronn +111 -0
  93. data/man/bundle-install.ronn +335 -0
  94. data/man/bundle-package.ronn +59 -0
  95. data/man/bundle-update.ronn +176 -0
  96. data/man/bundle.ronn +83 -0
  97. data/man/gemfile.5.ronn +324 -0
  98. data/man/index.txt +6 -0
  99. data/spec/bundler/dsl_spec.rb +48 -0
  100. data/spec/bundler/gem_helper_spec.rb +174 -0
  101. data/spec/bundler/source_spec.rb +25 -0
  102. data/spec/cache/gems_spec.rb +239 -0
  103. data/spec/cache/git_spec.rb +124 -0
  104. data/spec/cache/path_spec.rb +103 -0
  105. data/spec/cache/platform_spec.rb +57 -0
  106. data/spec/install/deploy_spec.rb +211 -0
  107. data/spec/install/gems/c_ext_spec.rb +48 -0
  108. data/spec/install/gems/dependency_api_spec.rb +402 -0
  109. data/spec/install/gems/env_spec.rb +107 -0
  110. data/spec/install/gems/flex_spec.rb +313 -0
  111. data/spec/install/gems/groups_spec.rb +268 -0
  112. data/spec/install/gems/packed_spec.rb +84 -0
  113. data/spec/install/gems/platform_spec.rb +208 -0
  114. data/spec/install/gems/post_install_spec.rb +47 -0
  115. data/spec/install/gems/resolving_spec.rb +72 -0
  116. data/spec/install/gems/simple_case_spec.rb +814 -0
  117. data/spec/install/gems/standalone_spec.rb +260 -0
  118. data/spec/install/gems/sudo_spec.rb +74 -0
  119. data/spec/install/gems/win32_spec.rb +26 -0
  120. data/spec/install/gemspec_spec.rb +170 -0
  121. data/spec/install/git_spec.rb +796 -0
  122. data/spec/install/invalid_spec.rb +35 -0
  123. data/spec/install/path_spec.rb +405 -0
  124. data/spec/install/upgrade_spec.rb +26 -0
  125. data/spec/lock/git_spec.rb +35 -0
  126. data/spec/lock/lockfile_spec.rb +809 -0
  127. data/spec/other/check_spec.rb +265 -0
  128. data/spec/other/clean_spec.rb +492 -0
  129. data/spec/other/config_spec.rb +138 -0
  130. data/spec/other/console_spec.rb +54 -0
  131. data/spec/other/exec_spec.rb +229 -0
  132. data/spec/other/ext_spec.rb +37 -0
  133. data/spec/other/help_spec.rb +39 -0
  134. data/spec/other/init_spec.rb +40 -0
  135. data/spec/other/newgem_spec.rb +87 -0
  136. data/spec/other/open_spec.rb +35 -0
  137. data/spec/other/outdated_spec.rb +93 -0
  138. data/spec/other/platform_spec.rb +881 -0
  139. data/spec/other/show_spec.rb +88 -0
  140. data/spec/quality_spec.rb +62 -0
  141. data/spec/realworld/edgecases_spec.rb +177 -0
  142. data/spec/resolver/basic_spec.rb +20 -0
  143. data/spec/resolver/platform_spec.rb +82 -0
  144. data/spec/runtime/executable_spec.rb +120 -0
  145. data/spec/runtime/load_spec.rb +107 -0
  146. data/spec/runtime/platform_spec.rb +90 -0
  147. data/spec/runtime/require_spec.rb +261 -0
  148. data/spec/runtime/setup_spec.rb +755 -0
  149. data/spec/runtime/with_clean_env_spec.rb +80 -0
  150. data/spec/spec_helper.rb +98 -0
  151. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  152. data/spec/support/artifice/endpoint.rb +54 -0
  153. data/spec/support/artifice/endpoint_500.rb +37 -0
  154. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  155. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  156. data/spec/support/artifice/endpoint_extra.rb +27 -0
  157. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  158. data/spec/support/artifice/endpoint_fallback.rb +18 -0
  159. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  160. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  161. data/spec/support/builders.rb +604 -0
  162. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  163. data/spec/support/fakeweb/windows.rb +23 -0
  164. data/spec/support/helpers.rb +317 -0
  165. data/spec/support/indexes.rb +112 -0
  166. data/spec/support/matchers.rb +77 -0
  167. data/spec/support/path.rb +73 -0
  168. data/spec/support/platforms.rb +86 -0
  169. data/spec/support/ruby_ext.rb +20 -0
  170. data/spec/support/rubygems_ext.rb +37 -0
  171. data/spec/support/rubygems_hax/platform.rb +22 -0
  172. data/spec/support/sudo.rb +21 -0
  173. data/spec/update/gems_spec.rb +134 -0
  174. data/spec/update/git_spec.rb +196 -0
  175. data/spec/update/source_spec.rb +51 -0
  176. metadata +338 -0
@@ -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
+ Since Bundler 1.2, the `bundle package` command can also package `:git` and
17
+ `:path` dependencies besides .gem files. This needs to be explicitly enabled
18
+ via the `--all` option. Once used, the `--all` option will be remembered.
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
@@ -0,0 +1,83 @@
1
+ bundle(1) -- Ruby Dependency Management
2
+ =======================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `bundle` COMMAND [--no-color] [--verbose] [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
+ * `--verbose`:
22
+ Prints out additional logging information
23
+
24
+ ## BUNDLE COMMANDS
25
+
26
+ We divide `bundle` subcommands into primary commands and utilities.
27
+
28
+ ## PRIMARY COMMANDS
29
+
30
+ * [bundle install(1)][bundle-install]:
31
+ Install the gems specified by the `Gemfile` or `Gemfile.lock`
32
+
33
+ * [bundle update(1)][bundle-update]:
34
+ Update dependencies to their latest versions
35
+
36
+ * [bundle package(1)][bundle-package]:
37
+ Package the .gem files required by your application into the
38
+ `vendor/cache` directory
39
+
40
+ * [bundle exec(1)][bundle-exec]:
41
+ Execute a script in the context of the current bundle
42
+
43
+ * [bundle config(1)][bundle-config]:
44
+ Specify and read configuration options for bundler
45
+
46
+ ## UTILITIES
47
+
48
+ * `bundle check(1)`:
49
+ Determine whether the requirements for your application are installed
50
+ and available to bundler
51
+
52
+ * `bundle list(1)`:
53
+ Show all of the gems in the current bundle
54
+
55
+ * `bundle show(1)`:
56
+ Show the source location of a particular gem in the bundle
57
+
58
+ * `bundle outdated(1)`:
59
+ Show all of the outdated gems in the current bundle
60
+
61
+ * `bundle console(1)`:
62
+ Start an IRB session in the context of the current bundle
63
+
64
+ * `bundle open(1)`:
65
+ Open an installed gem in the editor
66
+
67
+ * `bundle viz(1)`:
68
+ Generate a visual representation of your dependencies
69
+
70
+ * `bundle init(1)`:
71
+ Generate a simple `Gemfile`, placed in the current directory
72
+
73
+ * `bundle gem(1)`:
74
+ Create a simple gem, suitable for development with bundler
75
+
76
+ ## OBSOLETE
77
+
78
+ These commands are obsolete and should no longer be used
79
+
80
+ * `bundle lock(1)`
81
+ * `bundle unlock(1)`
82
+ * `bundle cache(1)`
83
+
@@ -0,0 +1,324 @@
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
+ ## RUBY (#ruby)
29
+
30
+ If your application requires a specific Ruby version or engine, specify your
31
+ requirements using the `ruby` method, with the following arguments.
32
+ All parameters are `OPTIONAL` unless otherwise specified.
33
+
34
+ ### VERSION (required)
35
+
36
+ The version of Ruby that your application requires. If your application
37
+ requires an alternate Ruby engine, such as JRuby or Rubinius, this should be
38
+ the Ruby version that the engine is compatible with.
39
+
40
+ ruby "1.9.3"
41
+
42
+ ### ENGINE (:engine)
43
+
44
+ Each application _may_ specify a Ruby engine. If an engine is specified, an
45
+ engine version _must_ also be specified.
46
+
47
+ ### ENGINE VERSION (:engine_version)
48
+
49
+ Each application _may_ specify a Ruby engine version. If an engine version is
50
+ specified, an engine _must_ also be specified. If the engine is "ruby" the
51
+ engine version specified _must_ match the Ruby version.
52
+
53
+ ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
54
+
55
+ ## GEMS (#gem)
56
+
57
+ Specify gem requirements using the `gem` method, with the following arguments.
58
+ All parameters are `OPTIONAL` unless otherwise specified.
59
+
60
+ ### NAME (required)
61
+
62
+ For each gem requirement, list a single _gem_ line.
63
+
64
+ gem "nokogiri"
65
+
66
+ ### VERSION
67
+
68
+ Each _gem_ `MAY` have one or more version specifiers.
69
+
70
+ gem "nokogiri", ">= 1.4.2"
71
+ gem "RedCloth", ">= 4.1.0", "< 4.2.0"
72
+
73
+ ### REQUIRE AS (:require)
74
+
75
+ Each _gem_ `MAY` specify files that should be used when autorequiring via
76
+ `Bundler.require`. You may pass an array with multiple files, or `false` to
77
+ prevent any file from being autorequired.
78
+
79
+ gem "redis", :require => ["redis/connection/hiredis", "redis"]
80
+ gem "webmock", :require => false
81
+
82
+ The argument defaults to the name of the gem. For example, these are identical:
83
+
84
+ gem "nokogiri"
85
+ gem "nokogiri", :require => "nokogiri"
86
+
87
+ ### GROUPS (:group or :groups)
88
+
89
+ Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
90
+ not specify membership in any group is placed in the `default` group.
91
+
92
+ gem "rspec", :group => :test
93
+ gem "wirble", :groups => [:development, :test]
94
+
95
+ The Bundler runtime allows its two main methods, `Bundler.setup` and
96
+ `Bundler.require`, to limit their impact to particular groups.
97
+
98
+ # setup adds gems to Ruby's load path
99
+ Bundler.setup # defaults to all groups
100
+ require "bundler/setup" # same as Bundler.setup
101
+ Bundler.setup(:default) # only set up the _default_ group
102
+ Bundler.setup(:test) # only set up the _test_ group (but `not` _default_)
103
+ Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
104
+
105
+ # require requires all of the gems in the specified groups
106
+ Bundler.require # defaults to just the _default_ group
107
+ Bundler.require(:default) # identical
108
+ Bundler.require(:default, :test) # requires the _default_ and _test_ groups
109
+ Bundler.require(:test) # requires just the _test_ group
110
+
111
+ The Bundler CLI allows you to specify a list of groups whose gems `bundle install` should
112
+ not install with the `--without` option. To specify multiple groups to ignore, specify a
113
+ list of groups separated by spaces.
114
+
115
+ bundle install --without test
116
+ bundle install --without development test
117
+
118
+ After running `bundle install --without test`, bundler will remember that you excluded
119
+ the test group in the last installation. The next time you run `bundle install`,
120
+ without any `--without option`, bundler will recall it.
121
+
122
+ Also, calling `Bundler.setup` with no parameters, or calling `require "bundler/setup"`
123
+ will setup all groups except for the ones you excluded via `--without` (since they
124
+ are obviously not available).
125
+
126
+ Note that on `bundle install`, bundler downloads and evaluates all gems, in order to
127
+ create a single canonical list of all of the required gems and their dependencies.
128
+ This means that you cannot list different versions of the same gems in different
129
+ groups. For more details, see [Understanding Bundler](http://gembundler.com/rationale.html).
130
+
131
+ ### PLATFORMS (:platforms)
132
+
133
+ If a gem should only be used in a particular platform or set of platforms, you can
134
+ specify them. Platforms are essentially identical to groups, except that you do not
135
+ need to use the `--without` install-time flag to exclude groups of gems for other
136
+ platforms.
137
+
138
+ There are a number of `Gemfile` platforms:
139
+
140
+ * `ruby`:
141
+ C Ruby (MRI) or Rubinius, but `NOT` Windows
142
+ * `ruby_18`:
143
+ _ruby_ `AND` version 1.8
144
+ * `ruby_19`:
145
+ _ruby_ `AND` version 1.9
146
+ * `mri`:
147
+ Same as _ruby_, but not Rubinius
148
+ * `mri_18`:
149
+ _mri_ `AND` version 1.8
150
+ * `mri_19`:
151
+ _mri_ `AND` version 1.9
152
+ * `rbx`:
153
+ Same as _ruby_, but only Rubinius (not MRI)
154
+ * `jruby`:
155
+ JRuby
156
+ * `mswin`:
157
+ Windows
158
+ * `mingw`:
159
+ Windows 'mingw32' platform (aka RubyInstaller)
160
+ * `mingw_18`:
161
+ _mingw_ `AND` version 1.8
162
+ * `mingw_19`:
163
+ _mingw_ `AND` version 1.9
164
+
165
+ As with groups, you can specify one or more platforms:
166
+
167
+ gem "weakling", :platforms => :jruby
168
+ gem "ruby-debug", :platforms => :mri_18
169
+ gem "nokogiri", :platforms => [:mri_18, :jruby]
170
+
171
+ All operations involving groups (`bundle install`, `Bundler.setup`,
172
+ `Bundler.require`) behave exactly the same as if any groups not
173
+ matching the current platform were explicitly excluded.
174
+
175
+ ### GIT (:git)
176
+
177
+ If necessary, you can specify that a gem is located at a particular
178
+ git repository. The repository can be public (`http://github.com/rails/rails.git`)
179
+ or private (`git@github.com:rails/rails.git`). If the repository is private,
180
+ the user that you use to run `bundle install` `MUST` have the appropriate
181
+ keys available in their `$HOME/.ssh`.
182
+
183
+ Git repositories are specified using the `:git` parameter. The `group`,
184
+ `platforms`, and `require` options are available and behave exactly the same
185
+ as they would for a normal gem.
186
+
187
+ gem "rails", :git => "git://github.com/rails/rails.git"
188
+
189
+ A git repository `SHOULD` have at least one file, at the root of the
190
+ directory containing the gem, with the extension `.gemspec`. This file
191
+ `MUST` contain a valid gem specification, as expected by the `gem build`
192
+ command. It `MUST NOT` have any dependencies, other than on the files in
193
+ the git repository itself and any built-in functionality of Ruby or Rubygems.
194
+
195
+ If a git repository does not have a `.gemspec`, bundler will attempt to
196
+ create one, but it will not contain any dependencies, executables, or
197
+ C extension compilation instructions. As a result, it may fail to properly
198
+ integrate into your application.
199
+
200
+ If a git repository does have a `.gemspec` for the gem you attached it
201
+ to, a version specifier, if provided, means that the git repository is
202
+ only valid if the `.gemspec` specifies a version matching the version
203
+ specifier. If not, bundler will print a warning.
204
+
205
+ gem "rails", "2.3.8", :git => "git://github.com/rails/rails.git"
206
+ # bundle install will fail, because the .gemspec in the rails
207
+ # repository's master branch specifies version 3.0.0
208
+
209
+ If a git repository does `not` have a `.gemspec` for the gem you attached
210
+ it to, a version specifier `MUST` be provided. Bundler will use this
211
+ version in the simple `.gemspec` it creates.
212
+
213
+ Git repositories support a number of additional options.
214
+
215
+ * `branch`, `tag`, and `ref`:
216
+ You `MUST` only specify at most one of these options. The default
217
+ is `:branch => "master"`
218
+ * `submodules`:
219
+ Specify `:submodules => true` to cause bundler to expand any
220
+ submodules included in the git repository
221
+
222
+ If a git repository contains multiple `.gemspecs`, each `.gemspec`
223
+ represents a gem located at the same place in the file system as
224
+ the `.gemspec`.
225
+
226
+ |~rails [git root]
227
+ | |-rails.gemspec [rails gem located here]
228
+ |~actionpack
229
+ | |-actionpack.gemspec [actionpack gem located here]
230
+ |~activesupport
231
+ | |-activesupport.gemspec [activesupport gem located here]
232
+ |...
233
+
234
+ To install a gem located in a git repository, bundler changes to
235
+ the directory containing the gemspec, runs `gem build name.gemspec`
236
+ and then installs the resulting gem. The `gem build` command,
237
+ which comes standard with Rubygems, evaluates the `.gemspec` in
238
+ the context of the directory in which it is located.
239
+
240
+ ### GITHUB (:github)
241
+
242
+ If the git repository you want to use is hosted on GitHub and is public, you can use the
243
+ :github shorthand to specify just the github username and repository name (without the
244
+ trailing ".git"), separated by a slash. If both the username and repository name are the
245
+ same, you can omit one.
246
+
247
+ gem "rails", :github => "rails/rails"
248
+ gem "rails", :github => "rails"
249
+
250
+ Are both equivalent to
251
+
252
+ gem "rails", :git => "git://github.com/rails/rails.git"
253
+
254
+ ### PATH (:path)
255
+
256
+ You can specify that a gem is located in a particular location
257
+ on the file system. Relative paths are resolved relative to the
258
+ directory containing the `Gemfile`.
259
+
260
+ Similar to the semantics of the `:git` option, the `:path`
261
+ option requires that the directory in question either contains
262
+ a `.gemspec` for the gem, or that you specify an explicit
263
+ version that bundler should use.
264
+
265
+ Unlike `:git`, bundler does not compile C extensions for
266
+ gems specified as paths.
267
+
268
+ gem "rails", :path => "vendor/rails"
269
+
270
+ ## BLOCK FORM OF GIT, PATH, GROUP and PLATFORMS
271
+
272
+ The `:git`, `:path`, `:group`, and `:platforms` options may be
273
+ applied to a group of gems by using block form.
274
+
275
+ git "git://github.com/rails/rails.git" do
276
+ gem "activesupport"
277
+ gem "actionpack"
278
+ end
279
+
280
+ platforms :ruby do
281
+ gem "ruby-debug"
282
+ gem "sqlite3"
283
+ end
284
+
285
+ group :development do
286
+ gem "wirble"
287
+ gem "faker"
288
+ end
289
+
290
+ In the case of the `git` block form, the `:ref`, `:branch`, `:tag`,
291
+ and `:submodules` options may be passed to the `git` method, and
292
+ all gems in the block will inherit those options.
293
+
294
+ ## GEMSPEC (#gemspec)
295
+
296
+ If you wish to use Bundler to help install dependencies for a gem while it is
297
+ being developed, use the `gemspec` method to pull in the dependencies listed in
298
+ the `.gemspec` file.
299
+
300
+ The `gemspec` method adds any runtime dependencies as gem requirements in the
301
+ default group. It also adds development dependencies as gem requirements in the
302
+ `development` group. Finally, it adds a gem requirement on your project (`:path
303
+ => '.'`). In conjunction with `Bundler.setup`, this allows you to require project
304
+ files in your test code as you would if the project were installed as a gem; you
305
+ need not manipulate the load path manually or require project files via relative
306
+ paths.
307
+
308
+ The `gemspec` method supports optional `:path`, `:name`, and `:development_group`
309
+ options, which control where bundler looks for the `.gemspec`, what named
310
+ `.gemspec` it uses (if more than one is present), and which group development
311
+ dependencies are included in.
312
+
313
+ ## SOURCE PRIORITY
314
+
315
+ When attempting to locate a gem to satisfy a gem requirement,
316
+ bundler uses the following priority order:
317
+
318
+ 1. The source explicitly attached to the gem (using `:path` or `:git`)
319
+ 2. For implicit gems (dependencies of explicit gems), any git or path
320
+ repository otherwise declared. This results in bundler prioritizing the
321
+ ActiveSupport gem from the Rails git repository over ones from
322
+ `rubygems.org`
323
+ 3. The sources specified via `source`, searching each source in your `Gemfile`
324
+ from last added to first added.