bundler 1.7.15 → 1.8.0.pre

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -14
  3. data/.rspec +1 -0
  4. data/.travis.yml +22 -15
  5. data/CHANGELOG.md +43 -13
  6. data/CODE_OF_CONDUCT.md +40 -0
  7. data/CONTRIBUTING.md +14 -12
  8. data/DEVELOPMENT.md +4 -2
  9. data/ISSUES.md +1 -1
  10. data/README.md +10 -14
  11. data/Rakefile +10 -10
  12. data/bin/bundle +1 -1
  13. data/bundler.gemspec +5 -4
  14. data/lib/bundler.rb +22 -3
  15. data/lib/bundler/anonymizable_uri.rb +24 -8
  16. data/lib/bundler/cli.rb +103 -66
  17. data/lib/bundler/cli/cache.rb +1 -0
  18. data/lib/bundler/cli/clean.rb +11 -4
  19. data/lib/bundler/cli/common.rb +2 -0
  20. data/lib/bundler/cli/console.rb +22 -26
  21. data/lib/bundler/cli/exec.rb +29 -22
  22. data/lib/bundler/cli/gem.rb +125 -37
  23. data/lib/bundler/cli/install.rb +22 -9
  24. data/lib/bundler/cli/outdated.rb +1 -1
  25. data/lib/bundler/cli/package.rb +8 -1
  26. data/lib/bundler/cli/show.rb +29 -3
  27. data/lib/bundler/cli/update.rb +2 -2
  28. data/lib/bundler/cli/viz.rb +1 -1
  29. data/lib/bundler/definition.rb +14 -22
  30. data/lib/bundler/dependency.rb +8 -1
  31. data/lib/bundler/dsl.rb +17 -4
  32. data/lib/bundler/endpoint_specification.rb +1 -1
  33. data/lib/bundler/env.rb +44 -25
  34. data/lib/bundler/fetcher.rb +33 -25
  35. data/lib/bundler/friendly_errors.rb +38 -5
  36. data/lib/bundler/gem_helper.rb +16 -10
  37. data/lib/bundler/gem_helpers.rb +1 -0
  38. data/lib/bundler/graph.rb +4 -1
  39. data/lib/bundler/index.rb +15 -25
  40. data/lib/bundler/installer.rb +6 -6
  41. data/lib/bundler/lockfile_parser.rb +7 -7
  42. data/lib/bundler/resolver.rb +2 -1
  43. data/lib/bundler/ruby_version.rb +1 -1
  44. data/lib/bundler/rubygems_ext.rb +1 -0
  45. data/lib/bundler/rubygems_integration.rb +1 -1
  46. data/lib/bundler/runtime.rb +22 -40
  47. data/lib/bundler/settings.rb +14 -5
  48. data/lib/bundler/setup.rb +2 -1
  49. data/lib/bundler/shared_helpers.rb +56 -4
  50. data/lib/bundler/source.rb +8 -9
  51. data/lib/bundler/source/git.rb +5 -1
  52. data/lib/bundler/source/git/git_proxy.rb +4 -0
  53. data/lib/bundler/source/path.rb +8 -11
  54. data/lib/bundler/source/path/installer.rb +0 -2
  55. data/lib/bundler/source/rubygems.rb +58 -72
  56. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
  57. data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
  58. data/lib/bundler/templates/newgem/README.md.tt +9 -1
  59. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  60. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  61. data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
  62. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  63. data/lib/bundler/templates/newgem/gitignore.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
  66. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  67. data/lib/bundler/ui/shell.rb +1 -1
  68. data/lib/bundler/version.rb +1 -1
  69. data/lib/bundler/worker.rb +73 -0
  70. data/man/bundle-config.ronn +17 -15
  71. data/man/bundle-install.ronn +102 -93
  72. data/man/bundle-update.ronn +39 -30
  73. data/man/bundle.ronn +6 -0
  74. data/man/gemfile.5.ronn +74 -13
  75. metadata +10 -231
  76. data/lib/bundler/parallel_workers.rb +0 -18
  77. data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
  78. data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
  79. data/lib/bundler/parallel_workers/worker.rb +0 -69
  80. data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
  81. data/spec/bundler/anonymizable_uri_spec.rb +0 -32
  82. data/spec/bundler/bundler_spec.rb +0 -72
  83. data/spec/bundler/cli_spec.rb +0 -16
  84. data/spec/bundler/definition_spec.rb +0 -22
  85. data/spec/bundler/dsl_spec.rb +0 -82
  86. data/spec/bundler/friendly_errors_spec.rb +0 -13
  87. data/spec/bundler/gem_helper_spec.rb +0 -226
  88. data/spec/bundler/psyched_yaml_spec.rb +0 -8
  89. data/spec/bundler/retry_spec.rb +0 -59
  90. data/spec/bundler/settings_spec.rb +0 -13
  91. data/spec/bundler/source/rubygems_spec.rb +0 -25
  92. data/spec/bundler/source_list_spec.rb +0 -361
  93. data/spec/cache/gems_spec.rb +0 -284
  94. data/spec/cache/git_spec.rb +0 -188
  95. data/spec/cache/path_spec.rb +0 -121
  96. data/spec/cache/platform_spec.rb +0 -57
  97. data/spec/commands/binstubs_spec.rb +0 -219
  98. data/spec/commands/check_spec.rb +0 -278
  99. data/spec/commands/clean_spec.rb +0 -592
  100. data/spec/commands/config_spec.rb +0 -263
  101. data/spec/commands/console_spec.rb +0 -76
  102. data/spec/commands/exec_spec.rb +0 -309
  103. data/spec/commands/help_spec.rb +0 -39
  104. data/spec/commands/init_spec.rb +0 -39
  105. data/spec/commands/inject_spec.rb +0 -78
  106. data/spec/commands/licenses_spec.rb +0 -18
  107. data/spec/commands/newgem_spec.rb +0 -428
  108. data/spec/commands/open_spec.rb +0 -68
  109. data/spec/commands/outdated_spec.rb +0 -156
  110. data/spec/commands/package_spec.rb +0 -114
  111. data/spec/commands/show_spec.rb +0 -125
  112. data/spec/install/binstubs_spec.rb +0 -24
  113. data/spec/install/bundler_spec.rb +0 -146
  114. data/spec/install/deploy_spec.rb +0 -250
  115. data/spec/install/gemfile/gemspec_spec.rb +0 -170
  116. data/spec/install/gemfile/git_spec.rb +0 -967
  117. data/spec/install/gemfile/path_spec.rb +0 -500
  118. data/spec/install/gemfile_spec.rb +0 -44
  119. data/spec/install/gems/c_ext_spec.rb +0 -48
  120. data/spec/install/gems/dependency_api_spec.rb +0 -652
  121. data/spec/install/gems/env_spec.rb +0 -107
  122. data/spec/install/gems/flex_spec.rb +0 -314
  123. data/spec/install/gems/groups_spec.rb +0 -308
  124. data/spec/install/gems/mirror_spec.rb +0 -39
  125. data/spec/install/gems/platform_spec.rb +0 -195
  126. data/spec/install/gems/post_install_spec.rb +0 -121
  127. data/spec/install/gems/resolving_spec.rb +0 -124
  128. data/spec/install/gems/simple_case_spec.rb +0 -377
  129. data/spec/install/gems/sources_spec.rb +0 -386
  130. data/spec/install/gems/standalone_spec.rb +0 -260
  131. data/spec/install/gems/sudo_spec.rb +0 -136
  132. data/spec/install/gems/win32_spec.rb +0 -26
  133. data/spec/install/gemspecs_spec.rb +0 -50
  134. data/spec/install/path_spec.rb +0 -150
  135. data/spec/install/post_bundle_message_spec.rb +0 -142
  136. data/spec/install/prereleases_spec.rb +0 -43
  137. data/spec/install/security_policy_spec.rb +0 -77
  138. data/spec/install/upgrade_spec.rb +0 -26
  139. data/spec/lock/git_spec.rb +0 -34
  140. data/spec/lock/lockfile_spec.rb +0 -924
  141. data/spec/other/bundle_ruby_spec.rb +0 -142
  142. data/spec/other/cli_dispatch_spec.rb +0 -21
  143. data/spec/other/ext_spec.rb +0 -60
  144. data/spec/other/platform_spec.rb +0 -1285
  145. data/spec/other/ssl_cert_spec.rb +0 -23
  146. data/spec/quality_spec.rb +0 -88
  147. data/spec/realworld/dependency_api_spec.rb +0 -60
  148. data/spec/realworld/edgecases_spec.rb +0 -212
  149. data/spec/realworld/parallel_spec.rb +0 -71
  150. data/spec/resolver/basic_spec.rb +0 -66
  151. data/spec/resolver/platform_spec.rb +0 -88
  152. data/spec/runtime/executable_spec.rb +0 -149
  153. data/spec/runtime/load_spec.rb +0 -107
  154. data/spec/runtime/platform_spec.rb +0 -90
  155. data/spec/runtime/require_spec.rb +0 -332
  156. data/spec/runtime/setup_spec.rb +0 -853
  157. data/spec/runtime/with_clean_env_spec.rb +0 -91
  158. data/spec/spec_helper.rb +0 -123
  159. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
  160. data/spec/support/artifice/endpoint.rb +0 -71
  161. data/spec/support/artifice/endpoint_500.rb +0 -37
  162. data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
  163. data/spec/support/artifice/endpoint_api_missing.rb +0 -16
  164. data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
  165. data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
  166. data/spec/support/artifice/endpoint_extra.rb +0 -31
  167. data/spec/support/artifice/endpoint_extra_api.rb +0 -32
  168. data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
  169. data/spec/support/artifice/endpoint_fallback.rb +0 -17
  170. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  171. data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
  172. data/spec/support/artifice/endpoint_redirect.rb +0 -15
  173. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
  174. data/spec/support/artifice/endpoint_timeout.rb +0 -13
  175. data/spec/support/builders.rb +0 -693
  176. data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
  177. data/spec/support/fakeweb/windows.rb +0 -23
  178. data/spec/support/hax.rb +0 -22
  179. data/spec/support/helpers.rb +0 -361
  180. data/spec/support/indexes.rb +0 -280
  181. data/spec/support/matchers.rb +0 -77
  182. data/spec/support/path.rb +0 -85
  183. data/spec/support/permissions.rb +0 -10
  184. data/spec/support/platforms.rb +0 -94
  185. data/spec/support/ruby_ext.rb +0 -20
  186. data/spec/support/rubygems_ext.rb +0 -39
  187. data/spec/support/streams.rb +0 -13
  188. data/spec/support/sudo.rb +0 -16
  189. data/spec/update/gems_spec.rb +0 -201
  190. data/spec/update/git_spec.rb +0 -283
  191. data/spec/update/path_spec.rb +0 -18
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require "bundler/vendored_thor"
2
3
 
