bundler 1.0.22 → 1.1.pre
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/CHANGELOG.md +15 -181
- data/ISSUES.md +11 -26
- data/LICENSE +0 -2
- data/Rakefile +67 -116
- data/UPGRADING.md +4 -4
- data/bin/bundle +10 -10
- data/bundler.gemspec +5 -5
- data/lib/bundler.rb +15 -25
- data/lib/bundler/capistrano.rb +2 -2
- data/lib/bundler/cli.rb +41 -72
- data/lib/bundler/definition.rb +11 -37
- data/lib/bundler/dependency.rb +9 -13
- data/lib/bundler/deployment.rb +3 -8
- data/lib/bundler/dsl.rb +10 -24
- data/lib/bundler/fetcher.rb +101 -0
- data/lib/bundler/gem_helper.rb +6 -11
- data/lib/bundler/index.rb +8 -15
- data/lib/bundler/installer.rb +55 -35
- data/lib/bundler/lazy_specification.rb +7 -10
- data/lib/bundler/remote_specification.rb +6 -8
- data/lib/bundler/resolver.rb +18 -12
- data/lib/bundler/rubygems_ext.rb +3 -20
- data/lib/bundler/runtime.rb +57 -8
- data/lib/bundler/settings.rb +6 -4
- data/lib/bundler/setup.rb +5 -12
- data/lib/bundler/shared_helpers.rb +100 -4
- data/lib/bundler/source.rb +61 -106
- data/lib/bundler/spec_set.rb +8 -9
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +0 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -6
- data/lib/bundler/ui.rb +1 -4
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +464 -0
- data/lib/bundler/vendor/thor.rb +4 -43
- data/lib/bundler/vendor/thor/actions.rb +11 -28
- data/lib/bundler/vendor/thor/actions/create_file.rb +2 -2
- data/lib/bundler/vendor/thor/actions/directory.rb +2 -2
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +0 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +15 -56
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +10 -15
- data/lib/bundler/vendor/thor/base.rb +4 -24
- data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +0 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +0 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +0 -0
- data/lib/bundler/vendor/thor/error.rb +0 -0
- data/lib/bundler/vendor/thor/invocation.rb +0 -0
- data/lib/bundler/vendor/thor/parser.rb +0 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +0 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +2 -2
- data/lib/bundler/vendor/thor/parser/option.rb +1 -1
- data/lib/bundler/vendor/thor/parser/options.rb +16 -17
- data/lib/bundler/vendor/thor/shell.rb +0 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +13 -40
- data/lib/bundler/vendor/thor/shell/color.rb +0 -0
- data/lib/bundler/vendor/thor/task.rb +4 -3
- data/lib/bundler/vendor/thor/util.rb +2 -2
- data/lib/bundler/vendor/thor/version.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +0 -2
- data/man/bundle-install.ronn +3 -6
- data/man/gemfile.5.ronn +2 -7
- data/spec/cache/gems_spec.rb +0 -11
- data/spec/cache/git_spec.rb +2 -5
- data/spec/install/deploy_spec.rb +8 -8
- data/spec/install/gems/dependency_api_spec.rb +85 -0
- data/spec/install/gems/flex_spec.rb +4 -4
- data/spec/install/gems/groups_spec.rb +3 -17
- data/spec/install/gems/platform_spec.rb +16 -0
- data/spec/install/gems/simple_case_spec.rb +24 -88
- data/spec/install/gems/standalone_spec.rb +162 -0
- data/spec/install/gems/sudo_spec.rb +2 -3
- data/spec/install/gemspec_spec.rb +0 -38
- data/spec/install/git_spec.rb +4 -3
- data/spec/install/invalid_spec.rb +0 -18
- data/spec/install/path_spec.rb +1 -53
- data/spec/lock/git_spec.rb +1 -1
- data/spec/lock/lockfile_spec.rb +16 -72
- data/spec/other/check_spec.rb +6 -6
- data/spec/other/clean_spec.rb +202 -0
- data/spec/other/exec_spec.rb +7 -14
- data/spec/other/ext_spec.rb +0 -21
- data/spec/{bundler → other}/gem_helper_spec.rb +1 -16
- data/spec/other/help_spec.rb +1 -2
- data/spec/other/init_spec.rb +3 -3
- data/spec/other/newgem_spec.rb +1 -23
- data/spec/pack/gems_spec.rb +22 -0
- data/spec/quality_spec.rb +2 -6
- data/spec/runtime/require_spec.rb +10 -10
- data/spec/runtime/setup_spec.rb +12 -54
- data/spec/spec_helper.rb +7 -14
- data/spec/support/artifice/endpoint.rb +50 -0
- data/spec/support/artifice/endpoint_fallback.rb +22 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +11 -0
- data/spec/support/builders.rb +2 -25
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +12 -5
- data/spec/support/matchers.rb +16 -4
- data/spec/support/path.rb +2 -0
- data/spec/support/rubygems_ext.rb +2 -6
- data/spec/update/gems_spec.rb +2 -3
- data/spec/update/git_spec.rb +2 -2
- metadata +41 -24
- data/.travis.yml +0 -31
- data/lib/bundler/gem_installer.rb +0 -9
- data/lib/bundler/gem_tasks.rb +0 -2
- data/lib/bundler/rubygems_integration.rb +0 -344
- data/lib/bundler/vendor/thor/actions/create_link.rb +0 -57
- data/lib/bundler/vendor/thor/group.rb +0 -273
- data/lib/bundler/vendor/thor/rake_compat.rb +0 -66
- data/lib/bundler/vendor/thor/runner.rb +0 -309
- data/lib/bundler/vendored_thor.rb +0 -7
data/UPGRADING.md
CHANGED
@@ -33,7 +33,7 @@ your deploy.rb file to run Bundler automatically as part of deploying:
|
|
33
33
|
require 'bundler/capistrano'
|
34
34
|
|
35
35
|
For more details on deploying using bundler, see the documentation
|
36
|
-
for the bundler cap task, and the [documentation on deploying](http://gembundler.com/deploying.html).
|
36
|
+
for the bundler cap task, and the [documentation on deploying](http://gembundler.com/v1.0/deploying.html).
|
37
37
|
|
38
38
|
|
39
39
|
## Bundler 0.8 to 0.9 and above
|
@@ -61,8 +61,8 @@ Bundler 0.9 removes the following Bundler 0.8 Gemfile APIs:
|
|
61
61
|
via `bundle install /path/to/bundle`. Bundler will remember
|
62
62
|
where you installed the dependencies to on a particular
|
63
63
|
machine for future installs, loads, setups, etc.
|
64
|
-
5. `bin_path`: Bundler no longer generates
|
65
|
-
of your app. You should use `bundle exec` to execute
|
64
|
+
5. `bin_path`: Bundler no longer generates binaries in the root
|
65
|
+
of your app. You should use `bundle exec` to execute binaries
|
66
66
|
in the current context.
|
67
67
|
|
68
68
|
### Gemfile Changes
|
@@ -100,4 +100,4 @@ Bundler 0.9 changes the following Bundler 0.8 Gemfile APIs:
|
|
100
100
|
mode, where using system gems, this becomes
|
101
101
|
`Bundler.setup(:multiple, :groups)`. If you don't
|
102
102
|
specify any groups, this puts all groups on the load
|
103
|
-
path. In locked mode, it becomes `require '.bundle/environment'`
|
103
|
+
path. In locked, mode, it becomes `require '.bundle/environment'`
|
data/bin/bundle
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
err << "This can be done by running `gem cleanup bundler`."
|
9
|
-
abort(err)
|
10
|
-
end
|
2
|
+
|
3
|
+
# Check if an older version of bundler is installed
|
4
|
+
require 'bundler'
|
5
|
+
$:.each do |path|
|
6
|
+
if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
|
7
|
+
abort "Please remove older versions of bundler. This can be done by running `gem cleanup bundler`."
|
11
8
|
end
|
12
|
-
|
9
|
+
end
|
10
|
+
require 'bundler/cli'
|
11
|
+
|
12
|
+
begin
|
13
13
|
Bundler::CLI.start
|
14
14
|
rescue Bundler::BundlerError => e
|
15
15
|
Bundler.ui.error e.message
|
data/bundler.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.name = "bundler"
|
9
9
|
s.version = Bundler::VERSION
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.authors = ["
|
12
|
-
s.email = ["
|
11
|
+
s.authors = ["Carl Lerche", "Yehuda Katz", "André Arko", "Terence Lee"]
|
12
|
+
s.email = ["carlhuda@engineyard.com"]
|
13
13
|
s.homepage = "http://gembundler.com"
|
14
14
|
s.summary = %q{The best way to manage your application's dependencies}
|
15
15
|
s.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
|
@@ -18,13 +18,13 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.rubyforge_project = "bundler"
|
19
19
|
|
20
20
|
s.add_development_dependency "ronn"
|
21
|
-
s.add_development_dependency "rspec"
|
21
|
+
s.add_development_dependency "rspec", "2.0.0.rc"
|
22
22
|
|
23
23
|
# Man files are required because they are ignored by git
|
24
24
|
man_files = Dir.glob("lib/bundler/man/**/*")
|
25
|
-
|
26
|
-
s.files = git_files + man_files
|
25
|
+
s.files = `git ls-files`.split("\n") + man_files
|
27
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
28
27
|
s.executables = %w(bundle)
|
28
|
+
s.default_executable = "bundle"
|
29
29
|
s.require_paths = ["lib"]
|
30
30
|
end
|
data/lib/bundler.rb
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'pathname'
|
4
|
-
|
5
|
-
begin
|
6
|
-
# Pull in Psych if we can, but not if Syck is already loaded
|
7
|
-
require 'psych' unless defined?(Syck)
|
8
|
-
rescue LoadError
|
9
|
-
end
|
10
|
-
|
11
4
|
require 'yaml'
|
12
5
|
require 'bundler/rubygems_ext'
|
13
|
-
require 'bundler/rubygems_integration'
|
14
6
|
require 'bundler/version'
|
15
7
|
|
16
8
|
module Bundler
|
@@ -20,8 +12,8 @@ module Bundler
|
|
20
12
|
autoload :Dependency, 'bundler/dependency'
|
21
13
|
autoload :Dsl, 'bundler/dsl'
|
22
14
|
autoload :Environment, 'bundler/environment'
|
15
|
+
autoload :Fetcher, 'bundler/fetcher'
|
23
16
|
autoload :GemHelper, 'bundler/gem_helper'
|
24
|
-
autoload :GemInstaller, 'bundler/gem_installer'
|
25
17
|
autoload :Graph, 'bundler/graph'
|
26
18
|
autoload :Index, 'bundler/index'
|
27
19
|
autoload :Installer, 'bundler/installer'
|
@@ -38,7 +30,7 @@ module Bundler
|
|
38
30
|
autoload :UI, 'bundler/ui'
|
39
31
|
|
40
32
|
class BundlerError < StandardError
|
41
|
-
def self.status_code(code)
|
33
|
+
def self.status_code(code = nil)
|
42
34
|
define_method(:status_code) { code }
|
43
35
|
end
|
44
36
|
end
|
@@ -46,7 +38,6 @@ module Bundler
|
|
46
38
|
class GemfileNotFound < BundlerError; status_code(10) ; end
|
47
39
|
class GemNotFound < BundlerError; status_code(7) ; end
|
48
40
|
class GemfileError < BundlerError; status_code(4) ; end
|
49
|
-
class InstallError < BundlerError; status_code(5) ; end
|
50
41
|
class PathError < BundlerError; status_code(13) ; end
|
51
42
|
class GitError < BundlerError; status_code(11) ; end
|
52
43
|
class DeprecatedError < BundlerError; status_code(12) ; end
|
@@ -54,6 +45,7 @@ module Bundler
|
|
54
45
|
class DslError < BundlerError; status_code(15) ; end
|
55
46
|
class ProductionError < BundlerError; status_code(16) ; end
|
56
47
|
class InvalidOption < DslError ; end
|
48
|
+
class HTTPError < BundlerError; status_code(17) ; end
|
57
49
|
|
58
50
|
|
59
51
|
WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
|
@@ -89,6 +81,7 @@ module Bundler
|
|
89
81
|
end
|
90
82
|
|
91
83
|
def bundle_path
|
84
|
+
# STDERR.puts settings.path
|
92
85
|
@bundle_path ||= Pathname.new(settings.path).expand_path(root)
|
93
86
|
end
|
94
87
|
|
@@ -114,7 +107,8 @@ module Bundler
|
|
114
107
|
unloaded = groups - @completed_groups
|
115
108
|
# Record groups that are now loaded
|
116
109
|
@completed_groups = groups
|
117
|
-
|
110
|
+
# Load any groups that are not yet loaded
|
111
|
+
unloaded.any? ? load.setup(*unloaded) : load
|
118
112
|
end
|
119
113
|
end
|
120
114
|
|
@@ -140,11 +134,11 @@ module Bundler
|
|
140
134
|
end
|
141
135
|
|
142
136
|
def ruby_scope
|
143
|
-
"#{
|
137
|
+
"#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
|
144
138
|
end
|
145
139
|
|
146
140
|
def user_bundle_path
|
147
|
-
Pathname.new(
|
141
|
+
Pathname.new(Gem.user_home).join(".bundler")
|
148
142
|
end
|
149
143
|
|
150
144
|
def home
|
@@ -202,7 +196,7 @@ module Bundler
|
|
202
196
|
end
|
203
197
|
|
204
198
|
def requires_sudo?
|
205
|
-
return @requires_sudo if
|
199
|
+
return @requires_sudo if @checked_for_sudo
|
206
200
|
|
207
201
|
path = bundle_path
|
208
202
|
path = path.parent until path.exist?
|
@@ -232,13 +226,12 @@ module Bundler
|
|
232
226
|
path = Pathname.new(file)
|
233
227
|
# Eval the gemspec from its parent directory
|
234
228
|
Dir.chdir(path.dirname.to_s) do
|
235
|
-
contents = File.read(path.basename.to_s)
|
236
229
|
begin
|
237
|
-
Gem::Specification.from_yaml(
|
230
|
+
Gem::Specification.from_yaml(path.basename.to_s)
|
238
231
|
# Raises ArgumentError if the file is not valid YAML
|
239
232
|
rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
|
240
233
|
begin
|
241
|
-
eval(
|
234
|
+
eval(File.read(path.basename.to_s), TOPLEVEL_BINDING, path.expand_path.to_s)
|
242
235
|
rescue LoadError => e
|
243
236
|
original_line = e.backtrace.find { |line| line.include?(path.to_s) }
|
244
237
|
msg = "There was a LoadError while evaluating #{path.basename}:\n #{e.message}"
|
@@ -261,17 +254,14 @@ module Bundler
|
|
261
254
|
if settings[:disable_shared_gems]
|
262
255
|
ENV['GEM_PATH'] = ''
|
263
256
|
ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
|
264
|
-
elsif
|
265
|
-
|
266
|
-
paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
|
257
|
+
elsif Gem.dir != bundle_path.to_s
|
258
|
+
paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
|
267
259
|
ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
|
268
260
|
ENV["GEM_HOME"] = bundle_path.to_s
|
269
261
|
end
|
270
262
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
Bundler.rubygems.clear_paths
|
263
|
+
FileUtils.mkdir_p bundle_path.to_s
|
264
|
+
Gem.clear_paths
|
275
265
|
end
|
276
266
|
|
277
267
|
def upgrade_lockfile
|
data/lib/bundler/capistrano.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'bundler/deployment'
|
6
6
|
|
7
7
|
Capistrano::Configuration.instance(:must_exist).load do
|
8
|
-
after "deploy:
|
8
|
+
after "deploy:update_code", "bundle:install"
|
9
9
|
Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
|
10
|
-
set :rake,
|
10
|
+
set :rake, 'bundle exec rake'
|
11
11
|
end
|
data/lib/bundler/cli.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
|
2
|
-
require '
|
1
|
+
$:.unshift File.expand_path('../vendor', __FILE__)
|
2
|
+
require 'thor'
|
3
|
+
require 'thor/actions'
|
3
4
|
require 'rubygems/config_file'
|
4
5
|
|
6
|
+
# Work around a RubyGems bug
|
7
|
+
Gem.configuration
|
8
|
+
|
5
9
|
module Bundler
|
6
10
|
class CLI < Thor
|
7
11
|
include Thor::Actions
|
@@ -11,10 +15,10 @@ module Bundler
|
|
11
15
|
the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
|
12
16
|
Bundler.ui = UI::Shell.new(the_shell)
|
13
17
|
Bundler.ui.debug! if options["verbose"]
|
14
|
-
|
18
|
+
Gem::DefaultUserInteraction.ui = UI::RGProxy.new(Bundler.ui)
|
15
19
|
end
|
16
20
|
|
17
|
-
check_unknown_options!
|
21
|
+
check_unknown_options! unless ARGV.include?("exec") || ARGV.include?("config")
|
18
22
|
|
19
23
|
default_task :install
|
20
24
|
class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
|
@@ -41,7 +45,7 @@ module Bundler
|
|
41
45
|
|
42
46
|
if have_groff? && root !~ %r{^file:/.+!/META-INF/jruby.home/.+}
|
43
47
|
groff = "groff -Wall -mtty-char -mandoc -Tascii"
|
44
|
-
pager = ENV['MANPAGER'] || ENV['PAGER'] || 'less
|
48
|
+
pager = ENV['MANPAGER'] || ENV['PAGER'] || 'less'
|
45
49
|
|
46
50
|
Kernel.exec "#{groff} #{root}/#{command} | #{pager}"
|
47
51
|
else
|
@@ -126,8 +130,6 @@ module Bundler
|
|
126
130
|
D
|
127
131
|
method_option "without", :type => :array, :banner =>
|
128
132
|
"Exclude gems that are part of the specified named group."
|
129
|
-
method_option "disable-shared-gems", :type => :boolean, :banner =>
|
130
|
-
"This option is deprecated. Please do not use it."
|
131
133
|
method_option "gemfile", :type => :string, :banner =>
|
132
134
|
"Use the specified gemfile instead of Gemfile"
|
133
135
|
method_option "no-prune", :type => :boolean, :banner =>
|
@@ -148,43 +150,29 @@ module Bundler
|
|
148
150
|
"Do not allow the Gemfile.lock to be updated after this install"
|
149
151
|
method_option "deployment", :type => :boolean, :banner =>
|
150
152
|
"Install using defaults tuned for deployment environments"
|
151
|
-
|
153
|
+
method_option "standalone", :type => :array, :lazy_default => [], :banner =>
|
154
|
+
"Make a bundle that can work without the Bundler runtime"
|
155
|
+
def install
|
152
156
|
opts = options.dup
|
153
|
-
|
157
|
+
opts[:without] ||= []
|
158
|
+
if opts[:without].size == 1
|
154
159
|
opts[:without].map!{|g| g.split(" ") }
|
155
160
|
opts[:without].flatten!
|
156
|
-
opts[:without].map!{|g| g.to_sym }
|
157
161
|
end
|
162
|
+
opts[:without].map!{|g| g.to_sym }
|
158
163
|
|
159
|
-
# Can't use Bundler.settings for this because settings needs gemfile.dirname
|
160
164
|
ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
|
161
165
|
ENV['RB_USER_INSTALL'] = '1' if Bundler::FREEBSD
|
162
166
|
|
163
167
|
# Just disable color in deployment mode
|
164
168
|
Bundler.ui.shell = Thor::Shell::Basic.new if opts[:deployment]
|
165
169
|
|
166
|
-
if (
|
170
|
+
if (opts[:path] || opts[:deployment]) && opts[:system]
|
167
171
|
Bundler.ui.error "You have specified both a path to install your gems to, \n" \
|
168
172
|
"as well as --system. Please choose."
|
169
173
|
exit 1
|
170
174
|
end
|
171
175
|
|
172
|
-
if path && opts[:path]
|
173
|
-
Bundler.ui.error "You have specified a path via `bundle install #{path}` as well as\n" \
|
174
|
-
"by `bundle install --path #{options[:path]}`. These options are\n" \
|
175
|
-
"equivalent, so please use one or the other."
|
176
|
-
exit 1
|
177
|
-
end
|
178
|
-
|
179
|
-
if opts["disable-shared-gems"]
|
180
|
-
Bundler.ui.error "The disable-shared-gem option is no longer available.\n\n" \
|
181
|
-
"Instead, use `bundle install` to install to your system,\n" \
|
182
|
-
"or `bundle install --path path/to/gems` to install to an isolated\n" \
|
183
|
-
"location. Bundler will resolve relative paths relative to\n" \
|
184
|
-
"your `Gemfile`."
|
185
|
-
exit 1
|
186
|
-
end
|
187
|
-
|
188
176
|
if opts[:deployment] || opts[:frozen]
|
189
177
|
unless Bundler.default_lockfile.exist?
|
190
178
|
flag = opts[:deployment] ? '--deployment' : '--frozen'
|
@@ -200,42 +188,30 @@ module Bundler
|
|
200
188
|
Bundler.settings[:frozen] = '1'
|
201
189
|
end
|
202
190
|
|
203
|
-
#
|
204
|
-
if opts[:
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
Bundler.settings[:
|
210
|
-
Bundler.settings[:
|
211
|
-
Bundler.settings[:path] = path if path
|
212
|
-
Bundler.settings[:path] = opts[:path] if opts[:path]
|
213
|
-
Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
|
214
|
-
Bundler.settings[:no_prune] = true if opts["no-prune"]
|
215
|
-
Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
|
216
|
-
Bundler.settings.without = opts[:without]
|
191
|
+
# Can't use Bundler.settings for this because settings needs gemfile.dirname
|
192
|
+
Bundler.settings[:path] = nil if opts[:system]
|
193
|
+
Bundler.settings[:path] = "vendor/bundle" if opts[:deployment]
|
194
|
+
Bundler.settings[:path] = opts[:path] if opts[:path]
|
195
|
+
Bundler.settings[:path] ||= "bundle" if opts[:standalone]
|
196
|
+
Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
|
197
|
+
Bundler.settings[:disable_shared_gems] = '1' if Bundler.settings[:path]
|
198
|
+
Bundler.settings.without = opts[:without] unless opts[:without].empty?
|
217
199
|
Bundler.ui.be_quiet! if opts[:quiet]
|
218
200
|
|
219
201
|
Installer.install(Bundler.root, Bundler.definition, opts)
|
220
202
|
Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
|
221
203
|
|
222
204
|
if Bundler.settings[:path]
|
223
|
-
|
224
|
-
relative_path =
|
205
|
+
relative_path = Bundler.settings[:path]
|
206
|
+
relative_path = "./" + relative_path unless relative_path[0] == ?/
|
225
207
|
Bundler.ui.confirm "Your bundle is complete! " +
|
226
208
|
"It was installed into #{relative_path}"
|
227
209
|
else
|
228
210
|
Bundler.ui.confirm "Your bundle is complete! " +
|
229
211
|
"Use `bundle show [gemname]` to see where a bundled gem is installed."
|
230
212
|
end
|
231
|
-
|
232
|
-
if path
|
233
|
-
Bundler.ui.warn "The path argument to `bundle install` is deprecated. " +
|
234
|
-
"It will be removed in version 1.1. " +
|
235
|
-
"Please use `bundle install --path #{path}` instead."
|
236
|
-
end
|
237
213
|
rescue GemNotFound => e
|
238
|
-
if opts[:local]
|
214
|
+
if opts[:local]
|
239
215
|
Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory."
|
240
216
|
end
|
241
217
|
|
@@ -271,16 +247,6 @@ module Bundler
|
|
271
247
|
"Use `bundle show [gemname]` to see where a bundled gem is installed."
|
272
248
|
end
|
273
249
|
|
274
|
-
desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
|
275
|
-
def lock
|
276
|
-
Bundler.ui.warn "Lock is deprecated. Your bundle is now locked whenever you run `bundle install`."
|
277
|
-
end
|
278
|
-
|
279
|
-
desc "unlock", "Unlock the bundle. This allows gem versions to be changed."
|
280
|
-
def unlock
|
281
|
-
Bundler.ui.warn "Unlock is deprecated. To update to newer gem versions, use `bundle update`."
|
282
|
-
end
|
283
|
-
|
284
250
|
desc "show [GEM]", "Shows all gems that are part of the bundle, or the path to a given gem"
|
285
251
|
long_desc <<-D
|
286
252
|
Show lists the names and versions of all gems that are required by your Gemfile.
|
@@ -305,7 +271,7 @@ module Bundler
|
|
305
271
|
def cache
|
306
272
|
Bundler.definition.resolve_with_cache!
|
307
273
|
Bundler.load.cache
|
308
|
-
Bundler.settings[:no_prune] = true if options[
|
274
|
+
Bundler.settings[:no_prune] = true if options[:no_prune]
|
309
275
|
Bundler.load.lock
|
310
276
|
rescue GemNotFound => e
|
311
277
|
Bundler.ui.error(e.message)
|
@@ -335,7 +301,7 @@ module Bundler
|
|
335
301
|
into the systemwide Rubygems repository.
|
336
302
|
D
|
337
303
|
def exec(*)
|
338
|
-
ARGV.
|
304
|
+
ARGV.delete("exec")
|
339
305
|
|
340
306
|
Bundler.setup
|
341
307
|
|
@@ -347,7 +313,7 @@ module Bundler
|
|
347
313
|
exit 126
|
348
314
|
rescue Errno::ENOENT
|
349
315
|
Bundler.ui.error "bundler: command not found: #{ARGV.first}"
|
350
|
-
Bundler.ui.warn "Install missing gem
|
316
|
+
Bundler.ui.warn "Install missing gem binaries with `bundle install`"
|
351
317
|
exit 127
|
352
318
|
end
|
353
319
|
end
|
@@ -473,17 +439,12 @@ module Bundler
|
|
473
439
|
desc "gem GEM", "Creates a skeleton for creating a rubygem"
|
474
440
|
method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :banner => "Generate a binary for your library."
|
475
441
|
def gem(name)
|
476
|
-
name = name.chomp("/") # remove trailing slash if present
|
477
442
|
target = File.join(Dir.pwd, name)
|
478
|
-
constant_name = name.split('_').map{|p| p
|
479
|
-
constant_name = constant_name.split('-').map{|q| q
|
443
|
+
constant_name = name.split('_').map{|p| p.capitalize}.join
|
444
|
+
constant_name = constant_name.split('-').map{|q| q.capitalize}.join('::') if constant_name =~ /-/
|
480
445
|
constant_array = constant_name.split('::')
|
481
|
-
git_author_name = `git config user.name`.chomp
|
482
|
-
git_author_email = `git config user.email`.chomp
|
483
|
-
author_name = git_author_name.empty? ? "TODO: Write your name" : git_author_name
|
484
|
-
author_email = git_author_email.empty? ? "TODO: Write your email address" : git_author_email
|
485
446
|
FileUtils.mkdir_p(File.join(target, 'lib', name))
|
486
|
-
opts = {:name => name, :constant_name => constant_name, :constant_array => constant_array
|
447
|
+
opts = {:name => name, :constant_name => constant_name, :constant_array => constant_array}
|
487
448
|
template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
|
488
449
|
template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
|
489
450
|
template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
|
@@ -501,6 +462,14 @@ module Bundler
|
|
501
462
|
File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
502
463
|
end
|
503
464
|
|
465
|
+
desc "clean", "Cleans up unused gems in your bundler directory"
|
466
|
+
def clean
|
467
|
+
clean_output = Bundler.load.clean
|
468
|
+
if !clean_output
|
469
|
+
Bundler.ui.error "Can only use bundle clean when --path is set"
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
504
473
|
private
|
505
474
|
|
506
475
|
def have_groff?
|
data/lib/bundler/definition.rb
CHANGED
@@ -61,7 +61,7 @@ module Bundler
|
|
61
61
|
@unlock[:gems] ||= []
|
62
62
|
@unlock[:sources] ||= []
|
63
63
|
|
64
|
-
current_platform =
|
64
|
+
current_platform = Gem.platforms.map { |p| generic(p) }.compact.last
|
65
65
|
@new_platform = !@platforms.include?(current_platform)
|
66
66
|
@platforms |= [current_platform]
|
67
67
|
|
@@ -70,23 +70,6 @@ module Bundler
|
|
70
70
|
|
71
71
|
converge_sources
|
72
72
|
converge_dependencies
|
73
|
-
|
74
|
-
fixup_dependency_types!
|
75
|
-
end
|
76
|
-
|
77
|
-
def fixup_dependency_types!
|
78
|
-
# XXX This is a temporary workaround for a bug when using rubygems 1.8.15
|
79
|
-
# where Gem::Dependency#== matches Gem::Dependency#type. As the lockfile
|
80
|
-
# doesn't carry a notion of the dependency type, if you use
|
81
|
-
# add_development_dependency in a gemspec that's loaded with the gemspec
|
82
|
-
# directive, the lockfile dependencies and resolved dependencies end up
|
83
|
-
# with a mismatch on #type.
|
84
|
-
# Test coverage to catch a regression on this is in gemspec_spec.rb
|
85
|
-
@dependencies.each do |d|
|
86
|
-
if ld = @locked_deps.find { |l| l.name == d.name }
|
87
|
-
ld.instance_variable_set(:@type, d.type)
|
88
|
-
end
|
89
|
-
end
|
90
73
|
end
|
91
74
|
|
92
75
|
def resolve_with_cache!
|
@@ -173,7 +156,7 @@ module Bundler
|
|
173
156
|
def index
|
174
157
|
@index ||= Index.build do |idx|
|
175
158
|
@sources.each do |s|
|
176
|
-
idx.use s.specs
|
159
|
+
idx.use s.specs(@dependencies)
|
177
160
|
end
|
178
161
|
end
|
179
162
|
end
|
@@ -197,10 +180,6 @@ module Bundler
|
|
197
180
|
def lock(file)
|
198
181
|
contents = to_lock
|
199
182
|
|
200
|
-
# Convert to \r\n if the existing lock has them
|
201
|
-
# i.e., Windows with `git config core.autocrlf=true`
|
202
|
-
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
|
203
|
-
|
204
183
|
return if @lockfile_contents == contents
|
205
184
|
|
206
185
|
if Bundler.settings[:frozen]
|
@@ -208,6 +187,10 @@ module Bundler
|
|
208
187
|
return
|
209
188
|
end
|
210
189
|
|
190
|
+
# Convert to \r\n if the existing lock has them
|
191
|
+
# i.e., Windows with `git config core.autocrlf=true`
|
192
|
+
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
|
193
|
+
|
211
194
|
File.open(file, 'wb'){|f| f.puts(contents) }
|
212
195
|
end
|
213
196
|
|
@@ -242,7 +225,7 @@ module Bundler
|
|
242
225
|
|
243
226
|
handled = []
|
244
227
|
dependencies.
|
245
|
-
sort_by { |d| d.
|
228
|
+
sort_by { |d| d.name }.
|
246
229
|
each do |dep|
|
247
230
|
next if handled.include?(dep.name)
|
248
231
|
out << dep.to_lock
|
@@ -252,17 +235,11 @@ module Bundler
|
|
252
235
|
out
|
253
236
|
end
|
254
237
|
|
255
|
-
def ensure_equivalent_gemfile_and_lockfile
|
238
|
+
def ensure_equivalent_gemfile_and_lockfile
|
256
239
|
changes = false
|
257
240
|
|
258
|
-
msg = "You
|
259
|
-
"
|
260
|
-
"updated Gemfile.lock to version control."
|
261
|
-
|
262
|
-
unless explicit_flag
|
263
|
-
msg += "\n\nIf this is a development machine, remove the Gemfile " \
|
264
|
-
"freeze \nby running `bundle install --no-deployment`."
|
265
|
-
end
|
241
|
+
msg = "You have modified your Gemfile in development but did not check\n" \
|
242
|
+
"the resulting snapshot (Gemfile.lock) into version control"
|
266
243
|
|
267
244
|
added = []
|
268
245
|
deleted = []
|
@@ -310,7 +287,6 @@ module Bundler
|
|
310
287
|
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
311
288
|
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
312
289
|
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
313
|
-
msg << "\n"
|
314
290
|
|
315
291
|
raise ProductionError, msg if added.any? || deleted.any? || changed.any?
|
316
292
|
end
|
@@ -391,10 +367,8 @@ module Bundler
|
|
391
367
|
# If the spec is no longer in the path source, unlock it. This
|
392
368
|
# commonly happens if the version changed in the gemspec
|
393
369
|
next unless other
|
394
|
-
|
395
|
-
deps2 = other.dependencies.select { |d| d.type != :development }
|
396
370
|
# If the dependencies of the path source have changed, unlock it
|
397
|
-
next unless s.dependencies.sort ==
|
371
|
+
next unless s.dependencies.sort == other.dependencies.sort
|
398
372
|
end
|
399
373
|
|
400
374
|
converged << s
|