bundler 1.1.pre.9 → 1.1.pre.10

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.1.pre.10 (Sep 27, 2011)
2
+
3
+ Features:
4
+
5
+ - `config system_bindir foo` added, works like "-n foo" in your .gemrc file
6
+
1
7
  ## 1.1.pre.9 (Sep 18, 2011)
2
8
 
3
9
  Features:
@@ -125,6 +131,17 @@ Removed:
125
131
  - Removed bundle install --production
126
132
  - Removed bundle install --disable-shared-gems
127
133
 
134
+ ## 1.0.20 (September 27, 2011)
135
+
136
+ Features:
137
+
138
+ - Add platform :maglev (@timfel, #1444)
139
+
140
+ Bugfixes:
141
+
142
+ - Ensure yaml is required even if psych is found
143
+ - Handle directory names that contain invalid regex characters
144
+
128
145
  ## 1.0.20.rc (September 18, 2011)
129
146
 
130
147
  Features:
data/lib/bundler.rb CHANGED
@@ -4,8 +4,9 @@ require 'pathname'
4
4
 
5
5
  begin
6
6
  # Pull in Psych if we can, but not if Syck is already loaded
7
- require 'psych' unless defined?(YAML)
7
+ require 'psych' unless defined?(::YAML)
8
8
  rescue LoadError
9
+ ensure
9
10
  require 'yaml'
10
11
  end
11
12
 
@@ -219,18 +220,27 @@ module Bundler
219
220
  SharedHelpers.default_lockfile
220
221
  end
221
222
 
223
+ def system_bindir
224
+ # Gem.bindir doesn't always return the location that Rubygems will install
225
+ # system binaries. If you put '-n foo' in your .gemrc, Rubygems will
226
+ # install binstubs there instead. Unfortunately, Rubygems doesn't expose
227
+ # that directory at all, so rather than parse .gemrc ourselves, we allow
228
+ # the directory to be set as well, via `bundle config bindir foo`.
229
+ Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
230
+ end
231
+
222
232
  def requires_sudo?
223
233
  return @requires_sudo if defined?(@checked_for_sudo)
224
234
 
225
235
  path = bundle_path
226
236
  path = path.parent until path.exist?
227
237
  sudo_present = !(`which sudo` rescue '').empty?
228
- bin_dir = Pathname.new(Bundler.rubygems.gem_bindir)
238
+ bin_dir = Pathname.new(Bundler.system_bindir)
229
239
  bin_dir = bin_dir.parent until bin_dir.exist?
230
240
 
231
241
  @checked_for_sudo = true
232
- can_write_gems = !File.writable?(path) || !File.writable?(bin_dir)
233
- @requires_sudo = settings.allow_sudo? && can_write_gems && sudo_present
242
+ sudo_gems = !File.writable?(path) || !File.writable?(bin_dir)
243
+ @requires_sudo = settings.allow_sudo? && sudo_gems && sudo_present
234
244
  end
235
245
 
236
246
  def mkdir_p(path)
data/lib/bundler/cli.rb CHANGED
@@ -217,7 +217,8 @@ module Bundler
217
217
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
218
218
 
219
219
  if Bundler.settings[:path]
220
- relative_path = File.expand_path(Bundler.settings[:path]).sub(/^#{File.expand_path('.')}/, '.')
220
+ absolute_path = File.expand_path(Bundler.settings[:path])
221
+ relative_path = absolute_path.sub(File.expand_path('.'), '.')
221
222
  Bundler.ui.confirm "Your bundle is complete! " +
222
223
  "It was installed into #{relative_path}"
223
224
  else
@@ -79,7 +79,7 @@ module Bundler
79
79
  private
80
80
 
81
81
  def ruby?
82
- !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx")
82
+ !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev")
83
83
  end
84
84
 
85
85
  def ruby_18?
@@ -110,6 +110,10 @@ module Bundler
110
110
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
111
111
  end
112
112
 
113
+ def maglev?
114
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == "maglev"
115
+ end
116
+
113
117
  def mswin?
114
118
  Bundler::WINDOWS
115
119
  end
@@ -32,7 +32,7 @@ module Bundler
32
32
  Bundler.rubygems.download_gem(spec, uri, download_path)
33
33
 
34
34
  if Bundler.requires_sudo?
35
- Bundler.sudo "mkdir -p #{Bundler.rubygems.gem_dir}/cache"
35
+ Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/cache"
36
36
  Bundler.sudo "mv #{Bundler.tmp}/cache/#{spec.full_name}.gem #{gem_path}"
37
37
  end
38
38
 
@@ -179,15 +179,15 @@ module Bundler
179
179
  activated[a.name] ? 0 : gems_size(a) ]
180
180
  end
181
181
 
182
- debug { "Activated:\n" + activated.values.map { |a| " #{a.name} (#{a.version})" }.join("\n") }
183
- debug { "Requirements:\n" + reqs.map { |r| " #{r.name} (#{r.requirement})"}.join("\n") }
182
+ debug { "Activated:\n" + activated.values.map {|a| " #{a}" }.join("\n") }
183
+ debug { "Requirements:\n" + reqs.map {|r| " #{r}"}.join("\n") }
184
184
 
185
185
  activated = activated.dup
186
186
 
187
187
  # Pull off the first requirement so that we can resolve it
188
188
  current = reqs.shift
189
189
 
190
- debug { "Attempting:\n #{current.name} (#{current.requirement})"}
190
+ debug { "Attempting:\n #{current}"}
191
191
 
192
192
  # Check if the gem has already been activated, if it has, we will make sure
193
193
  # that the currently activated gem satisfies the requirement.
@@ -170,7 +170,7 @@ module Bundler
170
170
  end
171
171
 
172
172
  def to_s
173
- @dep.to_s
173
+ "#{name} (#{requirement}) #{__platform}"
174
174
  end
175
175
 
176
176
  private
@@ -50,12 +50,7 @@ module Bundler
50
50
  end
51
51
 
52
52
  def gem_bindir
53
- # We use Gem.dir/bin because on OS X, Gem.bindir is hardcoded to return
54
- # /usr/bin, a directory owned by root. Users who chown Gem.dir need bins
55
- # to be installed where they have permissions. Furthermore, the official
56
- # solution to change the bindir is adding -n to .gemrc, but Rubygems does
57
- # not honor the -n option in either Gem.bindir or Installer.new.bindir.
58
- File.join Gem.dir, "bin"
53
+ Gem.bindir
59
54
  end
60
55
 
61
56
  def user_home
@@ -21,7 +21,7 @@ module Bundler
21
21
 
22
22
  if activated_spec = Bundler.rubygems.loaded_specs(spec.name) and activated_spec.version != spec.version
23
23
  e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
24
- "but your Gemfile requires #{spec.name} #{spec.version}. Consider using bundle exec."
24
+ "but your Gemfile requires #{spec.name} #{spec.version}. Using bundle exec may solve this."
25
25
  e.name = spec.name
26
26
  if e.respond_to?(:requirement=)
27
27
  e.requirement = Gem::Requirement.new(spec.version.to_s)
@@ -78,15 +78,21 @@ module Bundler
78
78
 
79
79
  Bundler.ui.info "Installing #{spec.name} (#{spec.version}) "
80
80
  path = cached_gem(spec)
81
- install_path = Bundler.requires_sudo? ? Bundler.tmp : Bundler.rubygems.gem_dir
81
+ if Bundler.requires_sudo?
82
+ install_path = Bundler.tmp
83
+ bin_path = install_path.join("bin")
84
+ else
85
+ install_path = Bundler.rubygems.gem_dir
86
+ bin_path = Bundler.system_bindir
87
+ end
82
88
 
83
89
  Bundler.rubygems.preserve_paths do
84
90
  Bundler::GemInstaller.new(path,
85
- :install_dir => install_path,
91
+ :install_dir => install_path.to_s,
92
+ :bin_dir => bin_path.to_s,
86
93
  :ignore_dependencies => true,
87
94
  :wrappers => true,
88
- :env_shebang => true,
89
- :bin_dir => "#{install_path}/bin"
95
+ :env_shebang => true
90
96
  ).install
91
97
  end
92
98
 
@@ -96,12 +102,13 @@ module Bundler
96
102
 
97
103
  # SUDO HAX
98
104
  if Bundler.requires_sudo?
99
- Bundler.sudo "mkdir -p #{Bundler.rubygems.gem_dir}/gems #{Bundler.rubygems.gem_dir}/specifications"
105
+ Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/gems"
106
+ Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/specifications"
100
107
  Bundler.sudo "cp -R #{Bundler.tmp}/gems/#{spec.full_name} #{Bundler.rubygems.gem_dir}/gems/"
101
108
  Bundler.sudo "cp -R #{Bundler.tmp}/specifications/#{spec.full_name}.gemspec #{Bundler.rubygems.gem_dir}/specifications/"
102
109
  spec.executables.each do |exe|
103
- Bundler.sudo "mkdir -p #{Bundler.rubygems.gem_bindir}"
104
- Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.rubygems.gem_bindir}"
110
+ Bundler.mkdir_p Bundler.system_bindir
111
+ Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.system_bindir}"
105
112
  end