3
4
  module Bundler
@@ -33,10 +34,42 @@ module Bundler
33
34
  rescue SystemExit => e
34
35
  exit e.status
35
36
  rescue Exception => e
36
- Bundler.ui.error <<-ERR, :wrap => true
37
- Unfortunately, a fatal error has occurred. Please see the Bundler \
38
- troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
39
- ERR
40
- raise e
37
+ request_issue_report_for(e)
38
+ exit 1
39
+ end
40
+
41
+ def self.request_issue_report_for(e)
42
+ Bundler.ui.info <<-EOS.gsub(/^ {6}/, '')
43
+ #{'――― ERROR REPORT TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――'}
44
+ - What did you do?
45
+ - What did you expect to happen?
46
+ - What happened instead?
47
+
48
+ Error details
49
+
50
+ #{e.class}: #{e.message}
51
+ #{e.backtrace.join("\n ")}
52
+
53
+ #{Bundler::Env.new.report(:print_gemfile => false).gsub(/\n/, "\n ").strip}
54
+ #{'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'}
55
+
56
+ EOS
57
+
58
+ Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
59
+
60
+ Bundler.ui.warn <<-EOS.gsub(/^ {6}/, '')
61
+
62
+ First, try this link to see if there are any existing issue reports for this error:
63
+ #{issues_url(e)}
64
+
65
+ If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
66
+ https://github.com/bundler/bundler/issues/new
67
+ EOS
41
68
  end
