bundler 0.9.1.pre1 → 0.9.1
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/README.markdown +99 -2
- data/lib/bundler.rb +8 -6
- data/lib/bundler/dsl.rb +29 -0
- metadata +1 -1
data/README.markdown
CHANGED
@@ -22,7 +22,7 @@ repository and install the gem with the following rake task:
|
|
22
22
|
You can also install the gem with
|
23
23
|
|
24
24
|
gem install bundler --prerelease
|
25
|
-
|
25
|
+
|
26
26
|
## Usage
|
27
27
|
|
28
28
|
The first thing to do is create a gem manifest file named `Gemfile` at the
|
@@ -56,6 +56,40 @@ Bundler::Dsl.
|
|
56
56
|
#
|
57
57
|
gem "rack", "1.0.0"
|
58
58
|
|
59
|
+
### Groups
|
60
|
+
|
61
|
+
Applications may have dependencies that are specific to certain environments,
|
62
|
+
such as testing or deployment.
|
63
|
+
|
64
|
+
You can specify groups of gems in the Gemfile using the following syntax:
|
65
|
+
|
66
|
+
gem "nokogiri", :group => :test
|
67
|
+
|
68
|
+
# or
|
69
|
+
|
70
|
+
group :test do
|
71
|
+
gem "webrat"
|
72
|
+
end
|
73
|
+
|
74
|
+
Note that Bundler adds all the gems without an explicit group name to the
|
75
|
+
`:default` group.
|
76
|
+
|
77
|
+
Groups are involved in a number of scenarios:
|
78
|
+
|
79
|
+
1. When installing gems using bundle install, you can choose to leave
|
80
|
+
out any group by specifying `--without {group name}`. This can be
|
81
|
+
helpful if, for instance, you have a gem that you can only compile
|
82
|
+
in certain environments.
|
83
|
+
2. When setting up load paths using Bundler.setup, Bundler will, by
|
84
|
+
default, add the load paths for all groups. You can restrict the
|
85
|
+
groups to add by doing `Bundler.setup(:group, :names)`. If you do
|
86
|
+
this, you need to specify the `:default` group if you want it
|
87
|
+
included.
|
88
|
+
3. When auto-requiring files using Bundler.require, Bundler will,
|
89
|
+
by default, auto-require just the `:default` group. You can specify
|
90
|
+
a list of groups to auto-require such as
|
91
|
+
`Bundler.require(:default, :test)`
|
92
|
+
|
59
93
|
### Installing gems
|
60
94
|
|
61
95
|
Once the manifest file has been created, the next step is to install all
|
@@ -71,7 +105,7 @@ again to get the new gems installed.
|
|
71
105
|
|
72
106
|
By default, bundler will only ensure that the activated gems satisfy the
|
73
107
|
Gemfile's dependencies. If you install a newer version of a gem and it
|
74
|
-
satisfies the dependencies, it will be used instead of the older one.
|
108
|
+
satisfies the dependencies, it will be used instead of the older one.
|
75
109
|
|
76
110
|
The command `bundle lock` will lock the bundle to the current set of
|
77
111
|
resolved gems. This ensures that, until the lock file is removed, that
|
@@ -144,6 +178,69 @@ a more narrow dependency.
|
|
144
178
|
Bundler solves this problem by evaluating all dependencies at once,
|
145
179
|
so it can detect that all gems *together* require activesupport "2.3.4".
|
146
180
|
|
181
|
+
## Upgrading from Bundler 0.8 to 0.9 and above
|
182
|
+
|
183
|
+
Bundler 0.9 changes a number of APIs in the Gemfile.
|
184
|
+
|
185
|
+
### Gemfile Removals
|
186
|
+
|
187
|
+
The following Bundler 0.8 APIs are no longer supported:
|
188
|
+
|
189
|
+
1. `disable_system_gems`: This is now the default (and only) option
|
190
|
+
for bundler. Bundler uses the system gems you have specified
|
191
|
+
in the Gemfile, and only the system gems you have specified
|
192
|
+
(and their dependencies)
|
193
|
+
2. `disable_rubygems`: This is no longer supported. We are looking
|
194
|
+
into ways to get the fastest performance out of each supported
|
195
|
+
scenario, and we will make speed the default where possible.
|
196
|
+
3. `clear_sources`: Bundler now defaults to an empty source
|
197
|
+
list. If you want to include Rubygems, you can add the source
|
198
|
+
via source "http://gemcutter.org". If you use bundle init, this
|
199
|
+
source will be automatically added for you in the generated
|
200
|
+
Gemfile
|
201
|
+
4. `bundle_path`: You can specify this setting when installing
|
202
|
+
via `bundle install /path/to/bundle`. Bundler will remember
|
203
|
+
where you installed the dependencies to on a particular
|
204
|
+
machine for future installs, loads, setups, etc.
|
205
|
+
5. `bin_path`: Bundler no longer generates binaries in the root
|
206
|
+
of your app. You should use `bundle exec` to execute binaries
|
207
|
+
in the current context.
|
208
|
+
|
209
|
+
### Gemfile Changes
|
210
|
+
|
211
|
+
1. Bundler 0.8 supported :only and :except as APIs for describing
|
212
|
+
groups of gems. Bundler 0.9 supports a single `group` method,
|
213
|
+
which you can use to group gems together. See the above "Group"
|
214
|
+
section for more information.
|
215
|
+
|
216
|
+
This means that `gem "foo", :only => :production` becomes
|
217
|
+
`gem "foo", :group => :production`, and
|
218
|
+
`only :production { gem "foo" }` becomes
|
219
|
+
`group :production { gem "foo" }`
|
220
|
+
|
221
|
+
The short version is: group your gems together logically, and
|
222
|
+
use the available commands to make use of the groups you've
|
223
|
+
created.
|
224
|
+
|
225
|
+
2. `:require_as` becomes `:require`
|
226
|
+
|
227
|
+
3. `:vendored_at` is fully removed; you should use `:path`
|
228
|
+
|
229
|
+
### API Changes
|
230
|
+
|
231
|
+
1. `Bundler.require_env(:environment)` becomes
|
232
|
+
`Bundler.require(:multiple, :groups)`. You must
|
233
|
+
now specify the default group (the default group is the
|
234
|
+
group made up of the gems not assigned to any group)
|
235
|
+
explicitly. So `Bundler.require_env(:test)` becomes
|
236
|
+
`Bundler.require(:default, :test)`
|
237
|
+
|
238
|
+
2. `require 'vendor/gems/environment.rb`: In unlocked
|
239
|
+
mode, where using system gems, this becomes
|
240
|
+
`Bundler.setup(:multiple, groups)`. If you don't
|
241
|
+
specify any groups, this puts all groups on the load
|
242
|
+
path. In locked, mode, it becomes `require .bundle/environment`
|
243
|
+
|
147
244
|
## Reporting bugs
|
148
245
|
|
149
246
|
Please report all bugs on the github issue tracker for the project located
|
data/lib/bundler.rb
CHANGED
@@ -4,7 +4,7 @@ require 'yaml'
|
|
4
4
|
require 'bundler/rubygems'
|
5
5
|
|
6
6
|
module Bundler
|
7
|
-
VERSION = "0.9.1
|
7
|
+
VERSION = "0.9.1"
|
8
8
|
|
9
9
|
autoload :Definition, 'bundler/definition'
|
10
10
|
autoload :Dependency, 'bundler/dependency'
|
@@ -31,11 +31,13 @@ module Bundler
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
class GemfileNotFound
|
35
|
-
class GemNotFound
|
36
|
-
class VersionConflict
|
37
|
-
class GemfileError
|
38
|
-
class GitError
|
34
|
+
class GemfileNotFound < BundlerError; status_code(10) ; end
|
35
|
+
class GemNotFound < BundlerError; status_code(7) ; end
|
36
|
+
class VersionConflict < BundlerError; status_code(6) ; end
|
37
|
+
class GemfileError < BundlerError; status_code(4) ; end
|
38
|
+
class GitError < BundlerError; status_code(11) ; end
|
39
|
+
class DeprecatedMethod < BundlerError; status_code(12) ; end
|
40
|
+
class DeprecatedOption < BundlerError; status_code(12) ; end
|
39
41
|
|
40
42
|
class << self
|
41
43
|
attr_writer :ui, :bundle_path
|
data/lib/bundler/dsl.rb
CHANGED
@@ -18,6 +18,7 @@ module Bundler
|
|
18
18
|
options = Hash === args.last ? args.pop : {}
|
19
19
|
version = args.last || ">= 0"
|
20
20
|
|
21
|
+
_deprecated_options(options)
|
21
22
|
_normalize_options(name, version, options)
|
22
23
|
|
23
24
|
@dependencies << Dependency.new(name, version, options)
|
@@ -53,6 +54,22 @@ module Bundler
|
|
53
54
|
@group = old
|
54
55
|
end
|
55
56
|
|
57
|
+
# Deprecated methods
|
58
|
+
|
59
|
+
def self.deprecate(name)
|
60
|
+
define_method(name) do |*|
|
61
|
+
raise DeprecatedMethod, "#{name} is removed. See the README for more information"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
deprecate :only
|
66
|
+
deprecate :except
|
67
|
+
deprecate :disable_system_gems
|
68
|
+
deprecate :disable_rubygems
|
69
|
+
deprecate :clear_sources
|
70
|
+
deprecate :bundle_path
|
71
|
+
deprecate :bin_path
|
72
|
+
|
56
73
|
private
|
57
74
|
|
58
75
|
def _version?(version)
|
@@ -83,5 +100,17 @@ module Bundler
|
|
83
100
|
|
84
101
|
opts["group"] = group
|
85
102
|
end
|
103
|
+
|
104
|
+
def _deprecated_options(options)
|
105
|
+
if options.include?(:require_as)
|
106
|
+
raise DeprecatedOption, "Please replace :require_as with :require"
|
107
|
+
elsif options.include?(:vendored_at)
|
108
|
+
raise DeprecatedOption, "Please replace :vendored_at with :path"
|
109
|
+
elsif options.include?(:only)
|
110
|
+
raise DeprecatedOption, "Please replace :only with :group"
|
111
|
+
elsif options.include?(:except)
|
112
|
+
raise DeprecatedOption, "The :except option is no longer supported"
|
113
|
+
end
|
114
|
+
end
|
86
115
|
end
|
87
116
|
end
|