106
113
  end
107
114
 
@@ -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.1.pre.9" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.pre.10" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -259,7 +259,7 @@ describe "gemcutter's dependency API" do
259
259
  end
260
260
 
261
261
  it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
262
- sys_exec "mkdir -p #{system_gem_path("bin")}"
262
+ sudo "mkdir -p #{system_gem_path("bin")}"
263
263
  sudo "chown -R root #{system_gem_path("bin")}"
264
264
 
265
265
  gemfile <<-G
@@ -199,8 +199,8 @@ describe "bundle flex_install" do
199
199
  rack (0.9.1)
200
200
 
201
201
  In Gemfile:
202
- rack-obama (= 2.0) depends on
203
- rack (= 1.2)
202
+ rack-obama (= 2.0) ruby depends on
203
+ rack (= 1.2) ruby
204
204
 
205
205
  Running `bundle update` will rebuild your snapshot from scratch, using only
206
206
  the gems in your Gemfile, which may resolve the conflict.
@@ -491,6 +491,18 @@ describe "bundle install with gem sources" do
491
491
  should_be_installed "rack 1.0.0"
492
492
  end
493
493
 
494
+ it "handles paths with regex characters in them" do
495
+ dir = bundled_app("bun++dle")
496
+ dir.mkpath
497
+
498
+ Dir.chdir(dir) do
499
+ bundle "install --path vendor/bundle"
500
+ out.should include("installed into ./vendor/bundle")
501
+ end
502
+
503
+ dir.rmtree
504
+ end
505
+
494
506
  it "prints a warning to let the user know what has happened with bundle --path vendor/bundle" do
