bundler 1.6.1 → 1.6.2

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: 9badf28b802fec90f725b4ff52a5a222552ebe32
4
- data.tar.gz: 274ae3d0b61cfc32012342791182d5af829e8895
3
+ metadata.gz: 859744bca4fa4bf88cbe5c1935e4c54a151ceb2e
4
+ data.tar.gz: f597f3f62256ce30c585b68a2b3502102f2e5cb4
5
5
  SHA512:
6
- metadata.gz: 09eefdb50afa1afcb9daa00bc1a5d149621ce58c82373176ec11ee5bc019516471c06acc2b32100c5be87b6c604777c91eb6b53cff299174de472d9de96df4e9
7
- data.tar.gz: 2de981c2e0c4d42b127c65ca0c4ca03a4d97b699d8db9c87bb849a9d5e663991545f5b0f8f4a590afe18d301b4433773dd7bd639bafec73ca4ae6323ec4f51da
6
+ metadata.gz: 31d78a3839acbd4e47defaa27980522ead8a7a4ac3a85999542c2ae6f94259b210e5b8deb8dfce5523389a641b815f43848c27da3411b9d28abaa6c61e9dbf4e
7
+ data.tar.gz: 168d70e1e4f17069e568814fca58b96fb1479e69dd444ba83fed82ad176baaf7672f2ae674937538dc705f795420db0a835ae1bc3a5f62a97209584d70d2fa4a
@@ -1,3 +1,17 @@
1
+ ## 1.6.2 (2014-04-13)
2
+
3
+ Bugfixes:
4
+
5
+ - fix an exception when using builtin gems (#2915, #2963, @gnufied)
6
+ - cache gems that are built in to the running ruby (#2975, @indirect)
7
+ - re-allow deploying cached git gems without git installed (#2968, @aughr)
8
+ - keep standalone working even with builtin gems (@indirect)
9
+ - don't update vendor/cache in deployment mode (#2921, @indirect)
10
+
11
+ Features:
12
+
13
+ - warn informatively when `bundle install` is run as root (#2936, @1337807)
14
+
1
15
  ## 1.6.1 (2014-04-02)
2
16
 
3
17
  Bugfixes:
@@ -8,7 +22,7 @@ Features:
8
22
 
9
23
  - add support for C extensions in sudo mode on Rubygems 2.2
10
24
 
11
- ## 1.6.0 (2014-04-28)
25
+ ## 1.6.0 (2014-03-28)
12
26
 
13
27
  Bugfixes:
14
28
 
@@ -6,6 +6,8 @@ module Bundler
6
6
  end
7
7
 
8
8
  def run
9
+ warn_if_root
10
+
9
11
  if options[:without]
10
12
  options[:without] = options[:without].map{|g| g.tr(' ', ':') }
11
13
  end
@@ -74,7 +76,7 @@ module Bundler
74
76
  definition = Bundler.definition
75
77
  definition.validate_ruby!
76
78
  Installer.install(Bundler.root, definition, options)
77
- Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
79
+ Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"] && !Bundler.settings[:frozen]
78
80
 
79
81
  if Bundler.settings[:path]
80
82
  absolute_path = File.expand_path(Bundler.settings[:path])
@@ -113,6 +115,13 @@ module Bundler
113
115
 
114
116
  private
115
117
 
118
+ def warn_if_root
119
+ return unless Process.uid.zero?
120
+ Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
121
+ "if it is needed, and installing your bundle as root will break this " \
122
+ "application for all non-root users on this machine.", :wrap => true
123
+ end
124
+
116
125
  def without_groups_messages
117
126
  if Bundler.settings.without.any?
118
127
  require "bundler/cli/common"
@@ -91,7 +91,7 @@ module Bundler
91
91
  install_sequentially options[:standalone]
92
92
  end
93
93
 
94
- lock
94
+ lock unless Bundler.settings[:frozen]
95
95
  generate_standalone(options[:standalone]) if options[:standalone]
96
96
  end
97
97
 
@@ -235,6 +235,7 @@ module Bundler
235
235
 
236
236
  specs.each do |spec|
237
237
  next if spec.name == "bundler"
238
+ next if spec.require_paths.nil? # builtin gems
238
239
 
239
240
  spec.require_paths.each do |path|
240
241
  full_path = File.join(spec.full_gem_path, path)
@@ -93,6 +93,10 @@ module Bundler
93
93
  Gem.path
94
94
  end
95
95
 
96
+ def gem_cache
97
+ gem_path.map{|p| File.expand_path("cache", p) }
98
+ end
99
+
96
100
  def spec_cache_dirs
97
101
  @spec_cache_dirs ||= begin
98
102
  dirs = gem_path.map {|dir| File.join(dir, 'specifications')}
@@ -211,6 +211,10 @@ module Bundler
211
211
  git_proxy.revision
212
212
  end
213
213
 
214
+ def allow_git_ops?
215
+ @allow_remote || @allow_cached
216
+ end
217
+
214
218
  private
215
219
 
216
220
  def serialize_gemspecs_in(destination)
@@ -267,10 +271,6 @@ module Bundler
267
271
  Digest::SHA1.hexdigest(input)
268
272
  end
269
273
 
270
- def allow_git_ops?
271
- @allow_remote || @allow_cached
272
- end
273
-
274
274
  def cached_revision
275
275
  options["revision"]
276
276
  end
@@ -280,7 +280,7 @@ module Bundler
280
280
  end
281
281
 
282
282
  def git_proxy
283
- @git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision){ allow_git_ops? }
283
+ @git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision, self)
284
284
  end
285
285
 
286
286
  end
@@ -34,13 +34,13 @@ module Bundler
34
34
  attr_accessor :path, :uri, :ref
35
35
  attr_writer :revision
36
36
 
37
- def initialize(path, uri, ref, revision=nil, &allow)
37
+ def initialize(path, uri, ref, revision = nil, git = nil)
38
38
  @path = path
39
39
  @uri = uri
40
40
  @ref = ref
41
41
  @revision = revision
42
- @allow = allow || Proc.new { true }
43
- raise GitNotInstalledError.new unless Bundler.git_present?
42
+ @git = git
43
+ raise GitNotInstalledError.new if allow? && !Bundler.git_present?
44
44
  end
45
45
 
46
46
  def revision
@@ -138,7 +138,7 @@ module Bundler
138
138
  end
139
139
 
140
140
  def allow?
141
- @allow.call
141
+ @git ? @git.allow_git_ops? : true
142
142
  end
143
143
 
144
144
  def in_path(&blk)
@@ -147,11 +147,8 @@ module Bundler
147
147
  end
148
148
 
149
149
  def allowed_in_path
150
- if allow?
151
- in_path { yield }
152
- else
153
- raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
154
- end
150
+ return in_path { yield } if allow?
151
+ raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
155
152
  end
156
153
 
157
154
  end
@@ -78,6 +78,11 @@ module Bundler
78
78
  app_cache_path = app_cache_path(custom_path)
79
79
  return unless Bundler.settings[:cache_all]
80
80
  return if expand(@original_path).to_s.index(Bundler.root.to_s) == 0
81
+
82
+ unless @original_path.exist?
83
+ raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{to_s} is missing!"
84
+ end
85
+
81
86
  FileUtils.rm_rf(app_cache_path)
82
87
  FileUtils.cp_r("#{@original_path}/.", app_cache_path)
83
88
  FileUtils.touch(app_cache_path.join(".bundlecache"))
@@ -17,9 +17,7 @@ module Bundler
17
17
  @dependency_names = []
18
18
  @allow_remote = false
19
19
  @allow_cached = false
20
-
21
- @caches = [ Bundler.app_cache ] +
22
- Bundler.rubygems.gem_path.map{|p| File.expand_path("#{p}/cache") }
20
+ @caches = [Bundler.app_cache, *Bundler.rubygems.gem_cache]
23
21
  end
24
22
 
25
23
  def remote!
@@ -72,8 +70,7 @@ module Bundler
72
70
  # Download the gem to get the spec, because some specs that are returned
73
71
  # by rubygems.org are broken and wrong.
74
72
  if spec.source_uri
75
- path = Fetcher.download_gem_from_uri(spec, spec.source_uri)
76
- s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
73
+ s = Bundler.rubygems.spec_from_gem(fetch_gem(spec), Bundler.settings["trust-policy"])
77
74
  spec.__swap__(s)
78
75
  end
79
76
 
@@ -128,11 +125,12 @@ module Bundler
128
125
  end
129
126
 
130
127
  def cache(spec, custom_path = nil)
131
- # Gems bundled with Ruby don't have .gem files cached locally, but it doesn't matter
132
- # since they're always going to be installed on this Ruby version.
133
- return if builtin_gem?(spec)
134
-
135
- cached_path = cached_gem(spec)
128
+ if builtin_gem?(spec)
129
+ remote_spec = remote_specs.search(spec).first
130
+ cached_path = fetch_gem(remote_spec)
131
+ else
132
+ cached_path = cached_gem(spec)
133
+ end
136
134
  raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
137
135
  return if File.dirname(cached_path) == Bundler.app_cache.to_s
138
136
  Bundler.ui.info " * #{File.basename(cached_path)}"
@@ -291,12 +289,17 @@ module Bundler
291
289
  end
292
290
  end
293
291
 
292
+ def fetch_gem(spec)
293
+ return false unless spec.source_uri
294
+ Fetcher.download_gem_from_uri(spec, spec.source_uri)
295
+ end
296
+
294
297
  def builtin_gem?(spec)
295
- # Ruby 2.1-style
298
+ # Ruby 2.1, where all included gems have this summary
296
299
  return true if spec.summary =~ /is bundled with Ruby/
297
300
 
298
- # Ruby 2.0 style
299
- spec.loaded_from.include?("specifications/default/")
301
+ # Ruby 2.0, where gemspecs are stored in specifications/default/
302
+ spec.loaded_from && spec.loaded_from.include?("specifications/default/")
300
303
  end
301
304
  end
302
305
  end
@@ -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.1" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.6.2" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -1,6 +1,9 @@
1
1
  require 'spec_helper'
2
+ require 'bundler/cli'
2
3
 
3
4
  describe "bundle executable" do
5
+ let(:source_uri) { "http://localgemserver.test" }
6
+
4
7
  it "returns non-zero exit status when passed unrecognized options" do
5
8
  bundle '--invalid_argument', :exitstatus => true
6
9
  expect(exitstatus).to_not be_zero
@@ -74,39 +74,34 @@ describe "bundle cache" do
74
74
  end
75
75
  end
76
76
 
77
- describe "when there is a built-in gem" do
78
- let(:version) { "1.0.0" }
79
-
77
+ describe "when there is a built-in gem", :ruby => "2.0" do
80
78
  before :each do
81
79
  build_repo2 do
82
- build_gem "builtin_gem", version do |s|
83
- s.summary = "This builtin_gem is bundled with Ruby"
84
- end
85
-
86
- build_gem "remote_gem", version do |s|
87
- s.summary = "Totally normal gem"
88
- end
80
+ build_gem "builtin_gem", "1.0.2"
89
81
  end
90
82
 
91
- build_gem "builtin_gem", version, :to_system => true do |s|
83
+ build_gem "builtin_gem", "1.0.2", :to_system => true do |s|
92
84
  s.summary = "This builtin_gem is bundled with Ruby"
93
85
  end
94
86
 
95
- install_gemfile <<-G
96
- source "file://#{gem_repo2}"
97
- gem 'builtin_gem', '#{version}'
98
- gem 'remote_gem', '#{version}'
99
- G
87
+ FileUtils.rm("#{system_gem_path}/cache/builtin_gem-1.0.2.gem")
88
+ end
100
89
 
101
- FileUtils.rm("#{system_gem_path}/cache/builtin_gem-#{version}.gem")
90
+ it "uses builtin gems" do
91
+ install_gemfile %|gem 'builtin_gem', '1.0.2'|
92
+ should_be_installed("builtin_gem 1.0.2")
102
93
  end
103
94
 
104
- it "caches normal gems successfully" do
105
- bundle :cache, :exitstatus => true
95
+ it "caches remote and builtin gems" do
96
+ install_gemfile <<-G
97
+ source "file://#{gem_repo2}"
98
+ gem 'builtin_gem', '1.0.2'
99
+ gem 'rack', '1.0.0'
100
+ G
106
101
 
107
- expect(exitstatus).to be_zero
108
- expect(bundled_app("vendor/cache/builtin_gem-#{version}.gem")).to_not exist
109
- expect(bundled_app("vendor/cache/remote_gem-#{version}.gem")).to exist
102
+ bundle :cache
103
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
104
+ expect(bundled_app("vendor/cache/builtin_gem-1.0.2.gem")).to exist
110
105
  end
111
106
  end
112
107
 
@@ -947,5 +947,21 @@ describe "bundle install with git sources" do
947
947
  bundle "update", :env => {"PATH" => ""}
948
948
  expect(out).to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
949
949
  end
950
+
951
+ it "installs a packaged git gem successfully" do
952
+ build_git "foo"
953
+
954
+ install_gemfile <<-G
955
+ git "#{lib_path('foo-1.0')}" do
956
+ gem 'foo'
957
+ end
958
+ G
959
+ bundle "package --all"
960
+ simulate_new_machine
961
+
962
+ bundle "install", :env => {"PATH" => ""}, :exitstatus => true
963
+ expect(out).to_not include("You need to install git to be able to use gems from git repositories.")
964
+ expect(exitstatus).to be_zero
965
+ end
950
966
  end
951
967
  end
@@ -125,4 +125,12 @@ describe "when using sudo", :sudo => true do
125
125
  end
126
126
  end
127
127
 
128
+ describe "and root runs install" do
129
+ it "warns against that" do
130
+ gemfile %|source "file://#{gem_repo1}"|
131
+ bundle :install, :sudo => true
132
+ expect(out).to include("Don't run Bundler as root.")
133
+ end
134
+ end
135
+
128
136
  end
@@ -63,6 +63,14 @@ RSpec.configure do |config|
63
63
  config.filter_run_excluding :ruby => "1.9"
64
64
  end
65
65
 
66
+ if RUBY_VERSION >= "2.0"
67
+ config.filter_run_excluding :ruby => "1.8"
68
+ config.filter_run_excluding :ruby => "1.9"
69
+ else
70
+ config.filter_run_excluding :ruby => "2.0"
71
+ config.filter_run_excluding :ruby => "2.1"
72
+ end
73
+
66
74
  if Gem::VERSION < "2.2"
67
75
  config.filter_run_excluding :rubygems => "2.2"
68
76
  end
@@ -58,6 +58,7 @@ module Spec
58
58
  def bundle(cmd, options = {})
59
59
  expect_err = options.delete(:expect_err)
60
60
  exitstatus = options.delete(:exitstatus)
61
+ sudo = "sudo" if options.delete(:sudo)
61
62
  options["no-color"] = true unless options.key?("no-color") || %w(exec conf).include?(cmd.to_s[0..3])
62
63
 
63
64
  bundle_bin = File.expand_path('../../../bin/bundle', __FILE__)
@@ -67,12 +68,12 @@ module Spec
67
68
  requires << File.expand_path('../artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice)
68
69
  requires_str = requires.map{|r| "-r#{r}"}.join(" ")
69
70
 
70
- env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
71
+ env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}'"}.join(" ")
71
72
  args = options.map do |k,v|
72
73
  v == true ? " --#{k}" : " --#{k} #{v}" if v
73
74
  end.join
74
75
 
75
- cmd = "#{env}#{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin} #{cmd}#{args}"
76
+ cmd = "#{env} #{sudo} #{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin} #{cmd}#{args}"
76
77
 
77
78
  if exitstatus
78
79
  sys_status(cmd)
@@ -329,5 +330,16 @@ module Spec
329
330
  def revision_for(path)
330
331
  Dir.chdir(path) { `git rev-parse HEAD`.strip }
331
332
  end
333
+
334
+ def capture_output
335
+ fake_stdout = StringIO.new
336
+ actual_stdout = $stdout
337
+ $stdout = fake_stdout
338
+ yield
339
+ fake_stdout.rewind
340
+ fake_stdout.read
341
+ ensure
342
+ $stdout = actual_stdout
343
+ end
332
344
  end
333
345
  end
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.1
4
+ version: 1.6.2
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-02 00:00:00.000000000 Z
14
+ date: 2014-04-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ronn