69
+
70
+ def self.issues_url(exception)
71
+ 'https://github.com/bundler/bundler/search?q=' \
72
+ "#{CGI.escape(exception.message)}&type=Issues"
73
+ end
74
+
42
75
  end
@@ -44,9 +44,22 @@ module Bundler
44
44
  install_gem(built_gem_path)
45
45
  end
46
46
 
47
- desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems"
48
- task 'release' => 'build' do
49
- release_gem(built_gem_path)
47
+ desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems\n" \
48
+ "To prevent publishing in Rubygems use `gem_push=no rake release`"
49
+ task 'release' => ['build', 'release:guard_clean',
50
+ 'release:source_control_push', 'release:rubygem_push'] do
51
+ end
52
+
53
+ task 'release:guard_clean' do
54
+ guard_clean
55
+ end
56
+
57
+ task 'release:source_control_push' do
58
+ tag_version { git_push } unless already_tagged?
59
+ end
60
+
61
+ task 'release:rubygem_push' do
62
+ rubygem_push(built_gem_path) if gem_push?
50
63
  end
51
64
 
52
65
  GemHelper.instance = self
@@ -70,13 +83,6 @@ module Bundler
70
83
  Bundler.ui.confirm "#{name} (#{version}) installed."
71
84
  end
72
85
 
