bundler 1.1.pre.10 → 1.1.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.

@@ -7,6 +7,7 @@ script: rake spec:travis
7
7
  rvm:
8
8
  - 1.8.7
9
9
  - 1.9.2
10
+ - 1.9.3
10
11
 
11
12
  env:
12
13
  - RGV=v1.3.6
@@ -26,6 +27,12 @@ matrix:
26
27
  env: RGV=v1.3.7
27
28
  - rvm: 1.9.2
28
29
  env: RGV=v1.4.2
30
+ - rvm: 1.9.3
31
+ env: RGV=v1.3.6
32
+ - rvm: 1.9.3
33
+ env: RGV=v1.3.7
34
+ - rvm: 1.9.3
35
+ env: RGV=v1.4.2
29
36
 
30
37
  notifications:
31
38
  email:
@@ -1,3 +1,22 @@
1
+ ## 1.1.rc (Oct 3, 2011)
2
+
3
+ Features:
4
+
5
+ - add `--shebang` option to bundle install (@bensie, #1467)
6
+ - build passes on ruby 1.9.3rc1 (#1458, #1469)
7
+ - hide basic auth credentials for custom sources (#1440, #1463)
8
+
9
+ Bugfixes:
10
+
11
+ - fix index search result caching (#1446, #1466)
12
+ - fix fetcher prints multiple times during install (#1445, #1462)
13
+ - don't mention API errors from non-rubygems.org sources
14
+ - fix autoclean so it doesn't remove bins that are used (#1459, #1460)
15
+
16
+ Documentation:
17
+
18
+ - add :require => [...] to the gemfile(5) manpage (@nono, #1468)
19
+
1
20
  ## 1.1.pre.10 (Sep 27, 2011)
2
21
 
3
22
  Features:
@@ -131,6 +150,16 @@ Removed:
131
150
  - Removed bundle install --production
132
151
  - Removed bundle install --disable-shared-gems
133
152
 
153
+ ## 1.0.21 (September 30, 2011)
154
+
155
+ - No changes from RC
156
+
157
+ ## 1.0.21.rc (September 29, 2011)
158
+
159
+ Bugfixes:
160
+
161
+ - Load Psych unless Syck is defined, because 1.9.2 defines YAML
162
+
134
163
  ## 1.0.20 (September 27, 2011)
135
164
 
136
165
  Features:
@@ -139,7 +168,7 @@ Features:
139
168
 
140
169
  Bugfixes:
141
170
 
142
- - Ensure yaml is required even if psych is found
171
+ - Ensure YAML is required even if Psych is found
143
172
  - Handle directory names that contain invalid regex characters
144
173
 
145
174
  ## 1.0.20.rc (September 18, 2011)
data/Rakefile CHANGED
@@ -34,6 +34,13 @@ begin
34
34
  rm_rf 'tmp'
35
35
  end
36
36
 
37
+ desc "Run the real-world spec suite (reequires internet)"
38
+ task :realworld => ["set_realworld", "spec"]
39
+
40
+ task :set_realworld do
41
+ ENV['BUNDLER_REALWORLD_TESTS'] = '1'
42
+ end
43
+
37
44
  desc "Run the spec suite with the sudo tests"
38
45
  task :sudo => ["set_sudo", "spec", "clean_sudo"]
39
46
 
@@ -59,6 +66,7 @@ begin
59
66
  # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
60
67
  namespace rg do
61
68
  task :sudo => ["set_sudo", rg, "clean_sudo"]
69
+ task :realworld => ["set_realworld", rg]
62
70
  end
63
71
 
64
72
  task "clone_rubygems_#{rg}" do
@@ -96,33 +104,8 @@ begin
96
104
  task "rubygems:all" => "co"
97
105
  end
98
106
 
99
- namespace :ruby do
100
- # Ruby 1.8.6, 1.8.7, and 1.9.2 specs
101
- task "ensure_rvm" do
102
- raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
103
- end
104
-
105
- %w(1.8.6-p420 1.8.7-p334 1.9.2-p180).each do |ruby|
106
- ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
107
-
108
- desc "Run specs on Ruby #{ruby}"
109
- RSpec::Core::RakeTask.new(ruby) do |t|
110
- t.rspec_opts = %w(-fs --color)
111
- t.ruby_opts = %w(-w)
112
- end
113
-
114
- task "ensure_ruby_#{ruby}" do
115
- raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
116
- end
117
-
118
- task "ensure_ruby_#{ruby}" => "ensure_rvm"
119
- task ruby => "ensure_ruby_#{ruby}"
120
- task "ruby:all" => ruby
121
- end
122
- end
123
-
124
107
  desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
125
- task "travis" do
108
+ task :travis do
126
109
  rg = ENV['RGV'] || 'master'
127
110
 
128
111
  puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
@@ -133,7 +116,12 @@ begin
133
116
  puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
134
117
  sudos = safe_task { Rake::Task["spec:rubygems:#{rg}:sudo"].invoke }
135
118
 
136
- unless specs && sudos
119
+ Rake::Task["spec:rubygems:#{rg}"].reenable
120
+
121
+ puts "\n\e[1;33m[Travis CI] Running bundler real world specs against rubygems #{rg}\e[m\n\n"
122
+ realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke }
123
+
124
+ unless specs && sudos && realworld
137
125
  fail "Bundler tests failed, please review the log for more information"
138
126
  end
139
127
  end
@@ -4,12 +4,11 @@ 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?(Syck)
8
8
  rescue LoadError
9
- ensure
10
- require 'yaml'
11
9
  end
12
10
 
11
+ require 'yaml'
13
12
  require 'bundler/rubygems_ext'
14
13
  require 'bundler/rubygems_integration'
15
14
  require 'bundler/version'
@@ -19,17 +18,20 @@ module Bundler
19
18
 
20
19
  autoload :Definition, 'bundler/definition'
21
20
  autoload :Dependency, 'bundler/dependency'
21
+ autoload :DepProxy, 'bundler/dep_proxy'
22
22
  autoload :Dsl, 'bundler/dsl'
23
23
  autoload :EndpointSpecification, 'bundler/endpoint_specification'
24
24
  autoload :Environment, 'bundler/environment'
25
25
  autoload :Fetcher, 'bundler/fetcher'
26
26
  autoload :GemHelper, 'bundler/gem_helper'
27
+ autoload :GemHelpers, 'bundler/gem_helpers'
27
28
  autoload :GemInstaller, 'bundler/gem_installer'
28
29
  autoload :Graph, 'bundler/graph'
29
30
  autoload :Index, 'bundler/index'
30
31
  autoload :Installer, 'bundler/installer'
31
32
  autoload :LazySpecification, 'bundler/lazy_specification'
32
33
  autoload :LockfileParser, 'bundler/lockfile_parser'
34
+ autoload :MatchPlatform, 'bundler/match_platform'
33
35
  autoload :RemoteSpecification, 'bundler/remote_specification'
34
36
  autoload :Resolver, 'bundler/resolver'
35
37
  autoload :Runtime, 'bundler/runtime'
@@ -142,6 +142,8 @@ module Bundler
142
142
  "Do not attempt to fetch gems remotely and use the gem cache instead"
143
143
  method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
144
144
  "Generate bin stubs for bundled gems to ./bin"
145
+ method_option "shebang", :type => :string, :banner =>
146
+ "Specify a different shebang executable name than the default (usually 'ruby')"
145
147
  method_option "path", :type => :string, :banner =>
146
148
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
147
149
  method_option "system", :type => :boolean, :banner =>
@@ -204,6 +206,7 @@ module Bundler
204
206
  Bundler.settings[:path] = opts[:path] if opts[:path]
205
207
  Bundler.settings[:path] ||= "bundle" if opts[:standalone]
206
208
  Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
209
+ Bundler.settings[:shebang] = opts["shebang"] if opts[:shebang]
207
210
  Bundler.settings[:no_prune] = true if opts["no-prune"]
208
211
  Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
209
212
  Bundler.settings.without = opts[:without]
@@ -0,0 +1,35 @@
1
+ module Bundler
2
+ class DepProxy
3
+
4
+ attr_reader :required_by, :__platform, :dep
5
+
6
+ def initialize(dep, platform)
7
+ @dep, @__platform, @required_by = dep, platform, []
8
+ end
9
+
10
+ def hash
11
+ @hash ||= dep.hash
12
+ end
13
+
14
+ def ==(o)
15
+ dep == o.dep && __platform == o.__platform
16
+ end
17
+
18
+ alias eql? ==
19
+
20
+ def type
21
+ @dep.type
22
+ end
23
+
24
+ def to_s
25
+ "#{name} (#{requirement}) #{__platform}"
26
+ end
27
+
28
+ private
29
+
30
+ def method_missing(*args)
31
+ @dep.send(*args)
32
+ end
33
+
34
+ end
35
+ end
@@ -42,6 +42,17 @@ module Bundler
42
42
  end
43
43
  end
44
44
 
45
+ # needed for bundle clean
46
+ def bindir
47
+ if @remote_specification
48
+ @remote_specification.bindir
49
+ elsif _local_specification
50
+ _local_specification.bindir
51
+ else
52
+ super
53
+ end
54
+ end
55
+
45
56
  def _local_specification
46
57
  eval(File.read(local_specification_path)) if @loaded_from && File.exists?(local_specification_path)
47
58
  end
@@ -18,7 +18,7 @@ module Bundler
18
18
  if spec
19
19
  path = download_gem_from_uri(spec, uri)
20
20
  s = Bundler.rubygems.spec_from_gem(path)
21
- spec.__swap__(s) if spec.is_a?(RemoteSpecification)
21
+ spec.__swap__(s)
22
22
  end
23
23
  end
24
24
 
@@ -61,7 +61,36 @@ module Bundler
61
61
  def specs(gem_names, source)
62
62
  index = Index.new
63
63
 
64
- fetch_remote_specs(gem_names)[@remote_uri].each do |name, version, platform, dependencies|
64
+ if !gem_names || @remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
65
+ Bundler.ui.info "Fetching source index from #{strip_user_pass_from_uri(@remote_uri)}"
66
+ specs = fetch_all_remote_specs
67
+ else
68
+ Bundler.ui.info "Fetching gem metadata from #{strip_user_pass_from_uri(@remote_uri)}", Bundler.ui.debug?
69
+ begin
70
+ specs = fetch_remote_specs(gem_names)
71
+ # fall back to the legacy index in the following cases
72
+ # 1. Gemcutter Endpoint doesn't return a 200
73
+ # 2. Marshal blob doesn't load properly
74
+ # 3. One of the YAML gemspecs has the Syck::DefaultKey problem
75
+ rescue HTTPError, TypeError => e
76
+ # new line now that the dots are over
77
+ Bundler.ui.info "" unless Bundler.ui.debug?
78
+
79
+ if @remote_uri.to_s.include?("rubygems.org")
80
+ Bundler.ui.info "Error #{e.class} during request to dependency API"
81
+ end
82
+ Bundler.ui.debug e.message
83
+ Bundler.ui.debug e.backtrace
84
+
85
+ Bundler.ui.info "Fetching full source index from #{strip_user_pass_from_uri(@remote_uri)}"
86
+ specs = fetch_all_remote_specs
87
+ else
88
+ # new line now that the dots are over
89
+ Bundler.ui.info "" unless Bundler.ui.debug?
90
+ end
91
+ end
92
+
93
+ specs[@remote_uri].each do |name, version, platform, dependencies|
65
94
  next if name == 'bundler'
66
95
  spec = nil
67
96
  if dependencies
@@ -79,34 +108,21 @@ module Bundler
79
108
 
80
109
  # fetch index
81
110
  def fetch_remote_specs(gem_names, full_dependency_list = [], last_spec_list = [])
82
- return fetch_all_remote_specs if !gem_names || @remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
83
-
84
111
  query_list = gem_names - full_dependency_list
112
+
85
113
  # only display the message on the first run
86
- if full_dependency_list.empty?
87
- Bundler.ui.info "Fetching dependency information from the API at #{@remote_uri}", false
114
+ if Bundler.ui.debug?
115
+ Bundler.ui.debug "Query List: #{query_list.inspect}"
88
116
  else
89
117
  Bundler.ui.info ".", false
90
118
  end
91
119
 
92
- Bundler.ui.debug "Query List: #{query_list.inspect}"
93
- if query_list.empty?
94
- Bundler.ui.info "\n"
95
- return {@remote_uri => last_spec_list}
96
- end
120
+ return {@remote_uri => last_spec_list} if query_list.empty?
97
121
 
98
122
  spec_list, deps_list = fetch_dependency_remote_specs(query_list)
99
123
  returned_gems = spec_list.map {|spec| spec.first }.uniq
100
124
 
101
125
  fetch_remote_specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list)
102
- # fall back to the legacy index in the following cases
103
- # 1.) Gemcutter Endpoint doesn't return a 200
104
- # 2.) Marshal blob doesn't load properly
105
- rescue HTTPError, TypeError => e
106
- Bundler.ui.info "\nError using the API"
107
- Bundler.ui.debug "Error #{e.class} from Gemcutter Dependency Endpoint API: #{e.message}"
108
- Bundler.ui.debug e.backtrace
109
- fetch_all_remote_specs
110
126
  end
111
127
 
112
128
  private
@@ -176,8 +192,6 @@ module Bundler
176
192
  # fetch from modern index: specs.4.8.gz
177
193
  def fetch_all_remote_specs
178
194
  @has_api = false
179
- Bundler.ui.info "Fetching source index for #{@remote_uri}"
180
- Bundler.ui.debug "Fetching modern index"
181
195
  Gem.sources = ["#{@remote_uri}"]
182
196
  spec_list = Hash.new { |h,k| h[k] = [] }
183
197
  begin
@@ -187,13 +201,21 @@ module Bundler
187
201
  begin
188
202
  Gem::SpecFetcher.new.list(false, true).each {|k, v| spec_list[k] += v }
189
203
  rescue Gem::RemoteFetcher::FetchError
190
- Bundler.ui.warn "Could not fetch prerelease specs from #{@remote_uri}"
204
+ Bundler.ui.debug "Could not fetch prerelease specs from #{strip_user_pass_from_uri(@remote_uri)}"
191
205
  end
192
206
  rescue Gem::RemoteFetcher::FetchError
193
- raise Bundler::HTTPError, "Could not reach #{@remote_uri}"
207
+ raise Bundler::HTTPError, "Could not reach #{strip_user_pass_from_uri(@remote_uri)}"
194
208
  end
195
209
 
196
210
  return spec_list
197
211
  end
212
+
213
+ def strip_user_pass_from_uri(uri)
214
+ uri_dup = uri.dup
215
+ uri_dup.user = "****" if uri_dup.user
216
+ uri_dup.password = "****" if uri_dup.password
217
+
218
+ uri_dup
219
+ end
198
220
  end
199
221
  end
@@ -0,0 +1,23 @@
1
+ module Bundler
2
+ module GemHelpers
3
+
4
+ GENERIC_CACHE = {}
5
+ GENERICS = [
6
+ Gem::Platform.new('java'),
7
+ Gem::Platform.new('mswin32'),
8
+ Gem::Platform.new('x86-mingw32'),
9
+ Gem::Platform::RUBY
10
+ ]
11
+
12
+ def generic(p)
13
+ return p if p == Gem::Platform::RUBY
14
+
15
+ GENERIC_CACHE[p] ||= begin
16
+ found = GENERICS.find do |p2|
17
+ p2.is_a?(Gem::Platform) && p.os == p2.os
18
+ end
19
+ found || Gem::Platform::RUBY
20
+ end
21
+ end
22
+ end
23
+ end
@@ -130,7 +130,7 @@ module Bundler
130
130
  end
131
131
 
132
132
  def search_by_dependency(dependency, base = nil)
133
- @cache[dependency.hash] ||= begin
133
+ @cache[dependency.hash^base.hash] ||= begin
134
134
  specs = specs_by_name(dependency.name) + (base || [])
135
135
  found = specs.select do |spec|
136
136
  if base # allow all platforms when searching from a lockfile
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_helpers'
2
+
3
+ module Bundler
4
+ module MatchPlatform
5
+ include GemHelpers
6
+
7
+ def match_platform(p)
8
+ Gem::Platform::RUBY == platform or
9
+ platform.nil? or p == platform or
10
+ generic(Gem::Platform.new(platform)) == p
11
+ end
12
+ end
13
+ end
@@ -364,28 +364,25 @@ module Bundler
364
364
  d = dep.dep
365
365
  end
366
366
 
367
- key = "#{d}-#{dep.__platform}"
368
- return @deps_for[key] if @deps_for[key]
369
-
370
- index = @source_requirements[d.name] || @index
371
- results = index.search(d, @base[d.name])
372
-
373
- if results.any?
374
- version = results.first.version
375
- nested = [[]]
376
- results.each do |spec|
377
- if spec.version != version
378
- nested << []
379
- version = spec.version
367
+ @deps_for[d.hash] ||= begin
368
+ index = @source_requirements[d.name] || @index
369
+ results = index.search(d, @base[d.name])
370
+
371
+ if results.any?
372
+ version = results.first.version
373
+ nested = [[]]
374
+ results.each do |spec|
375
+ if spec.version != version
376
+ nested << []
377
+ version = spec.version
378
+ end
379
+ nested.last << spec
380
380
  end
381
- nested.last << spec
381
+ deps = nested.map{|a| SpecGroup.new(a) }.select{|sg| sg.for?(dep.__platform) }
382
+ else
383
+ deps = []
382
384
  end
383
- deps = nested.map{|a| SpecGroup.new(a) }.select{|sg| sg.for?(dep.__platform) }
384
- else
385
- deps = []
386
385
  end
387
-
388
- @deps_for[key] = deps
389
386
  end
390
387
 
391
388
  def clean_req(req)