495
507
  bundle "install --path vendor/bundle"
496
508
  out.should include("It was installed into ./vendor")
@@ -601,7 +613,7 @@ describe "bundle install with gem sources" do
601
613
  Fetching source index for file:#{gem_repo2}/
602
614
  Bundler could not find compatible versions for gem "bundler":
603
615
  In Gemfile:
604
- bundler (= 0.9.2)
616
+ bundler (= 0.9.2) ruby
605
617
 
606
618
  Current Bundler version:
607
619
  bundler (#{Bundler::VERSION})
@@ -658,10 +670,10 @@ describe "bundle install with gem sources" do
658
670
  Fetching source index for file:#{gem_repo2}/
659
671
  Bundler could not find compatible versions for gem "activesupport":
660
672
  In Gemfile:
661
- activemerchant depends on
662
- activesupport (>= 2.0.0)
673
+ activemerchant (>= 0) ruby depends on
674
+ activesupport (>= 2.0.0) ruby
663
675
 
664
- rails_fail depends on
676
+ rails_fail (>= 0) ruby depends on
665
677
  activesupport (1.2.3)
666
678
  E
667
679
  out.should == nice_error
@@ -678,8 +690,8 @@ describe "bundle install with gem sources" do
678
690
  Fetching source index for file:#{gem_repo2}/
679
691
  Bundler could not find compatible versions for gem "activesupport":
680
692
  In Gemfile:
681
- rails_fail depends on
682
- activesupport (= 1.2.3)
693
+ rails_fail (>= 0) ruby depends on
694
+ activesupport (= 1.2.3) ruby
683
695
 
684
696
  activesupport (2.3.5)
685
697
  E
@@ -733,22 +745,22 @@ describe "bundle install with gem sources" do
733
745
  end
734
746
  end
735
747
 
736
- describe "when Gem.bindir is hardcoded to a root-owned directory" do
737
- # On OS X, Gem.bindir is hardcoded to /usr/bin. :(
738
- it "installs binstubs into Gem.dir+'/bin' instead" do
748
+ describe "when system_bindir is set" do
749
+ # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
750
+ # you want to avoid sudo installs for system gems with OS X's default ruby
751
+ it "overrides Gem.bindir" do
739
752
  Pathname.new("/usr/bin").should_not be_writable
740
-
741
753
  gemfile <<-G
742
754
  require 'rubygems'
743
- def Gem.bindir(dir=Gem.dir); "/usr/bin"; end
744
-
755
+ def Gem.bindir; "/usr/bin"; end
745
756
  source "file://#{gem_repo1}"
746
757
  gem "rack"
747
758
  G
748
759
 
760
+ config "BUNDLE_SYSTEM_BINDIR" => system_gem_path('altbin').to_s
749
761
  bundle :install
750
762
  should_be_installed "rack 1.0.0"
751
- system_gem_path("bin/rackup").should exist
763
+ system_gem_path("altbin/rackup").should exist
752
764
  end
753
765
  end
754
766
 
@@ -403,7 +403,7 @@ describe "bundle install with git sources" do
403
403
  gem "has_submodule"
404
404
  end
405
405
  G
406
- out.should =~ /could not find gem 'submodule'/i
406
+ out.should =~ /could not find gem 'submodule/i
407
407
 
408
408
  should_not_be_installed "has_submodule 1.0", :expect_err => true
409
409
  end
@@ -450,7 +450,7 @@ describe "Bundler.setup" do
450
450
  end
451
451
  R
452
452
 
453
- out.should == "You have already activated thin 1.1, but your Gemfile requires thin 1.0. Consider using bundle exec."
453
+ out.should == "You have already activated thin 1.1, but your Gemfile requires thin 1.0. Using bundle exec may solve this."
454
454
  end
455
455
 
456
456
  it "version_requirement is now deprecated in rubygems 1.4.0+" do
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,13 @@
1
1
  $:.unshift File.expand_path('..', __FILE__)
2
2
  $:.unshift File.expand_path('../../lib', __FILE__)
3
3
 
4
+ begin
5
+ require 'psych'
6
+ rescue LoadError
7
+ ensure
8
+ require 'yaml'
9
+ end
10
+
4
11
  require 'fileutils'
5
12
  require 'rubygems'
6
13
  require 'bundler'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923831891
4
+ hash: 1923831893
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - pre
10
- - 9
11
- version: 1.1.pre.9
10
+ - 10
11
+ version: 1.1.pre.10
12
12
  platform: ruby
13
13
  authors:
14
14
  - "Andr\xC3\xA9 Arko"
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2011-09-19 00:00:00 -07:00
22
+ date: 2011-09-27 00:00:00 -07:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency