bundler 1.6.2 → 1.6.3

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 859744bca4fa4bf88cbe5c1935e4c54a151ceb2e
4
- data.tar.gz: f597f3f62256ce30c585b68a2b3502102f2e5cb4
3
+ metadata.gz: 47d03cb52cb9c56cfb0a8e3ac50050a2dfe2e73e
4
+ data.tar.gz: 4a1e485a82e9703c83f4eec7fd8b11d36c0aaeef
5
5
  SHA512:
6
- metadata.gz: 31d78a3839acbd4e47defaa27980522ead8a7a4ac3a85999542c2ae6f94259b210e5b8deb8dfce5523389a641b815f43848c27da3411b9d28abaa6c61e9dbf4e
7
- data.tar.gz: 168d70e1e4f17069e568814fca58b96fb1479e69dd444ba83fed82ad176baaf7672f2ae674937538dc705f795420db0a835ae1bc3a5f62a97209584d70d2fa4a
6
+ metadata.gz: 04ff3dd741753285f4f95d1bc62830025f861176f922308b0fdaad31c13bc7661c34a4d3e225045ecafe7725ceaf6d666b16cf68af884b763eb0f70b374826e4
7
+ data.tar.gz: 7f4850dfe4fabc581ca1a5be0fad0caf357f48c8397a92f5aadcf5537e48ee322248d7c4021cc5cb92c1a124c2c84e1bb3c0f676834c73100ffde153a7c36745
@@ -1,3 +1,12 @@
1
+ ## 1.6.3 (2014-06-16)
2
+
3
+ Bugfixes:
4
+
5
+ - fix regression when resolving many conflicts (#2994, @Who828)
6
+ - use local gemspec for builtin gems during install --local (#3041, @Who828)
7
+ - don't warn about sudo when installing on Windows (#2984, @indirect)
8
+ - shell escape `bundle open` arguments (@indirect)
9
+
1
10
  ## 1.6.2 (2014-04-13)
2
11
 
3
12
  Bugfixes:
@@ -116,7 +116,7 @@ module Bundler
116
116
  private
117
117
 
118
118
  def warn_if_root
119
- return unless Process.uid.zero?
119
+ return if Bundler::WINDOWS || !Process.uid.zero?
120
120
  Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
121
121
  "if it is needed, and installing your bundle as root will break this " \
122
122
  "application for all non-root users on this machine.", :wrap => true
@@ -1,4 +1,5 @@
1
1
  require 'bundler/cli/common'
2
+ require 'shellwords'
2
3
 
3
4
  module Bundler
4
5
  class CLI::Open
@@ -11,13 +12,10 @@ module Bundler
11
12
  def run
12
13
  editor = [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
13
14
  return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
14
- spec = Bundler::CLI::Common.select_spec(name, :regex_match)
15
- return unless spec
16
- full_gem_path = spec.full_gem_path
17
- Dir.chdir(full_gem_path) do
18
- command = "#{editor} #{full_gem_path}"
19
- success = system(command)
20
- Bundler.ui.info "Could not run '#{command}'" unless success
15
+ path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
16
+ Dir.chdir(path) do
17
+ command = Shellwords.split(editor) + [path]
18
+ system(*command) || Bundler.ui.info("Could not run '#{command.join(' ')}'")
21
19
  end
22
20
  end
23
21
 
@@ -412,10 +412,8 @@ module Bundler
412
412
  locked = @locked_sources.find(&block)
413
413
 
414
414
  if locked
415
- unlocking = locked.specs.any? do |spec|
416
- @locked_specs.any? do |locked_spec|
417
- locked_spec.source != locked
418
- end
415
+ unlocking = @locked_specs.any? do |locked_spec|
416
+ locked_spec.source != locked
419
417
  end
420
418
  end
421
419
 
@@ -508,8 +506,9 @@ module Bundler
508
506
  # and Gemfile.lock. If the Gemfile modified a dependency, but
509
507
  # the gem in the Gemfile.lock still satisfies it, this is fine
510
508
  # too.
509
+ locked_deps_hash = @locked_deps.inject({}) { |hsh, dep| hsh[dep] = dep; hsh }
511
510
  @dependencies.each do |dep|
512
- locked_dep = @locked_deps.find { |d| dep == d }
511
+ locked_dep = locked_deps_hash[dep]
513
512
 
514
513
  if in_locked_deps?(dep, locked_dep) || satisfies_locked_spec?(dep)
515
514
  deps << dep
@@ -136,7 +136,6 @@ module Bundler
136
136
 
137
137
  def initialize(index, source_requirements, base)
138
138
  @errors = {}
139
- @stack = []
140
139
  @base = base
141
140
  @index = index
142
141
  @deps_for = {}
@@ -165,7 +164,7 @@ module Bundler
165
164
  resolve(reqs, activated)
166
165
  end
167
166
 
168
- class State < Struct.new(:reqs, :activated, :requirement, :possibles, :depth)
167
+ class State < Struct.new(:reqs, :activated, :requirement, :possibles, :depth, :conflicts)
169
168
  def name
170
169
  requirement.name
171
170
  end
@@ -226,13 +225,13 @@ module Bundler
226
225
 
227
226
  def resolve_for_conflict(state)
228
227
  raise version_conflict if state.nil? || state.possibles.empty?
229
- reqs, activated, depth = state.reqs.dup, state.activated.dup, state.depth
228
+ reqs, activated, depth, conflicts = state.reqs.dup, state.activated.dup, state.depth, state.conflicts.dup
230
229
  requirement = state.requirement
231
230
  possible = state.possibles.pop
232
231
 
233
232
  activate_gem(reqs, activated, possible, requirement)
234
233
 
235
- return reqs, activated, depth
234
+ return reqs, activated, depth, conflicts
236
235
  end
237
236
 
238
237
  def resolve_conflict(current, states)
@@ -243,18 +242,19 @@ module Bundler
243
242
 
244
243
  # Resolve the conflicts by rewinding the state
245
244
  # when the conflicted gem was activated
246
- reqs, activated, depth = resolve_for_conflict(state)
245
+ reqs, activated, depth, conflicts = resolve_for_conflict(state)
247
246
 
248
247
  # Keep the state around if it still has other possibilities
249
248
  states << state unless state.possibles.empty?
250
249
  clear_search_cache
251
250
 
252
- return reqs, activated, depth
251
+ return reqs, activated, depth, conflicts
253
252
  end
254
253
 
255
254
  def resolve(reqs, activated)
256
255
  states = []
257
256
  depth = 0
257
+ conflicts = Set.new
258
258
 
259
259
  until reqs.empty?
260
260
 
@@ -307,6 +307,8 @@ module Bundler
307
307
  debug { " * [FAIL] Already activated" }
308
308
  @errors[existing.name] = [existing, current]
309
309
 
310
+ conflicts << current.name
311
+
310
312
  parent = current.required_by.last
311
313
  if existing.respond_to?(:required_by)
312
314
  parent = handle_conflict(current, states, existing.required_by[-2]) unless other_possible?(parent, states)
@@ -314,10 +316,13 @@ module Bundler
314
316
  parent = handle_conflict(current, states) unless other_possible?(parent, states)
315
317
  end
316
318
 
317
- raise version_conflict if parent.nil? || parent.name == 'bundler'
319
+ if parent.nil? && !conflicts.empty?
320
+ parent = states.reverse.detect { |i| conflicts.include?(i.name) && state_any?(i)}
321
+ end
318
322
 
323
+ raise version_conflict if parent.nil? || parent.name == 'bundler'
319
324
 
320
- reqs, activated, depth = resolve_conflict(parent, states)
325
+ reqs, activated, depth, conflicts = resolve_conflict(parent, states)
321
326
  end
322
327
  else
323
328
  matching_versions = search(current)
@@ -359,7 +364,7 @@ module Bundler
359
364
  end
360
365
  end
361
366
 
362
- state = State.new(reqs.dup, activated.dup, current, matching_versions, depth)
367
+ state = State.new(reqs.dup, activated.dup, current, matching_versions, depth, conflicts)
363
368
  states << state
364
369
  requirement = state.possibles.pop
365
370
  activate_gem(reqs, activated, requirement, current)
@@ -126,8 +126,7 @@ module Bundler
126
126
 
127
127
  def cache(spec, custom_path = nil)
128
128
  if builtin_gem?(spec)
129
- remote_spec = remote_specs.search(spec).first
130
- cached_path = fetch_gem(remote_spec)
129
+ cached_path = cached_built_in_gem(spec)
131
130
  else
132
131
  cached_path = cached_gem(spec)
133
132
  end
@@ -137,6 +136,15 @@ module Bundler
137
136
  FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
138
137
  end
139
138
 
139
+ def cached_built_in_gem(spec)
140
+ cached_path = cached_path(spec)
141
+ if cached_path.nil?
142
+ remote_spec = remote_specs.search(spec).first
143
+ cached_path = fetch_gem(remote_spec)
144
+ end
145
+ cached_path
146
+ end
147
+
140
148
  def add_remote(source)
141
149
  @remotes << normalize_uri(source)
142
150
  end
@@ -155,14 +163,18 @@ module Bundler
155
163
  private
156
164
 
157
165
  def cached_gem(spec)
158
- possibilities = @caches.map { |p| "#{p}/#{spec.file_name}" }
159
- cached_gem = possibilities.find { |p| File.exist?(p) }
166
+ cached_gem = cached_path(spec)
160
167
  unless cached_gem
161
168
  raise Bundler::GemNotFound, "Could not find #{spec.file_name} for installation"
162
169
  end
163
170
  cached_gem
164
171
  end
165
172
 
173
+ def cached_path(spec)
174
+ possibilities = @caches.map { |p| "#{p}/#{spec.file_name}" }
175
+ possibilities.find { |p| File.exist?(p) }
176
+ end
177
+
166
178
  def normalize_uri(uri)
167
179
  uri = uri.to_s
168
180
  uri = "#{uri}/" unless uri =~ %r'/$'
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.6.2" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.6.3" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -103,6 +103,20 @@ describe "bundle cache" do
103
103
  expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
104
104
  expect(bundled_app("vendor/cache/builtin_gem-1.0.2.gem")).to exist
105
105
  end
106
+
107
+ it "doesn't make remote request after caching the gem" do
108
+ build_gem "builtin_gem_2", "1.0.2", :path => bundled_app('vendor/cache') do |s|
109
+ s.summary = "This builtin_gem is bundled with Ruby"
110
+ end
111
+
112
+ install_gemfile <<-G
113
+ source "file://#{gem_repo2}"
114
+ gem 'builtin_gem_2', '1.0.2'
115
+ G
116
+
117
+ bundle "install --local"
118
+ should_be_installed("builtin_gem_2 1.0.2")
119
+ end
106
120
  end
107
121
 
108
122
  describe "when there are also git sources" do
@@ -1,12 +1,13 @@
1
1
  $:.unshift File.expand_path('..', __FILE__)
2
2
  $:.unshift File.expand_path('../../lib', __FILE__)
3
- require 'rspec'
4
- require 'bundler/psyched_yaml'
3
+ # stdlib first
4
+ require 'uri'
5
+ require 'digest/sha1'
5
6
  require 'fileutils'
7
+ require 'bundler/psyched_yaml'
6
8
  require 'rubygems'
9
+ require 'rspec'
7
10
  require 'bundler'
8
- require 'uri'
9
- require 'digest/sha1'
10
11
 
11
12
  # Require the correct version of popen for the current platform
12
13
  if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-04-14 00:00:00.000000000 Z
14
+ date: 2014-06-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ronn