73
- def release_gem(built_gem_path=nil)
74
- guard_clean
75
- built_gem_path ||= build_gem
76
- tag_version { git_push } unless already_tagged?
77
- rubygem_push(built_gem_path) if gem_push?
78
- end
79
-
80
86
  protected
81
87
  def rubygem_push(path)
82
88
  if Pathname.new("~/.gem/credentials").expand_path.exist?
@@ -5,6 +5,7 @@ module Bundler
5
5
  GENERICS = [
6
6
  [Gem::Platform.new('java'), Gem::Platform.new('java')],
7
7
  [Gem::Platform.new('mswin32'), Gem::Platform.new('mswin32')],
8
+ [Gem::Platform.new('mswin64'), Gem::Platform.new('mswin64')],
8
9
  [Gem::Platform.new('x64-mingw32'), Gem::Platform.new('x64-mingw32')],
9
10
  [Gem::Platform.new('x86_64-mingw32'), Gem::Platform.new('x64-mingw32')],
10
11
  [Gem::Platform.new('mingw32'), Gem::Platform.new('x86-mingw32')]
@@ -3,12 +3,13 @@ module Bundler
3
3
  class Graph
4
4
  GRAPH_NAME = :Gemfile
5
5
 
6
- def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png")
6
+ def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png", without = [])
7
7
  @env = env
8
8
  @output_file = output_file
9
9
  @show_version = show_version
10
10
  @show_requirements = show_requirements
11
11
  @output_format = output_format
12
+ @without_groups = without.map(&:to_sym)
12
13
 
13
14
  @groups = []
14
15
  @relations = Hash.new {|h, k| h[k] = Set.new}
@@ -53,6 +54,8 @@ module Bundler
53
54
  relations = Hash.new {|h, k| h[k] = Set.new}
54
55
  @env.current_dependencies.each do |dependency|
55
56
  dependency.groups.each do |group|
57
+ next if @without_groups.include?(group)
58
+
56
59
  relations[group.to_s].add(dependency)
57
60
  @relations[group.to_s].add(dependency.name)
58
61
 
@@ -16,7 +16,7 @@ module Bundler
16
16
  def initialize
17
17
  @sources = []
18
18
  @cache = {}
19
- @specs = Hash.new { |h,k| h[k] = [] }
19
+ @specs = Hash.new { |h,k| h[k] = Hash.new }
20
20
  @all_specs = Hash.new { |h,k| h[k] = [] }
21
21
  end
22
22
 
@@ -24,11 +24,11 @@ module Bundler
24
24
  super
25
25
  @sources = @sources.dup
26
26
  @cache = {}
27
- @specs = Hash.new { |h,k| h[k] = [] }
27
+ @specs = Hash.new { |h,k| h[k] = Hash.new }
28
28
  @all_specs = Hash.new { |h,k| h[k] = [] }
29
29
 
30
- o.specs.each do |name, array|
31
- @specs[name] = array.dup
30
+ o.specs.each do |name, hash|
31
+ @specs[name] = hash.dup
32
32
  end
33
33
  o.all_specs.each do |name, array|
34
34
  @all_specs[name] = array.dup
@@ -88,33 +88,24 @@ module Bundler
88
88
  alias [] search
89
89
 
90
90
  def <<(spec)
91
- arr = specs_by_name(spec.name)
91
+ @specs[spec.name]["#{spec.version}-#{spec.platform}"] = spec
92
92
 
93
- arr.delete_if do |s|
94
- same_version?(s.version, spec.version) && s.platform == spec.platform
95
- end
96
-
97
- arr << spec
98
93
  spec
99
94
  end
100
95
 
101
96
  def each(&blk)
102
- specs.values.each do |specs|
103
- specs.each(&blk)
97
+ specs.values.each do |spec_sets|
98
+ spec_sets.values.each(&blk)
104
99
  end
105
100
  end
106
101
 
107
102
  # returns a list of the dependencies
108
103
  def unmet_dependency_names
109
- names = dependency_names
110
- names.delete_if{|n| n == "bundler" }
111
- names.select{|n| search(n).empty? }
112
- end
113
-
114
- def dependency_names
115
104
  names = []
116
105
  each{|s| names.push(*s.dependencies.map{|d| d.name }) }
117
- names.uniq
106
+ names.uniq!
107
+ names.delete_if{|n| n == "bundler" }
108
+ names.select{|n| search(n).empty? }
118
109
  end
119
110
 
120
111
  def use(other, override_dupes = false)
@@ -123,9 +114,9 @@ module Bundler
123
114
  if (dupes = search_by_spec(s)) && dupes.any?
124
115
  @all_specs[s.name] = [s] + dupes
125
116
  next unless override_dupes
126
- @specs[s.name] -= dupes
117
+ self << s
127
118
  end
128
- @specs[s.name] << s
119
+ self << s
129
120
  end
130
121
  self
131
122
  end
@@ -155,7 +146,7 @@ module Bundler
155
146
  private
156
147
 
157
148
  def specs_by_name(name)
158
- @specs[name]
149
+ @specs[name].values
159
150
  end
160
151
 
161
152
  def search_by_dependency(dependency, base = nil)
@@ -182,9 +173,8 @@ module Bundler
182
173
  end
183
174
 
184
175
  def search_by_spec(spec)
185
- specs_by_name(spec.name).select do |s|
186
- same_version?(s.version, spec.version) && Gem::Platform.new(s.platform) == Gem::Platform.new(spec.platform)
187
- end
176
+ spec = @specs[spec.name]["#{spec.version}-#{spec.platform}"]
177
+ spec ? [spec] : []
188
178
  end
189
179
 
190
180
  if RUBY_VERSION < '1.9'
@@ -1,6 +1,6 @@
1
1
  require 'erb'
2
2
  require 'rubygems/dependency_installer'
3
- require 'bundler/parallel_workers'
3
+ require 'bundler/worker'
4
4
 
5
5
  module Bundler
6
6
  class Installer < Environment
@@ -84,7 +84,7 @@ module Bundler
84
84
  # that said, it's a rare situation (other than rake), and parallel
85
85
  # installation is just SO MUCH FASTER. so we let people opt in.
86
86
  jobs = [Bundler.settings[:jobs].to_i-1, 1].max
87
- if jobs > 1 && can_install_parallely?
87
+ if jobs > 1 && can_install_in_parallel?
88
88
  install_in_parallel jobs, options[:standalone]
89
89
  else
90
90
  install_sequentially options[:standalone]
@@ -194,7 +194,7 @@ module Bundler
194
194
 
195
195
  private
196
196
 
197
- def can_install_parallely?
197
+ def can_install_in_parallel?
198
198
  min_rubygems = "2.0.7"
199
199
  if Bundler.current_ruby.mri? || Bundler.rubygems.provides?(">= #{min_rubygems}")
200
200
  true
@@ -254,7 +254,7 @@ module Bundler
254
254
  file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
255
255
  file.puts "path = File.expand_path('..', __FILE__)"
256
256
  paths.each do |path|
257
- file.puts %{$:.unshift File.expand_path("\#{path}/#{path}")}
257
+ file.puts %{$:.unshift "\#{path}/#{path}"}
258
258
  end
259
259
  end
260
260
  end
@@ -277,9 +277,9 @@ module Bundler
277
277
  remains[spec.name] = true
278
278
  end
279
279
 
280
- worker_pool = ParallelWorkers.worker_pool size, lambda { |name, worker|
280
+ worker_pool = Worker.new size, lambda { |name, worker_num|
281
281
  spec = name2spec[name]
282
- message = install_gem_from_spec spec, standalone, worker
282
+ message = install_gem_from_spec spec, standalone, worker_num
283
283
  { :name => spec.name, :post_install => message }
284
284
  }
285
285
 
@@ -52,9 +52,9 @@ module Bundler
52
52
  private
53
53
 
54
54
  TYPES = {
55
- "GIT" => Bundler::Source::Git,
56
- "GEM" => Bundler::Source::Rubygems,
57
- "PATH" => Bundler::Source::Path
55
+ GIT => Bundler::Source::Git,
56
+ GEM => Bundler::Source::Rubygems,
57
+ PATH => Bundler::Source::Path,
58
58
  }
59
59
 
60
60
  def parse_source(line)
@@ -64,18 +64,18 @@ module Bundler
64
64
  @opts, @type = {}, line
65
65
  when SPECS
66
66
  case @type
67
- when "PATH"
67
+ when PATH
68
68
  @current_source = TYPES[@type].from_lock(@opts)
69
69
  @sources << @current_source
70
- when "GIT"
70
+ when GIT
71
71
  @current_source = TYPES[@type].from_lock(@opts)
72
72
  # Strip out duplicate GIT sections
73
- if @type == "GIT" && @sources.include?(@current_source)
73
+ if @sources.include?(@current_source)
74
74
  @current_source = @sources.find { |s| s == @current_source }
75
75
  else
76
76
  @sources << @current_source
77
77
  end
78
- when "GEM"
78
+ when GEM
79
79
  Array(@opts["remote"]).each do |url|
80
80
  @rubygems_aggregate.add_remote(url)
81
81
  end
@@ -141,6 +141,7 @@ module Bundler
141
141
  @index = index
142
142
  @deps_for = {}
143
143
  @missing_gems = Hash.new(0)
144
+ @prereleases_cache = Hash.new { |h,k| h[k] = k.prerelease? }
144
145
  @source_requirements = source_requirements
145
146
  @iteration_counter = 0
146
147
  @started_at = Time.now
@@ -269,7 +270,7 @@ module Bundler
269
270
 
270
271
  reqs = reqs.sort_by do |a|
271
272
  [ activated[a.name] ? 0 : 1,
272
- a.requirement.prerelease? ? 0 : 1,
273
+ @prereleases_cache[a.requirement] ? 0 : 1,
273
274
  @errors[a.name] ? 0 : 1,
274
275
  activated[a.name] ? 0 : @gems_size[a] ]
275
276
  end
@@ -38,7 +38,7 @@ module Bundler
38
38
  patchlevel == other.patchlevel
39
39
  end
40
40
 
41
- # Returns a tuple of thsee things:
41
+ # Returns a tuple of these things:
42
42
  # [diff, this, other]
43
43
  # The priority of attributes are
44
44
  # 1. engine
@@ -149,6 +149,7 @@ module Gem
149
149
  class Platform
150
150
  JAVA = Gem::Platform.new('java') unless defined?(JAVA)
151
151
  MSWIN = Gem::Platform.new('mswin32') unless defined?(MSWIN)
152
+ MSWIN64 = Gem::Platform.new('mswin64') unless defined?(MSWIN64)
152
153
  MINGW = Gem::Platform.new('x86-mingw32') unless defined?(MINGW)
153
154
  X64_MINGW = Gem::Platform.new('x64-mingw32') unless defined?(X64_MINGW)
154
155
 
@@ -306,12 +306,12 @@ module Bundler
306
306
 
307
307
  if exec_name
308
308
  spec = specs.find { |s| s.executables.include?(exec_name) }
309
+ spec or raise Gem::Exception, "can't find executable #{exec_name}"
309
310
  unless spec.name == name
310
311
  warn "Bundler is using a binstub that was created for a different gem.\n" \
311
312
  "This is deprecated, in future versions you may need to `bundle binstub #{name}` " \
312
313
  "to work around a system/bundle conflict."
313
314
  end
314
- spec or raise Gem::Exception, "can't find executable #{exec_name}"
315
315
  else
316
316
  spec = specs.find { |s| s.name == name }
317
317
  exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
@@ -46,7 +46,7 @@ module Bundler
46
46
  self
47
47
  end
48
48
 
49
- REGEXPS = [
49
+ REQUIRE_ERRORS = [
50
50
  /^no such file to load -- (.+)$/i,
51
51
  /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
52
52
  /^Missing API definition file in (.+)$/i,
@@ -76,20 +76,21 @@ module Bundler
76
76
  Kernel.require file
77
77
  end
78
78
  rescue LoadError => e
79
- REGEXPS.find { |r| r =~ e.message }
79
+ REQUIRE_ERRORS.find { |r| r =~ e.message }
80
80
  raise if dep.autorequire || $1 != required_file
81
81
 
82
82
  if dep.autorequire.nil? && dep.name.include?('-')
83
83
  begin
84
84
  namespaced_file = dep.name.gsub('-', '/')
85
85
  Kernel.require namespaced_file
86
- rescue LoadError
87
- REGEXPS.find { |r| r =~ e.message }
88
- regex_name = $1
89
- raise e if dep.autorequire || (regex_name && regex_name.gsub('-', '/') != namespaced_file)
90
- raise e if regex_name.nil?
86
+ rescue LoadError => e
87
+ REQUIRE_ERRORS.find { |r| r =~ e.message }
88
+ raise if $1 != namespaced_file
91
89
  end
92
90
  end
91
+ rescue => e
92
+ Bundler.ui.debug e
93
+ Bundler.ui.warn "Unable to require #{required_file}. #{e.class}: #{e.message}."
93
94
  end
94
95
  end
95
96
  end
@@ -105,12 +106,13 @@ module Bundler
105
106
  alias gems specs
106
107
 
107
108
  def cache(custom_path = nil)
108
- cache_path = cache_path(custom_path)
109
+ cache_path = Bundler.app_cache(custom_path)
109
110
  FileUtils.mkdir_p(cache_path) unless File.exist?(cache_path)
110
111
 
111
- Bundler.ui.info "Updating files in vendor/cache"
112
+ Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
112
113
  specs.each do |spec|
113
114
  next if spec.name == 'bundler'
115
+ spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true)
114
116
  spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
115
117
  end
116
118
 
@@ -119,15 +121,14 @@ module Bundler
119
121
  FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
120
122
  end
121
123
 
122
- prune_cache(custom_path) unless Bundler.settings[:no_prune]
124
+ prune_cache(cache_path) unless Bundler.settings[:no_prune]
123
125
  end
124
126
 
125
- def prune_cache(custom_path)
126
- cache_path = cache_path(custom_path)
127
+ def prune_cache(cache_path)
127
128
  FileUtils.mkdir_p(cache_path) unless File.exist?(cache_path)
128
129
  resolve = @definition.resolve
129
- prune_gem_cache(resolve, custom_path)
130
- prune_git_and_path_cache(resolve, custom_path)
130
+ prune_gem_cache(resolve, cache_path)
131
+ prune_git_and_path_cache(resolve, cache_path)
131
132
  end
132
133
 
133
134
  def clean(dry_run = false)
@@ -218,31 +219,16 @@ module Bundler
218
219
  ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../bin/bundle", __FILE__)
219
220
  end
220
221
 
221
- # Set PATH
222
- paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
223
- paths.unshift "#{Bundler.bundle_path}/bin"
224
- ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
225
-
226
222
  # Set BUNDLE_GEMFILE
227
223
  ENV["BUNDLE_GEMFILE"] = default_gemfile.to_s
228
224
 
229
- # Set RUBYOPT
230
- rubyopt = [ENV["RUBYOPT"]].compact
231
- if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/
232
- rubyopt.unshift %|-rbundler/setup|
233
- ENV["RUBYOPT"] = rubyopt.join(' ')
234
- end
235
-
236
- # Set RUBYLIB
237
- rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
238
- rubylib.unshift File.expand_path('../..', __FILE__)
239
- ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR)
225
+ SharedHelpers.set_bundle_environment
240
226
  end
241
227
 
242
228
  private
243
229
 
244
- def prune_gem_cache(resolve, custom_path)
245
- cached = Dir["#{cache_path(custom_path)}/*.gem"]
230
+ def prune_gem_cache(resolve, cache_path)
231
+ cached = Dir["#{cache_path}/*.gem"]
246
232
 
247
233
  cached = cached.delete_if do |path|
248
234
  spec = Bundler.rubygems.spec_from_gem path
@@ -253,7 +239,7 @@ module Bundler
253
239
  end
254
240
 
255
241
  if cached.any?
256
- Bundler.ui.info "Removing outdated .gem files from vendor/cache"
242
+ Bundler.ui.info "Removing outdated .gem files from #{Bundler.settings.app_cache_path}"
257
243
 
258
244
  cached.each do |path|
259
245
  Bundler.ui.info " * #{File.basename(path)}"
@@ -262,8 +248,8 @@ module Bundler
262
248
  end
263
249
  end
264
250
 
265
- def prune_git_and_path_cache(resolve, custom_path)
266
- cached = Dir["#{cache_path(custom_path)}/*/.bundlecache"]
251
+ def prune_git_and_path_cache(resolve, cache_path)
252
+ cached = Dir["#{cache_path}/*/.bundlecache"]
267
253
 
268
254
  cached = cached.delete_if do |path|
269
255
  name = File.basename(File.dirname(path))
@@ -275,7 +261,7 @@ module Bundler
275
261
  end
276
262
 
277
263
  if cached.any?
278
- Bundler.ui.info "Removing outdated git and path gems from vendor/cache"
264
+ Bundler.ui.info "Removing outdated git and path gems from #{Bundler.settings.app_cache_path}"
279
265
 
280
266
  cached.each do |path|
281
267
  path = File.dirname(path)
@@ -302,9 +288,5 @@ module Bundler
302
288
  end
303
289
  end
304
290
 
305
- def cache_path(custom_path = nil)
306
- path = custom_path || root
307
- path.join("vendor/cache")
308
- end
309
291
  end
310
292
  end