bundler 1.1.pre.5 → 1.1.pre.7

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.

Files changed (66) hide show
  1. data/CHANGELOG.md +52 -1
  2. data/ISSUES.md +1 -0
  3. data/Rakefile +3 -3
  4. data/UPGRADING.md +2 -2
  5. data/lib/bundler/cli.rb +6 -5
  6. data/lib/bundler/definition.rb +13 -2
  7. data/lib/bundler/endpoint_specification.rb +19 -0
  8. data/lib/bundler/fetcher.rb +34 -2
  9. data/lib/bundler/gem_helper.rb +6 -4
  10. data/lib/bundler/index.rb +29 -4
  11. data/lib/bundler/installer.rb +2 -1
  12. data/lib/bundler/lazy_specification.rb +4 -2
  13. data/lib/bundler/resolver.rb +14 -16
  14. data/lib/bundler/rubygems_ext.rb +1 -0
  15. data/lib/bundler/rubygems_integration.rb +22 -2
  16. data/lib/bundler/runtime.rb +2 -0
  17. data/lib/bundler/source.rb +52 -44
  18. data/lib/bundler/spec_set.rb +10 -9
  19. data/lib/bundler/templates/newgem/Rakefile.tt +1 -1
  20. data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  21. data/lib/bundler/vendor/thor.rb +43 -4
  22. data/lib/bundler/vendor/thor/actions.rb +28 -11
  23. data/lib/bundler/vendor/thor/actions/create_file.rb +2 -2
  24. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  25. data/lib/bundler/vendor/thor/actions/directory.rb +2 -2
  26. data/lib/bundler/vendor/thor/actions/empty_directory.rb +0 -0
  27. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +56 -15
  28. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +13 -8
  29. data/lib/bundler/vendor/thor/base.rb +24 -4
  30. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +0 -0
  31. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +0 -0
  32. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +0 -0
  33. data/lib/bundler/vendor/thor/error.rb +0 -0
  34. data/lib/bundler/vendor/thor/group.rb +273 -0
  35. data/lib/bundler/vendor/thor/invocation.rb +0 -0
  36. data/lib/bundler/vendor/thor/parser.rb +0 -0
  37. data/lib/bundler/vendor/thor/parser/argument.rb +0 -0
  38. data/lib/bundler/vendor/thor/parser/arguments.rb +2 -2
  39. data/lib/bundler/vendor/thor/parser/option.rb +0 -0
  40. data/lib/bundler/vendor/thor/parser/options.rb +17 -16
  41. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  42. data/lib/bundler/vendor/thor/runner.rb +309 -0
  43. data/lib/bundler/vendor/thor/shell.rb +0 -0
  44. data/lib/bundler/vendor/thor/shell/basic.rb +40 -13
  45. data/lib/bundler/vendor/thor/shell/color.rb +0 -0
  46. data/lib/bundler/vendor/thor/task.rb +3 -4
  47. data/lib/bundler/vendor/thor/util.rb +2 -2
  48. data/lib/bundler/vendor/thor/version.rb +1 -1
  49. data/lib/bundler/version.rb +1 -1
  50. data/man/gemfile.5.ronn +3 -0
  51. data/spec/cache/git_spec.rb +5 -2
  52. data/spec/install/gems/dependency_api_spec.rb +69 -0
  53. data/spec/install/gems/simple_case_spec.rb +7 -0
  54. data/spec/install/gems/standalone_spec.rb +62 -0
  55. data/spec/install/git_spec.rb +63 -1
  56. data/spec/other/clean_spec.rb +22 -26
  57. data/spec/other/exec_spec.rb +2 -2
  58. data/spec/other/gem_helper_spec.rb +1 -1
  59. data/spec/runtime/setup_spec.rb +1 -1
  60. data/spec/support/artifice/endpoint.rb +2 -2
  61. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  62. data/spec/support/artifice/endpoint_extra.rb +27 -0
  63. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  64. data/spec/support/helpers.rb +7 -6
  65. metadata +73 -40
  66. data/spec/pack/gems_spec.rb +0 -22
