bundler 1.2.0.pre.1 → 1.2.0.rc
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 +27 -1
- data/ISSUES.md +3 -3
- data/lib/bundler.rb +7 -5
- data/lib/bundler/cli.rb +17 -20
- data/lib/bundler/definition.rb +5 -0
- data/lib/bundler/dsl.rb +1 -1
- data/lib/bundler/fetcher.rb +5 -6
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/ruby_version.rb +4 -2
- data/lib/bundler/runtime.rb +46 -19
- data/lib/bundler/source.rb +25 -10
- data/lib/bundler/templates/newgem/{LICENSE.tt → LICENSE.txt.tt} +0 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +0 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -4
- data/lib/bundler/vendor/thor.rb +49 -28
- data/lib/bundler/vendor/thor/actions.rb +7 -3
- data/lib/bundler/vendor/thor/actions/create_link.rb +1 -1
- data/lib/bundler/vendor/thor/actions/directory.rb +9 -4
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +24 -5
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +39 -1
- data/lib/bundler/vendor/thor/base.rb +65 -24
- data/lib/bundler/vendor/thor/core_ext/dir_escape.rb +0 -0
- data/lib/bundler/vendor/thor/error.rb +6 -1
- data/lib/bundler/vendor/thor/group.rb +21 -9
- data/lib/bundler/vendor/thor/invocation.rb +4 -2
- data/lib/bundler/vendor/thor/parser/arguments.rb +4 -0
- data/lib/bundler/vendor/thor/parser/option.rb +3 -2
- data/lib/bundler/vendor/thor/parser/options.rb +13 -7
- data/lib/bundler/vendor/thor/rake_compat.rb +13 -8
- data/lib/bundler/vendor/thor/runner.rb +15 -3
- data/lib/bundler/vendor/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/shell/basic.rb +169 -82
- data/lib/bundler/vendor/thor/shell/color.rb +40 -4
- data/lib/bundler/vendor/thor/shell/html.rb +28 -26
- data/lib/bundler/vendor/thor/task.rb +24 -5
- data/lib/bundler/vendor/thor/util.rb +43 -6
- data/lib/bundler/vendor/thor/version.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-config.ronn +2 -2
- data/spec/bundler/definition_spec.rb +25 -0
- data/spec/cache/git_spec.rb +47 -0
- data/spec/cache/path_spec.rb +18 -0
- data/spec/install/git_spec.rb +21 -6
- data/spec/lock/lockfile_spec.rb +1 -1
- data/spec/other/check_spec.rb +14 -1
- data/spec/other/newgem_spec.rb +1 -0
- data/spec/other/platform_spec.rb +164 -0
- data/spec/runtime/setup_spec.rb +87 -0
- data/spec/runtime/with_clean_env_spec.rb +14 -0
- metadata +78 -133
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
+
## 1.2.0.rc (Jul 17, 2012)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- `check` now has a `--dry-run` option (@svenfuchs, #1811)
|
6
|
+
- loosen ruby directive for engines
|
7
|
+
- prune git/path directories inside vendor/cache (@josevalim, #1988)
|
8
|
+
- update vendored thor to 0.15.2 (@sferik)
|
9
|
+
- add .txt to LICENSCE (@postmodern, #2001)
|
10
|
+
- add `config disable_local_branch_check` (@josevalim, #1985)
|
11
|
+
- fall back on the full index when experiencing syck errors (#1419)
|
12
|
+
- handle syntax errors in Ruby gemspecs (#1974)
|
13
|
+
|
14
|
+
Bugfixes:
|
15
|
+
|
16
|
+
- fix `pack`/`cache` with `--all` (@josevalim, #1989)
|
17
|
+
- don't display warning message when `cache_all` is set
|
18
|
+
- check for `nil` PATH (#2006)
|
19
|
+
- Always try to keep original GEM_PATH (@drogus, #1920)
|
20
|
+
|
1
21
|
## 1.2.0.pre.1 (May 27, 2012)
|
2
22
|
|
3
23
|
Features:
|
4
24
|
|
5
|
-
-
|
25
|
+
- Git gems import submodules of submodules recursively (@nwwatson, #1935)
|
6
26
|
|
7
27
|
Bugfixes:
|
8
28
|
|
@@ -52,6 +72,12 @@ Documentation:
|
|
52
72
|
- Add basic documentation for bin_path and bundle_path (@radar)
|
53
73
|
- Add documentation for the run method in Bundler::Installer
|
54
74
|
|
75
|
+
## 1.1.5 (Jul 17, 2012)
|
76
|
+
|
77
|
+
Features:
|
78
|
+
|
79
|
+
- Special case `ruby` directive from 1.2.0, so you can install Gemfiles that use it
|
80
|
+
|
55
81
|
## 1.1.4 (May 27, 2012)
|
56
82
|
|
57
83
|
Bugfixes:
|
data/ISSUES.md
CHANGED
@@ -49,8 +49,8 @@ The Bundler team needs to know some things in order to diagnose and hopefully fi
|
|
49
49
|
- What version of Ruby you are using (run `ruby -v`)
|
50
50
|
- What version of Rubygems you are using (run `gem -v`)
|
51
51
|
- Whether you are using RVM, and if so what version (run `rvm -v`)
|
52
|
-
- Whether you have the `rubygems-bundler` gem, which can break gem binares
|
53
|
-
- Whether you have the `open_gem` gem, which can cause rake activation conflicts
|
52
|
+
- Whether you have the `rubygems-bundler` gem, which can break gem binares (run `gem list rubygems-bundler`)
|
53
|
+
- Whether you have the `open_gem` gem, which can cause rake activation conflicts (run `gem list open_gem`)
|
54
54
|
|
55
55
|
If you are using Rails 2.3, please also include:
|
56
56
|
|
@@ -58,6 +58,6 @@ If you are using Rails 2.3, please also include:
|
|
58
58
|
- Your preinitializer.rb file
|
59
59
|
- Your environment.rb file
|
60
60
|
|
61
|
-
[Create a gist](https://gist.github.com) containing all of that information, then visit the [Bundler issue tracker](https://github.com/carlhuda/bundler/issues) and [create a
|
61
|
+
[Create a gist](https://gist.github.com) containing all of that information, then visit the [Bundler issue tracker](https://github.com/carlhuda/bundler/issues) and [create a ticket](https://github.com/carlhuda/bundler/issues/new) describing your problem and linking to your gist.
|
62
62
|
|
63
63
|
Thanks for reporting issues and making Bundler better!
|
data/lib/bundler.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'pathname'
|
4
|
+
require 'bundler/gem_path_manipulation'
|
4
5
|
require 'bundler/psyched_yaml'
|
5
6
|
require 'bundler/rubygems_ext'
|
6
7
|
require 'bundler/rubygems_integration'
|
7
8
|
require 'bundler/version'
|
8
9
|
|
9
10
|
module Bundler
|
11
|
+
preserve_gem_path
|
10
12
|
ORIGINAL_ENV = ENV.to_hash
|
11
13
|
|
12
14
|
autoload :Definition, 'bundler/definition'
|
@@ -258,7 +260,7 @@ module Bundler
|
|
258
260
|
def which(executable)
|
259
261
|
if File.executable?(executable)
|
260
262
|
executable
|
261
|
-
|
263
|
+
elsif ENV['PATH']
|
262
264
|
path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
|
263
265
|
File.executable?(File.join(p, executable))
|
264
266
|
end
|
@@ -294,14 +296,14 @@ module Bundler
|
|
294
296
|
rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
|
295
297
|
begin
|
296
298
|
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
|
297
|
-
rescue LoadError => e
|
299
|
+
rescue LoadError, SyntaxError => e
|
298
300
|
original_line = e.backtrace.find { |line| line.include?(path.to_s) }
|
299
|
-
msg = "There was a
|
301
|
+
msg = "There was a #{e.class} while evaluating #{path.basename}: \n#{e.message}"
|
300
302
|
msg << " from\n #{original_line}" if original_line
|
301
303
|
msg << "\n"
|
302
304
|
|
303
|
-
if RUBY_VERSION >= "1.9"
|
304
|
-
msg << "\nDoes it try to require a relative path? That
|
305
|
+
if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
|
306
|
+
msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
|
305
307
|
end
|
306
308
|
|
307
309
|
raise GemspecError, msg
|
data/lib/bundler/cli.rb
CHANGED
@@ -14,7 +14,7 @@ module Bundler
|
|
14
14
|
Bundler.rubygems.ui = UI::RGProxy.new(Bundler.ui)
|
15
15
|
end
|
16
16
|
|
17
|
-
check_unknown_options!
|
17
|
+
check_unknown_options!(:except => [:config, :exec])
|
18
18
|
|
19
19
|
default_task :install
|
20
20
|
class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
|
@@ -94,6 +94,8 @@ module Bundler
|
|
94
94
|
"Use the specified gemfile instead of Gemfile"
|
95
95
|
method_option "path", :type => :string, :banner =>
|
96
96
|
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
|
97
|
+
method_option "dry-run", :type => :boolean, :default => false, :banner =>
|
98
|
+
"Lock the Gemfile"
|
97
99
|
def check
|
98
100
|
ENV['BUNDLE_GEMFILE'] = File.expand_path(options[:gemfile]) if options[:gemfile]
|
99
101
|
|
@@ -117,7 +119,7 @@ module Bundler
|
|
117
119
|
Bundler.ui.error "This bundle has been frozen, but there is no Gemfile.lock present"
|
118
120
|
exit 1
|
119
121
|
else
|
120
|
-
Bundler.load.lock
|
122
|
+
Bundler.load.lock unless options[:"dry-run"]
|
121
123
|
Bundler.ui.info "The Gemfile's dependencies are satisfied"
|
122
124
|
end
|
123
125
|
end
|
@@ -416,20 +418,18 @@ module Bundler
|
|
416
418
|
bundle exec you can require and call the bundled gems as if they were installed
|
417
419
|
into the systemwide Rubygems repository.
|
418
420
|
D
|
419
|
-
def exec(*)
|
420
|
-
ARGV.shift # remove "exec"
|
421
|
-
|
421
|
+
def exec(*args)
|
422
422
|
Bundler.definition.validate_ruby!
|
423
423
|
Bundler.load.setup_environment
|
424
424
|
|
425
425
|
begin
|
426
426
|
# Run
|
427
|
-
Kernel.exec(*
|
427
|
+
Kernel.exec(*args)
|
428
428
|
rescue Errno::EACCES
|
429
|
-
Bundler.ui.error "bundler: not executable: #{
|
429
|
+
Bundler.ui.error "bundler: not executable: #{args.first}"
|
430
430
|
exit 126
|
431
431
|
rescue Errno::ENOENT
|
432
|
-
Bundler.ui.error "bundler: command not found: #{
|
432
|
+
Bundler.ui.error "bundler: command not found: #{args.first}"
|
433
433
|
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
434
434
|
exit 127
|
435
435
|
rescue ArgumentError
|
@@ -450,14 +450,11 @@ module Bundler
|
|
450
450
|
will show the current value, as well as any superceded values and
|
451
451
|
where they were specified.
|
452
452
|
D
|
453
|
-
def config(*)
|
454
|
-
|
455
|
-
values.shift # remove config
|
456
|
-
|
457
|
-
peek = values.shift
|
453
|
+
def config(*args)
|
454
|
+
peek = args.shift
|
458
455
|
|
459
456
|
if peek && peek =~ /^\-\-/
|
460
|
-
name, scope =
|
457
|
+
name, scope = args.shift, $'
|
461
458
|
else
|
462
459
|
name, scope = peek, "global"
|
463
460
|
end
|
@@ -482,7 +479,7 @@ module Bundler
|
|
482
479
|
Bundler.settings.set_local(name, nil)
|
483
480
|
Bundler.settings.set_global(name, nil)
|
484
481
|
when "local", "global"
|
485
|
-
if
|
482
|
+
if args.empty?
|
486
483
|
Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
|
487
484
|
with_padding do
|
488
485
|
Bundler.settings.pretty_values_for(name).each { |line| Bundler.ui.info line }
|
@@ -512,7 +509,7 @@ module Bundler
|
|
512
509
|
Bundler.ui.info "You are replacing the current local value of #{name}, which is currently #{local.inspect}"
|
513
510
|
end
|
514
511
|
|
515
|
-
Bundler.settings.send("set_#{scope}", name,
|
512
|
+
Bundler.settings.send("set_#{scope}", name, args.join(" "))
|
516
513
|
else
|
517
514
|
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
|
518
515
|
exit 1
|
@@ -600,7 +597,7 @@ module Bundler
|
|
600
597
|
}
|
601
598
|
template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
|
602
599
|
template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
|
603
|
-
template(File.join("newgem/LICENSE.tt"),
|
600
|
+
template(File.join("newgem/LICENSE.txt.tt"), File.join(target, "LICENSE.txt"), opts)
|
604
601
|
template(File.join("newgem/README.md.tt"), File.join(target, "README.md"), opts)
|
605
602
|
template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
|
606
603
|
template(File.join("newgem/newgem.gemspec.tt"), File.join(target, "#{name}.gemspec"), opts)
|
@@ -667,9 +664,9 @@ module Bundler
|
|
667
664
|
private
|
668
665
|
|
669
666
|
def setup_cache_all
|
670
|
-
if options.key?("all")
|
671
|
-
|
672
|
-
|
667
|
+
Bundler.settings[:cache_all] = options[:all] if options.key?("all")
|
668
|
+
|
669
|
+
if Bundler.definition.sources.any? { |s| !s.is_a?(Source::Rubygems) } && !Bundler.settings[:cache_all]
|
673
670
|
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
|
674
671
|
"to package them as well, please pass the --all flag. This will be the default " \
|
675
672
|
"on Bundler 2.0."
|
data/lib/bundler/definition.rb
CHANGED
@@ -230,6 +230,11 @@ module Bundler
|
|
230
230
|
end
|
231
231
|
|
232
232
|
File.open(file, 'wb'){|f| f.puts(contents) }
|
233
|
+
rescue Errno::EACCES => e
|
234
|
+
raise Bundler::InstallError,
|
235
|
+
"There was an error while trying to write to Gemfile.lock. It is likely that \n" \
|
236
|
+
"you need to allow write permissions for the file at path: \n" \
|
237
|
+
"#{File.expand_path(file)}"
|
233
238
|
end
|
234
239
|
|
235
240
|
def to_lock
|
data/lib/bundler/dsl.rb
CHANGED
@@ -93,7 +93,7 @@ module Bundler
|
|
93
93
|
else
|
94
94
|
raise DslError, "You cannot specify the same gem twice coming from different sources. You " \
|
95
95
|
"specified that #{dep.name} (#{dep.requirement}) should come from " \
|
96
|
-
"#{current.source || 'an
|
96
|
+
"#{current.source || 'an unspecified source'} and #{dep.source}"
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
data/lib/bundler/fetcher.rb
CHANGED
@@ -72,7 +72,7 @@ module Bundler
|
|
72
72
|
# 1. Gemcutter Endpoint doesn't return a 200
|
73
73
|
# 2. Marshal blob doesn't load properly
|
74
74
|
# 3. One of the YAML gemspecs has the Syck::DefaultKey problem
|
75
|
-
rescue HTTPError, TypeError => e
|
75
|
+
rescue HTTPError, TypeError, GemspecError => e
|
76
76
|
# new line now that the dots are over
|
77
77
|
Bundler.ui.info "" unless Bundler.ui.debug?
|
78
78
|
|
@@ -182,11 +182,10 @@ module Bundler
|
|
182
182
|
rescue ArgumentError => e
|
183
183
|
if e.message.include?('Ill-formed requirement ["#<YAML::Syck::DefaultKey')
|
184
184
|
puts # we shouldn't print the error message on the "fetching info" status line
|
185
|
-
raise GemspecError,
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
%{workaround try using the --full-index option.}
|
185
|
+
raise GemspecError,
|
186
|
+
"Unfortunately, the gem #{s[:name]} (#{s[:number]}) has an invalid gemspec. \n" \
|
187
|
+
"Please ask the gem author to yank the bad version to fix this issue. For \n" \
|
188
|
+
"more information, see http://bit.ly/syck-defaultkey."
|
190
189
|
else
|
191
190
|
raise e
|
192
191
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module Bundler
|
2
|
+
def self.preserve_gem_path
|
3
|
+
original_gem_path = ENV["_ORIGINAL_GEM_PATH"]
|
4
|
+
gem_path = ENV["GEM_PATH"]
|
5
|
+
ENV["_ORIGINAL_GEM_PATH"] = gem_path if original_gem_path.nil? || original_gem_path == ""
|
6
|
+
ENV["GEM_PATH"] = original_gem_path if gem_path.nil? || gem_path == ""
|
7
|
+
end
|
8
|
+
end
|
data/lib/bundler/ruby_version.rb
CHANGED
@@ -17,6 +17,8 @@ module Bundler
|
|
17
17
|
|
18
18
|
@version = version
|
19
19
|
@engine = engine || "ruby"
|
20
|
+
# keep track of the engine specified by the user
|
21
|
+
@input_engine = engine
|
20
22
|
@engine_version = engine_version || version
|
21
23
|
end
|
22
24
|
|
@@ -40,11 +42,11 @@ module Bundler
|
|
40
42
|
# 2. ruby_version
|
41
43
|
# 3. engine_version
|
42
44
|
def diff(other)
|
43
|
-
if engine != other.engine
|
45
|
+
if engine != other.engine && @input_engine
|
44
46
|
[ :engine, engine, other.engine ]
|
45
47
|
elsif version != other.version
|
46
48
|
[ :version, version, other.version ]
|
47
|
-
elsif engine_version != other.engine_version
|
49
|
+
elsif engine_version != other.engine_version && @input_engine
|
48
50
|
[ :engine_version, engine_version, other.engine_version ]
|
49
51
|
else
|
50
52
|
nil
|
data/lib/bundler/runtime.rb
CHANGED
@@ -107,26 +107,9 @@ module Bundler
|
|
107
107
|
|
108
108
|
def prune_cache
|
109
109
|
FileUtils.mkdir_p(cache_path) unless File.exists?(cache_path)
|
110
|
-
|
111
110
|
resolve = @definition.resolve
|
112
|
-
|
113
|
-
|
114
|
-
cached = cached.delete_if do |path|
|
115
|
-
spec = Bundler.rubygems.spec_from_gem path
|
116
|
-
|
117
|
-
resolve.any? do |s|
|
118
|
-
s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
if cached.any?
|
123
|
-
Bundler.ui.info "Removing outdated .gem files from vendor/cache"
|
124
|
-
|
125
|
-
cached.each do |path|
|
126
|
-
Bundler.ui.info " * #{File.basename(path)}"
|
127
|
-
File.delete(path)
|
128
|
-
end
|
129
|
-
end
|
111
|
+
prune_gem_cache(resolve)
|
112
|
+
prune_git_and_path_cache(resolve)
|
130
113
|
end
|
131
114
|
|
132
115
|
def clean
|
@@ -226,6 +209,50 @@ module Bundler
|
|
226
209
|
|
227
210
|
private
|
228
211
|
|
212
|
+
def prune_gem_cache(resolve)
|
213
|
+
cached = Dir["#{cache_path}/*.gem"]
|
214
|
+
|
215
|
+
cached = cached.delete_if do |path|
|
216
|
+
spec = Bundler.rubygems.spec_from_gem path
|
217
|
+
|
218
|
+
resolve.any? do |s|
|
219
|
+
s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
if cached.any?
|
224
|
+
Bundler.ui.info "Removing outdated .gem files from vendor/cache"
|
225
|
+
|
226
|
+
cached.each do |path|
|
227
|
+
Bundler.ui.info " * #{File.basename(path)}"
|
228
|
+
File.delete(path)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
def prune_git_and_path_cache(resolve)
|
234
|
+
cached = Dir["#{cache_path}/*/.bundlecache"]
|
235
|
+
|
236
|
+
cached = cached.delete_if do |path|
|
237
|
+
name = File.basename(File.dirname(path))
|
238
|
+
|
239
|
+
resolve.any? do |s|
|
240
|
+
source = s.source
|
241
|
+
source.respond_to?(:app_cache_dirname) && source.app_cache_dirname == name
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
if cached.any?
|
246
|
+
Bundler.ui.info "Removing outdated .git/path repos from vendor/cache"
|
247
|
+
|
248
|
+
cached.each do |path|
|
249
|
+
path = File.dirname(path)
|
250
|
+
Bundler.ui.info " * #{File.basename(path)}"
|
251
|
+
FileUtils.rm_rf(path)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
229
256
|
def cache_path
|
230
257
|
root.join("vendor/cache")
|
231
258
|
end
|
data/lib/bundler/source.rb
CHANGED
@@ -374,6 +374,7 @@ module Bundler
|
|
374
374
|
return if @original_path.expand_path(Bundler.root).to_s.index(Bundler.root.to_s) == 0
|
375
375
|
FileUtils.rm_rf(app_cache_path)
|
376
376
|
FileUtils.cp_r("#{@original_path}/.", app_cache_path)
|
377
|
+
FileUtils.touch(app_cache_path.join(".bundlecache"))
|
377
378
|
end
|
378
379
|
|
379
380
|
def local_specs(*)
|
@@ -387,10 +388,14 @@ module Bundler
|
|
387
388
|
local_specs
|
388
389
|
end
|
389
390
|
|
391
|
+
def app_cache_dirname
|
392
|
+
name
|
393
|
+
end
|
394
|
+
|
390
395
|
private
|
391
396
|
|
392
397
|
def app_cache_path
|
393
|
-
@app_cache_path ||= Bundler.app_cache.join(
|
398
|
+
@app_cache_path ||= Bundler.app_cache.join(app_cache_dirname)
|
394
399
|
end
|
395
400
|
|
396
401
|
def has_app_cache?
|
@@ -628,7 +633,7 @@ module Bundler
|
|
628
633
|
end
|
629
634
|
end
|
630
635
|
|
631
|
-
attr_reader :uri, :ref, :options, :submodules
|
636
|
+
attr_reader :uri, :ref, :branch, :options, :submodules
|
632
637
|
|
633
638
|
def initialize(options)
|
634
639
|
@options = options
|
@@ -641,6 +646,7 @@ module Bundler
|
|
641
646
|
%w(ref branch tag revision).each{|k| options[k] = options[k].to_s if options[k] }
|
642
647
|
|
643
648
|
@uri = options["uri"]
|
649
|
+
@branch = options["branch"]
|
644
650
|
@ref = options["ref"] || options["branch"] || options["tag"] || 'master'
|
645
651
|
@submodules = options["submodules"]
|
646
652
|
@name = options["name"]
|
@@ -670,6 +676,7 @@ module Bundler
|
|
670
676
|
Git === o &&
|
671
677
|
uri == o.uri &&
|
672
678
|
ref == o.ref &&
|
679
|
+
branch == o.branch &&
|
673
680
|
name == o.name &&
|
674
681
|
version == o.version &&
|
675
682
|
submodules == o.submodules
|
@@ -692,6 +699,9 @@ module Bundler
|
|
692
699
|
File.basename(@uri, '.git')
|
693
700
|
end
|
694
701
|
|
702
|
+
# This is the path which is going to contain a specific
|
703
|
+
# checkout of the git repository. When using local git
|
704
|
+
# repos, this is set to the local repo.
|
695
705
|
def install_path
|
696
706
|
@install_path ||= begin
|
697
707
|
git_scope = "#{base_name}-#{shortref_for_path(revision)}"
|
@@ -716,9 +726,9 @@ module Bundler
|
|
716
726
|
path = Pathname.new(path)
|
717
727
|
path = path.expand_path(Bundler.root) unless path.relative?
|
718
728
|
|
719
|
-
unless options["branch"]
|
729
|
+
unless options["branch"] || Bundler.settings[:disable_local_branch_check]
|
720
730
|
raise GitError, "Cannot use local override for #{name} at #{path} because " \
|
721
|
-
":branch is not specified in Gemfile. Specify a branch or
|
731
|
+
":branch is not specified in Gemfile. Specify a branch or use " \
|
722
732
|
"`bundle config --delete` to remove the local override"
|
723
733
|
end
|
724
734
|
|
@@ -733,7 +743,7 @@ module Bundler
|
|
733
743
|
# so the Gemfile.lock always picks up the new revision.
|
734
744
|
@git_proxy = GitProxy.new(path, uri, ref)
|
735
745
|
|
736
|
-
if git_proxy.branch != options["branch"]
|
746
|
+
if git_proxy.branch != options["branch"] && !Bundler.settings[:disable_local_branch_check]
|
737
747
|
raise GitError, "Local override for #{name} at #{path} is using branch " \
|
738
748
|
"#{git_proxy.branch} but Gemfile specifies #{options["branch"]}"
|
739
749
|
end
|
@@ -776,12 +786,13 @@ module Bundler
|
|
776
786
|
|
777
787
|
def cache(spec)
|
778
788
|
return unless Bundler.settings[:cache_all]
|
779
|
-
return if path
|
789
|
+
return if path == app_cache_path
|
780
790
|
cached!
|
781
791
|
FileUtils.rm_rf(app_cache_path)
|
782
792
|
git_proxy.checkout if requires_checkout?
|
783
793
|
git_proxy.copy_to(app_cache_path, @submodules)
|
784
794
|
FileUtils.rm_rf(app_cache_path.join(".git"))
|
795
|
+
FileUtils.touch(app_cache_path.join(".bundlecache"))
|
785
796
|
end
|
786
797
|
|
787
798
|
def load_spec_files
|
@@ -790,6 +801,10 @@ module Bundler
|
|
790
801
|
raise GitError, "#{to_s} is not checked out. Please run `bundle install`"
|
791
802
|
end
|
792
803
|
|
804
|
+
# This is the path which is going to contain a cache
|
805
|
+
# of the git repository. When using the same git repository
|
806
|
+
# across different projects, this cache will be shared.
|
807
|
+
# When using local git repos, this is set to the local repo.
|
793
808
|
def cache_path
|
794
809
|
@cache_path ||= begin
|
795
810
|
git_scope = "#{base_name}-#{uri_hash}"
|
@@ -802,6 +817,10 @@ module Bundler
|
|
802
817
|
end
|
803
818
|
end
|
804
819
|
|
820
|
+
def app_cache_dirname
|
821
|
+
"#{base_name}-#{shortref_for_path(cached_revision || revision)}"
|
822
|
+
end
|
823
|
+
|
805
824
|
private
|
806
825
|
|
807
826
|
def set_local!(path)
|
@@ -814,10 +833,6 @@ module Bundler
|
|
814
833
|
cached_revision && super
|
815
834
|
end
|
816
835
|
|
817
|
-
def app_cache_path
|
818
|
-
@app_cache_path ||= Bundler.app_cache.join("#{base_name}-#{shortref_for_path(cached_revision || revision)}")
|
819
|
-
end
|
820
|
-
|
821
836
|
def local?
|
822
837
|
@local
|
823
838
|
end
|