@@ -1,3 +1,26 @@
1
+ ## 1.1.pre.7 (Aug 8, 2011)
2
+
3
+ Bugfixes:
4
+
5
+ - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341)
6
+
7
+ ## 1.1.pre.6 (Aug 8, 2011)
8
+
9
+ Bugfixes:
10
+
11
+ - Fix cross repository dependencies (#1138)
12
+ - Fix git dependency fetching from API endpoint (#1254)
13
+ - Fixes for bundle outdated (@joelmoss, #1238)
14
+ - Fix bundle standalone when using the endpoint (#1240)
15
+
16
+ Features:
17
+
18
+ - Implement `to_ary` to avoid calls to method_missing (@tenderlove, #1274)
19
+ - bundle clean removes old .gem files (@cldwalker, #1293)
20
+ - Correcly identify missing child dependency in error message
21
+ - Run pre-install, post-build, and post-install gem hooks for git gems (@warhammerkid, #1120)
22
+ - create Gemfile.lock for empty Gemfile (#1218)
23
+
1
24
  ## 1.1.pre.5 (June 11, 2011)
2
25
 
3
26
  Bugfixes:
@@ -66,7 +89,35 @@ Removed:
66
89
  - Removed bundle install <path>
67
90
  - Removed bundle install --production
68
91
  - Removed bundle install --disable-shared-gems
69
- =======
92
+
93
+ ## 1.0.17 (Aug 8, 2011)
94
+
95
+ Bugfixes:
96
+
97
+ - Fix rake issues with rubygems 1.3.x (#1342)
98
+ - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341)
99
+
100
+ ## 1.0.16 (Aug 8, 2011)
101
+
102
+ Features:
103
+
104
+ - Performance fix for MRI 1.9 (@efficientcloud, #1288)
105
+ - Shortcuts (like `bundle i`) for all commands (@amatsuda)
106
+ - Correcly identify missing child dependency in error message
107
+
108
+ Bugfixes:
109
+
110
+ - Allow Windows network share paths with forward slashes (@mtscout6, #1253)
111
+ - Check for rubygems.org credentials so `rake release` doesn't hang (#980)
112
+ - Find cached prerelease gems on rubygems 1.3.x (@dburt, #1202)
113
+ - Fix `bundle install --without` on kiji (@tmm1, #1287)
114
+ - Get rid of warning in ruby 1.9.3 (@smartinez87, #1231)
115
+
116
+ Documentation:
117
+
118
+ - Documentation for `gem ..., :require => false` (@kmayer, #1292)
119
+ - Gems provide "executables", they are rarely also binaries (@fxn, #1242)
120
+
70
121
  ## 1.0.15 (June 9, 2011)
71
122
 
72
123
  Features:
data/ISSUES.md CHANGED
@@ -50,6 +50,7 @@ Instructions that allow the Bundler team to reproduce your issue are vitally imp
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
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
53
54
 
54
55
 
55
56
  If you are using Rails 2.3, please also include:
data/Rakefile CHANGED
@@ -40,9 +40,9 @@ begin
40
40
  end
41
41
 
42
42
  namespace :rubygems do
43
- # Rubygems 1.3.5, 1.3.6, and HEAD specs
43
+ # Rubygems specs by version
44
44
  rubyopt = ENV["RUBYOPT"]
45
- %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.3).each do |rg|
45
+ %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.7).each do |rg|
46
46
  desc "Run specs with Rubygems #{rg}"
47
47
  RSpec::Core::RakeTask.new(rg) do |t|
48
48
  t.rspec_opts = %w(-fs --color)
@@ -95,7 +95,7 @@ begin
95
95
  raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
96
96
  end
97
97
 
98
- %w(1.8.6-p399 1.8.7-p302 1.9.2-p0).each do |ruby|
98
+ %w(1.8.6-p420 1.8.7-p334 1.9.2-p180).each do |ruby|
99
99
  ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
100
100
 
101
101
  desc "Run specs on Ruby #{ruby}"
@@ -61,8 +61,8 @@ Bundler 0.9 removes the following Bundler 0.8 Gemfile APIs:
61
61
  via `bundle install /path/to/bundle`. Bundler will remember
62
62
  where you installed the dependencies to on a particular
63
63
  machine for future installs, loads, setups, etc.
64
- 5. `bin_path`: Bundler no longer generates binaries in the root
65
- of your app. You should use `bundle exec` to execute binaries
64
+ 5. `bin_path`: Bundler no longer generates executables in the root
65
+ of your app. You should use `bundle exec` to execute executables
66
66
  in the current context.
67
67
 
68
68
  ### Gemfile Changes
@@ -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! unless ARGV.include?("exec") || ARGV.include?("config")
17
+ check_unknown_options!
18
18
 
19
19
  default_task :install
20
20
  class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
@@ -158,10 +158,10 @@ module Bundler
158
158
  opts = options.dup
159
159
  opts[:without] ||= []
160
160
  if opts[:without].size == 1
161
- opts[:without].map!{|g| g.split(" ") }
161
+ opts[:without] = opts[:without].map{|g| g.split(" ") }
162
162
  opts[:without].flatten!
163
163
  end
164
- opts[:without].map!{|g| g.to_sym }
164
+ opts[:without] = opts[:without].map{|g| g.to_sym }
165
165
 
166
166
  # Can't use Bundler.settings for this because settings needs gemfile.dirname
167
167
  ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
@@ -308,8 +308,9 @@ module Bundler
308
308
 
309
309
  spec.source.fetch(spec) if spec.source.respond_to?(:fetch)
310
310
 
311
- if spec.git_version
311
+ if spec.source.is_a?(Bundler::Source::Git)
312
312
  current = current_specs.find{|s| spec.name == s.name }
313
+ next if current.nil?
313
314
  else
314
315
  current = spec
315
316
  spec = definition.index[current.name].sort_by{|b| b.version }
@@ -381,7 +382,7 @@ module Bundler
381
382
  exit 126
382
383
  rescue Errno::ENOENT
383
384
  Bundler.ui.error "bundler: command not found: #{ARGV.first}"
384
- Bundler.ui.warn "Install missing gem binaries with `bundle install`"
385
+ Bundler.ui.warn "Install missing gem executables with `bundle install`"
385
386
  exit 127
386
387
  end
387
388
  end
@@ -159,8 +159,19 @@ module Bundler
159
159
 
160
160
  def index
161
161
  @index ||= Index.build do |idx|
162
- @sources.each do |s|
163
- s.dependencies = @dependencies if s.is_a?(Bundler::Source::Rubygems)
162
+ other_sources = @sources.find_all{|s| !s.is_a?(Bundler::Source::Rubygems) }
163
+ rubygems_sources = @sources.find_all{|s| s.is_a?(Bundler::Source::Rubygems) }
164
+
165
+ dependency_names = @dependencies.dup || []
166
+ dependency_names.map! {|d| d.name }
167
+ other_sources.each do |s|
168
+ source_index = s.specs
169
+ dependency_names += source_index.unmet_dependency_names
170
+ idx.add_source source_index
171
+ end
172
+
173
+ rubygems_sources.each do |s|
174
+ s.dependency_names = dependency_names.uniq if s.is_a?(Bundler::Source::Rubygems)
164
175
  idx.add_source s.specs
165
176
  end
166
177
  end
@@ -18,5 +18,24 @@ module Bundler
18
18
  def fetch_platform
19
19
  @plaftorm
20
20
  end
21
+
22
+ # needed for standalone, load required_paths from local gemspec
23
+ # after the gem in installed
24
+ def require_paths
25
+ if _local_specification
26
+ _local_specification.require_paths
27
+ else
28
+ super
29
+ end
30
+ end
31
+
32
+ def _local_specification
33
+ eval(File.read(local_specification_path)) if @loaded_from && File.exists?(local_specification_path)
34
+ end
35
+
36
+ private
37
+ def local_specification_path
38
+ "#{installation_path}/specifications/#{full_name}.gemspec"
39
+ end
21
40
  end
22
41
  end
@@ -6,12 +6,43 @@ module Bundler
6
6
  class Fetcher
7
7
  REDIRECT_LIMIT = 5
8
8
 
9
+ attr_reader :has_api
10
+
9
11
  class << self
10
12
  attr_accessor :disable_endpoint
13
+
14
+ @@spec_fetch_map ||= {}
15
+
16
+ def fetch(spec)
17
+ spec, uri = @@spec_fetch_map[spec.full_name]
18
+ if spec
19
+ path = download_gem_from_uri(spec, uri)
20
+ s = Bundler.rubygems.spec_from_gem(path)
21
+ spec.__swap__(s) if spec.is_a?(RemoteSpecification)
22
+ end
23
+ end
24
+
25
+ def download_gem_from_uri(spec, uri)
26
+ spec.fetch_platform
27
+
28
+ download_path = Bundler.requires_sudo? ? Bundler.tmp : Bundler.rubygems.gem_dir
29
+ gem_path = "#{Bundler.rubygems.gem_dir}/cache/#{spec.full_name}.gem"
30
+
31
+ FileUtils.mkdir_p("#{download_path}/cache")
32
+ Bundler.rubygems.download_gem(spec, uri, download_path)
33
+
34
+ if Bundler.requires_sudo?
35
+ Bundler.sudo "mkdir -p #{Bundler.rubygems.gem_dir}/cache"
36
+ Bundler.sudo "mv #{Bundler.tmp}/cache/#{spec.full_name}.gem #{gem_path}"
37
+ end
38
+
39
+ gem_path
40
+ end
11
41
  end
12
42
 
13
43
  def initialize(remote_uri)
14
44
  @remote_uri = remote_uri
45
+ @has_api = true # will be set to false if the rubygems index is ever fetched
15
46
  @@connection ||= Net::HTTP::Persistent.new nil, :ENV
16
47
  end
17
48
 
@@ -27,7 +58,7 @@ module Bundler
27
58
  end
28
59
 
29
60
  # return the specs in the bundler format as an index
30
- def specs(gem_names, source, spec_fetch_map)
61
+ def specs(gem_names, source)
31
62
  index = Index.new
32
63
 
33
64
  fetch_remote_specs(gem_names)[@remote_uri].each do |name, version, platform, dependencies|
@@ -39,7 +70,7 @@ module Bundler
39
70
  spec = RemoteSpecification.new(name, version, platform, self)
40
71
  end
41
72
  spec.source = source
42
- spec_fetch_map[spec.full_name] = [spec, @remote_uri]
73
+ @@spec_fetch_map[spec.full_name] = [spec, @remote_uri]
43
74
  index << spec
44
75
  end
45
76
 
@@ -132,6 +163,7 @@ module Bundler
132
163
 
133
164
  # fetch from modern index: specs.4.8.gz
134
165
  def fetch_all_remote_specs
166
+ @has_api = false
135
167
  Bundler.ui.info "Fetching source index for #{@remote_uri}"
136
168
  Bundler.ui.debug "Fetching modern index"
137
169
  Gem.sources = ["#{@remote_uri}"]
@@ -42,7 +42,6 @@ module Bundler
42
42
  def build_gem
43
43
  file_name = nil
44
44
  sh("gem build '#{spec_path}'") { |out, code|
45
- raise out unless out[/Successfully/]
46
45
  file_name = File.basename(built_gem_path)
47
46
  FileUtils.mkdir_p(File.join(base, 'pkg'))
48
47
  FileUtils.mv(built_gem_path, 'pkg')
@@ -70,9 +69,12 @@ module Bundler
70
69
 
71
70
  protected
72
71
  def rubygem_push(path)
73
- out, _ = sh("gem push '#{path}'")
74
- raise "Gem push failed due to lack of RubyGems.org credentials." if out[/Enter your RubyGems.org credentials/]
75
- Bundler.ui.confirm "Pushed #{name} #{version} to rubygems.org"
72
+ if Pathname.new("~/.gem/credentials").expand_path.exist?
73
+ sh("gem push '#{path}'")
74
+ Bundler.ui.confirm "Pushed #{name} #{version} to rubygems.org"
75
+ else
76
+ raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
77
+ end
76
78
  end
77
79
 
78
80
  def built_gem_path
@@ -28,6 +28,10 @@ module Bundler
28
28
  end
29
29
  end
30
30
 
31
+ def inspect
32
+ "<Index sources=#{sources.map{|s| s.inspect}} specs.size=#{specs.size}>"
33
+ end
34
+
31
35
  def empty?
32
36
  each { return false }
33
37
  true
@@ -76,6 +80,16 @@ module Bundler
76
80
  end
77
81
  end
78
82
 
83
+ # returns a list of the dependencies
84
+ def unmet_dependency_names
85
+ dependency_names = specs.values.map do |array_of_s|
86
+ array_of_s.map do |s|
87
+ s.dependencies.map{|d| d.name }
88
+ end
89
+ end.flatten.uniq
90
+ dependency_names.select{|name| specs_by_name(name).empty? }
91
+ end
92
+
79
93
  def use(other)
80
94
  return unless other
81
95
  other.each do |s|
@@ -85,6 +99,12 @@ module Bundler
85
99
  self
86
100
  end
87
101
 
102
+ def size
103
+ @sources.inject(@specs.size) do |size, source|
104
+ size += source.size
105
+ end
106
+ end
107
+
88
108
  def ==(o)
89
109
  all? do |s|
90
110
  s2 = o[s].first and (s.dependencies & s2.dependencies).empty?
@@ -134,10 +154,15 @@ module Bundler
134
154
  end
135
155
  end
136
156
 
137
- def same_version?(a, b)
138
- regex = /^(.*?)(?:\.0)*$/
139
-
140
- a.to_s[regex, 1] == b.to_s[regex, 1]
157
+ if RUBY_VERSION < '1.9'
158
+ def same_version?(a, b)
159
+ regex = /^(.*?)(?:\.0)*$/
160
+ a.to_s[regex, 1] == b.to_s[regex, 1]
161
+ end
162
+ else
163
+ def same_version?(a, b)
164
+ a == b
165
+ end
141
166
  end
142
167
 
143
168
  def spec_satisfies_dependency?(spec, dep)
@@ -28,6 +28,7 @@ module Bundler
28
28
 
29
29
  if dependencies.empty?
30
30
  Bundler.ui.warn "The Gemfile specifies no dependencies"
31
+ lock
31
32
  return
32
33
  end
33
34
 
@@ -52,7 +53,7 @@ module Bundler
52
53
  # the gem.
53
54
  Installer.post_install_messages = {}
54
55
  specs.each do |spec|
55
- spec.source.fetch(spec) if spec.source.respond_to?(:fetch)
56
+ Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems)
56
57
 
57
58
  # unless requested_specs.include?(spec)
58
59
  # Bundler.ui.debug " * Not in requested group; skipping."
@@ -58,9 +58,11 @@ module Bundler
58
58
 
59
59
  private
60
60
 
61
- def method_missing(method, *args, &blk)
62
- return super if method == :to_ary
61
+ def to_ary
62
+ nil
63
+ end
63
64
 
65
+ def method_missing(method, *args, &blk)
64
66
  raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification
65
67
 
66
68
  return super unless respond_to?(method)
@@ -137,7 +137,7 @@ module Bundler
137
137
  @stack = []
138
138
  @base = base
139
139
  @index = index
140
- @gems_size = {}
140
+ @deps_for = {}
141
141
  @missing_gems = Hash.new(0)
142
142
  @source_requirements = source_requirements
143
143
  end
@@ -248,11 +248,11 @@ module Bundler
248
248
  conflicts = Set.new
249
249
 
250
250
  # Fetch all gem versions matching the requirement
251
- #
252
- # TODO: Warn / error when no matching versions are found.
253
251
  matching_versions = search(current)
254
252
 
253
+ # If we found no versions that match the current requirement
255
254
  if matching_versions.empty?
255
+ # If this is a top-level Gemfile requirement
256
256
  if current.required_by.empty?
257
257
  if base = @base[current.name] and !base.empty?
258
258
  version = base.first.version
@@ -278,15 +278,8 @@ module Bundler
278
278
  end
279
279
  end
280
280
  raise GemNotFound, message
281
+ # This is not a top-level Gemfile requirement
281
282
  else
282
- if @missing_gems[current] >= 5
283
- message = "Bundler could not find find gem #{current.required_by.last},"
284
- message << "which is required by gem #{current}."
285
- raise GemNotFound, message
286
- end
287
- @missing_gems[current] += 1
288
-
289
- debug { " Could not find #{current} by #{current.required_by.last}" }
290
283
  @errors[current.name] = [nil, current]
291
284
  end
292
285
  end
@@ -351,12 +344,15 @@ module Bundler
351
344
  end
352
345
 
353
346
  def gems_size(dep)
354
- @gems_size[dep] ||= search(dep).size
347
+ search(dep).size
355
348
  end
356
349
 
357
350
  def search(dep)
351
+ return @deps_for[dep.to_s] if @deps_for[dep.to_s]
352
+
358
353
  if base = @base[dep.name] and base.any?
359
- d = Gem::Dependency.new(base.first.name, *[dep.requirement.as_list, base.first.version].flatten)
354
+ reqs = [dep.requirement.as_list, base.first.version.to_s].flatten.compact
355
+ d = Gem::Dependency.new(base.first.name, *reqs)
360
356
  else
361
357
  d = dep.dep
362
358
  end
@@ -373,10 +369,11 @@ module Bundler
373
369
  end
374
370
  nested.last << spec
375
371
  end
376
- nested.map { |a| SpecGroup.new(a) }.select { |sg| sg.for?(dep.__platform) }
372
+ deps = nested.map{|a| SpecGroup.new(a) }.select{|sg| sg.for?(dep.__platform) }
377
373
  else
378
- []
374
+ deps = []
379
375
  end
376
+ @deps_for[dep.to_s] = deps
380
377
  end
381
378
 
382
379
  def clean_req(req)
@@ -456,7 +453,8 @@ module Bundler
456
453
  # the rest of the time, the gem cannot be found because it does not exist in the known sources
457
454
  else
458
455
  if requirement.required_by.first
459
- o << "Could not find gem '#{clean_req(requirement)}', required by '#{clean_req(requirement.required_by.first)}', in any of the sources\n"
456
+ o << "Could not find gem '#{clean_req(requirement)}', which is required by "
457
+ o << "gem '#{clean_req(requirement.required_by.first)}', in any of the sources."
460
458
  else
461
459
  o << "Could not find gem '#{clean_req(requirement)} in any of the sources\n"
462
460
  end