bundler 1.12.6 → 1.13.0.pre.1

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +15 -13
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +40 -3
  5. data/CONTRIBUTING.md +9 -5
  6. data/DEVELOPMENT.md +30 -18
  7. data/ISSUES.md +26 -22
  8. data/Rakefile +15 -4
  9. data/bin/rubocop +1 -1
  10. data/bundler.gemspec +2 -2
  11. data/exe/bundle +7 -0
  12. data/lib/bundler.rb +6 -3
  13. data/lib/bundler/capistrano.rb +1 -1
  14. data/lib/bundler/cli.rb +27 -10
  15. data/lib/bundler/cli/binstubs.rb +2 -0
  16. data/lib/bundler/cli/exec.rb +1 -1
  17. data/lib/bundler/cli/install.rb +87 -56
  18. data/lib/bundler/cli/lock.rb +5 -0
  19. data/lib/bundler/cli/open.rb +3 -1
  20. data/lib/bundler/cli/outdated.rb +8 -8
  21. data/lib/bundler/cli/plugin.rb +23 -0
  22. data/lib/bundler/cli/update.rb +2 -2
  23. data/lib/bundler/cli/viz.rb +3 -0
  24. data/lib/bundler/definition.rb +72 -16
  25. data/lib/bundler/dsl.rb +19 -7
  26. data/lib/bundler/endpoint_specification.rb +2 -2
  27. data/lib/bundler/env.rb +2 -2
  28. data/lib/bundler/errors.rb +15 -1
  29. data/lib/bundler/fetcher.rb +5 -2
  30. data/lib/bundler/fetcher/compact_index.rb +2 -2
  31. data/lib/bundler/fetcher/dependency.rb +8 -4
  32. data/lib/bundler/fetcher/downloader.rb +1 -1
  33. data/lib/bundler/friendly_errors.rb +1 -1
  34. data/lib/bundler/index.rb +29 -36
  35. data/lib/bundler/inline.rb +14 -4
  36. data/lib/bundler/installer.rb +22 -3
  37. data/lib/bundler/installer/gem_installer.rb +1 -1
  38. data/lib/bundler/installer/standalone.rb +1 -1
  39. data/lib/bundler/mirror.rb +4 -4
  40. data/lib/bundler/plugin.rb +156 -0
  41. data/lib/bundler/plugin/api.rb +56 -0
  42. data/lib/bundler/plugin/dsl.rb +29 -0
  43. data/lib/bundler/plugin/index.rb +88 -0
  44. data/lib/bundler/plugin/installer.rb +99 -0
  45. data/lib/bundler/plugin/installer/git.rb +38 -0
  46. data/lib/bundler/plugin/installer/rubygems.rb +27 -0
  47. data/lib/bundler/plugin/source_list.rb +24 -0
  48. data/lib/bundler/postit_trampoline.rb +54 -0
  49. data/lib/bundler/psyched_yaml.rb +1 -1
  50. data/lib/bundler/remote_specification.rb +5 -5
  51. data/lib/bundler/resolver.rb +27 -29
  52. data/lib/bundler/ruby_version.rb +29 -3
  53. data/lib/bundler/rubygems_ext.rb +3 -1
  54. data/lib/bundler/rubygems_integration.rb +10 -4
  55. data/lib/bundler/runtime.rb +1 -16
  56. data/lib/bundler/settings.rb +19 -15
  57. data/lib/bundler/setup.rb +1 -0
  58. data/lib/bundler/shared_helpers.rb +3 -0
  59. data/lib/bundler/source.rb +4 -3
  60. data/lib/bundler/source/gemspec.rb +13 -0
  61. data/lib/bundler/source/git.rb +4 -3
  62. data/lib/bundler/source/git/git_proxy.rb +9 -5
  63. data/lib/bundler/source/path.rb +11 -2
  64. data/lib/bundler/source/rubygems.rb +28 -15
  65. data/lib/bundler/source_list.rb +5 -1
  66. data/lib/bundler/spec_set.rb +3 -3
  67. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  68. data/lib/bundler/ssl_certs/rubygems.org/{AddTrustExternalCARoot-2048.pem → AddTrustExternalCARoot.pem} +0 -0
  69. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +54 -29
  70. data/lib/bundler/templates/newgem/newgem.gemspec.tt +5 -2
  71. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +3 -3
  72. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -2
  73. data/lib/bundler/ui/shell.rb +4 -0
  74. data/lib/bundler/ui/silent.rb +3 -0
  75. data/lib/bundler/uri_credentials_filter.rb +36 -0
  76. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +1 -1
  77. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  78. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  79. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +56 -144
  80. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  81. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
  82. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  83. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
  84. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
  85. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  86. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  87. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
  88. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  89. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +46 -51
  90. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +4 -2
  91. data/lib/bundler/vendor/postit/lib/postit.rb +15 -0
  92. data/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
  93. data/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
  94. data/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
  95. data/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
  96. data/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
  97. data/lib/bundler/version.rb +1 -1
  98. data/lib/bundler/vlad.rb +1 -1
  99. data/lib/bundler/yaml_serializer.rb +67 -0
  100. data/man/bundle-install.ronn +10 -5
  101. data/man/bundle-package.ronn +7 -6
  102. data/man/bundle-platform.ronn +1 -1
  103. data/man/bundle-update.ronn +5 -2
  104. data/man/bundle.ronn +5 -5
  105. data/man/gemfile.5.ronn +32 -28
  106. metadata +37 -12
  107. data/lib/bundler/ssl_certs/Fastly.pem +0 -82
  108. data/lib/bundler/ssl_certs/GlobalSignOrganizationValidationCA.pem +0 -26
  109. data/lib/bundler/ssl_certs/GlobalSignRoot.pem +0 -18
  110. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -10,7 +10,7 @@ bundler_spec.dependencies.each do |dep|
10
10
  gem dep.name, dep.requirement.to_s
11
11
  end
12
12
 
13
- gem "rubocop", "= 0.37.1"
13
+ gem "rubocop", "= 0.39.0"
14
14
 
15
15
  Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
16
16
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.name = "bundler"
9
9
  s.version = Bundler::VERSION
10
10
  s.licenses = ["MIT"]
11
- s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
12
- s.email = ["andre.arko+terence.lee@gmail.com"]
11
+ s.authors = ["André Arko", "Samuel Giddins"]
12
+ s.email = ["team@bundler.io"]
13
13
  s.homepage = "http://bundler.io"
14
14
  s.summary = "The best way to manage your application's dependencies"
15
15
  s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
data/exe/bundle CHANGED
@@ -4,6 +4,13 @@
4
4
  # Exit cleanly from an early interrupt
5
5
  Signal.trap("INT") { exit 1 }
6
6
 
7
+ unless ENV["BUNDLE_DISABLE_POSTIT"]
8
+ update = "update".start_with?(ARGV.first || " ") && ARGV.find {|a| a.start_with?("--bundler") }
9
+ update &&= update =~ /--bundler(?:=(.+))?/ && $1 || "> 0.a"
10
+ ENV["BUNDLER_VERSION"] = update if update
11
+ require "bundler/postit_trampoline"
12
+ end
13
+
7
14
  require "bundler"
8
15
  # Check if an older version of bundler is installed
9
16
  $LOAD_PATH.each do |path|
@@ -38,6 +38,7 @@ module Bundler
38
38
  autoload :MatchPlatform, "bundler/match_platform"
39
39
  autoload :Mirror, "bundler/mirror"
40
40
  autoload :Mirrors, "bundler/mirror"
41
+ autoload :Plugin, "bundler/plugin"
41
42
  autoload :RemoteSpecification, "bundler/remote_specification"
42
43
  autoload :Resolver, "bundler/resolver"
43
44
  autoload :Retry, "bundler/retry"
@@ -52,6 +53,7 @@ module Bundler
52
53
  autoload :SourceList, "bundler/source_list"
53
54
  autoload :RubyGemsGemInstaller, "bundler/rubygems_gem_installer"
54
55
  autoload :UI, "bundler/ui"
56
+ autoload :URICredentialsFilter, "bundler/uri_credentials_filter"
55
57
 
56
58
  class << self
57
59
  attr_writer :bundle_path
@@ -85,7 +87,7 @@ module Bundler
85
87
  end
86
88
 
87
89
  def setup(*groups)
88
- # Just return if all groups are already loaded
90
+ # Return if all groups are already loaded
89
91
  return @setup if defined?(@setup)
90
92
 
91
93
  definition.validate_ruby!
@@ -194,8 +196,7 @@ module Bundler
194
196
  end
195
197
 
196
198
  def settings
197
- return @settings if defined?(@settings)
198
- @settings = Settings.new(app_config_path)
199
+ @settings ||= Settings.new(app_config_path)
199
200
  rescue GemfileNotFound
200
201
  @settings = Settings.new(Pathname.new(".bundle").expand_path)
201
202
  end
@@ -378,6 +379,8 @@ module Bundler
378
379
  end
379
380
 
380
381
  def reset!
382
+ @root = nil
383
+ @settings = nil
381
384
  @definition = nil
382
385
  end
383
386
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # Capistrano task for Bundler.
3
3
  #
4
- # Just add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
4
+ # Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
5
5
  # Bundler will be activated after each new deployment.
6
6
  require "bundler/deployment"
7
7
  require "capistrano/version"
@@ -16,6 +16,7 @@ module Bundler
16
16
 
17
17
  def initialize(*args)
18
18
  super
19
+ Bundler.reset!
19
20
 
20
21
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
21
22
  ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty?
@@ -82,6 +83,10 @@ module Bundler
82
83
  end
83
84
 
84
85
  def self.handle_no_command_error(command, has_namespace = $thor_runner)
86
+ if Bundler.settings[:plugins] && Bundler::Plugin.command?(command)
87
+ return Bundler::Plugin.exec_command(command, ARGV[1..-1])
88
+ end
89
+
85
90
  return super unless command_path = Bundler.which("bundler-#{command}")
86
91
 
87
92
  Kernel.exec(command_path, *ARGV[1..-1])
@@ -199,6 +204,8 @@ module Bundler
199
204
  "Force downloading every gem."
200
205
  method_option "ruby", :type => :boolean, :banner =>
201
206
  "Update ruby specified in Gemfile.lock"
207
+ method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
208
+ "Update the locked version of bundler"
202
209
  def update(*gems)
203
210
  require "bundler/cli/update"
204
211
  Update.new(options, gems).run
@@ -229,6 +236,8 @@ module Bundler
229
236
  "Overwrite existing binstubs if they exist"
230
237
  method_option "path", :type => :string, :lazy_default => "bin", :banner =>
231
238
  "Binstub destination directory (default bin)"
239
+ method_option "standalone", :type => :array, :lazy_default => [], :banner =>
240
+ "Make binstubs that can work without the Bundler runtime"
232
241
  def binstubs(*gems)
233
242
  require "bundler/cli/binstubs"
234
243
  Binstubs.new(options, gems).run
@@ -259,7 +268,7 @@ module Bundler
259
268
 
260
269
  desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
261
270
  method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
262
- method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one"
271
+ method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
263
272
  method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
264
273
  def cache
265
274
  require "bundler/cli/cache"
@@ -268,11 +277,11 @@ module Bundler
268
277
 
269
278
  desc "package [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
270
279
  method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
271
- method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one"
280
+ method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
272
281
  method_option "cache-path", :type => :string, :banner =>
273
282
  "Specify a different cache path than the default (vendor/cache)."
274
283
  method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
275
- method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package."
284
+ method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only the package."
276
285
  method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
277
286
  method_option "path", :type => :string, :banner =>
278
287
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
@@ -359,14 +368,14 @@ module Bundler
359
368
  Viz requires the ruby-graphviz gem (and its dependencies).
360
369
  The associated gems must also be installed via 'bundle install'.
361
370
  D
362
- method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :banner => "The name to use for the generated file. see format option"
363
- method_option :format, :type => :string, :default => "png", :aliases => "-F", :banner => "This is output format option. Supported format is png, jpg, svg, dot ..."
364
- method_option :requirements, :type => :boolean, :default => false, :aliases => "-r", :banner => "Set to show the version of each required dependency."
365
- method_option :version, :type => :boolean, :default => false, :aliases => "-v", :banner => "Set to show each gem version."
366
- method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group."
371
+ method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :desc => "The name to use for the generated file. see format option"
372
+ method_option :format, :type => :string, :default => "png", :aliases => "-F", :desc => "This is output format option. Supported format is png, jpg, svg, dot ..."
373
+ method_option :requirements, :type => :boolean, :default => false, :aliases => "-R", :desc => "Set to show the version of each required dependency."
374
+ method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
375
+ method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
367
376
  def viz
368
377
  require "bundler/cli/viz"
369
- Viz.new(options).run
378
+ Viz.new(options.dup).run
370
379
  end
371
380
 
372
381
  desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem"
@@ -390,7 +399,7 @@ module Bundler
390
399
 
391
400
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
392
401
  method_option "dry-run", :type => :boolean, :default => false, :banner =>
393
- "Only print out changes, do not actually clean gems"
402
+ "Only print out changes, do not clean gems"
394
403
  method_option "force", :type => :boolean, :default => false, :banner =>
395
404
  "Forces clean even if --path is not set"
396
405
  def clean
@@ -423,6 +432,8 @@ module Bundler
423
432
  "the path the lockfile should be written to"
424
433
  method_option "full-index", :type => :boolean, :default => false, :banner =>
425
434
  "Fall back to using the single-file index of all gems"
435
+ method_option "add-platform", :type => :array, :default => [], :banner =>
436
+ "add a new platform to the lockfile"
426
437
  def lock
427
438
  require "bundler/cli/lock"
428
439
  Lock.new(options).run
@@ -433,6 +444,12 @@ module Bundler
433
444
  Env.new.write($stdout)
434
445
  end
435
446
 
447
+ if Bundler.settings[:plugins]
448
+ require "bundler/cli/plugin"
449
+ desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins"
450
+ subcommand "plugin", Plugin
451
+ end
452
+
436
453
  # Reformat the arguments passed to bundle that include a --help flag
437
454
  # into the corresponding `bundle help #{command}` call
438
455
  def self.reformatted_help_args(args)
@@ -29,6 +29,8 @@ module Bundler
29
29
 
30
30
  if spec.name == "bundler"
31
31
  Bundler.ui.warn "Sorry, Bundler can only be run via Rubygems."
32
+ elsif options[:standalone]
33
+ installer.generate_standalone_bundler_executable_stubs(spec)
32
34
  else
33
35
  installer.generate_bundler_executable_stubs(spec, :force => options[:force], :binstubs_cmd => true)
34
36
  end
@@ -25,7 +25,7 @@ module Bundler
25
25
  # First, try to exec directly to something in PATH
26
26
  kernel_exec([bin_path, cmd], *args)
27
27
  else
28
- # Just exec using the given command
28
+ # exec using the given command
29
29
  kernel_exec(cmd, *args)
30
30
  end
31
31
  end
@@ -17,46 +17,18 @@ module Bundler
17
17
  end
18
18
  end
19
19
 
20
- if options[:without] && options[:with]
21
- conflicting_groups = options[:without] & options[:with]
22
- unless conflicting_groups.empty?
23
- Bundler.ui.error "You can't list a group in both, --with and --without." \
24
- "The offending groups are: #{conflicting_groups.join(", ")}."
25
- exit 1
26
- end
27
- end
28
-
29
- Bundler.settings.with = [] if options[:with] && options[:with].empty?
30
- Bundler.settings.without = [] if options[:without] && options[:without].empty?
31
-
32
- with = options.fetch("with", [])
33
- with |= Bundler.settings.with.map(&:to_s)
34
- with -= options[:without] if options[:without]
20
+ check_for_group_conflicts
35
21
 
36
- without = options.fetch("without", [])
37
- without |= Bundler.settings.without.map(&:to_s)
38
- without -= options[:with] if options[:with]
39
-
40
- options[:with] = with
41
- options[:without] = without
22
+ normalize_groups
42
23
 
43
24
  ENV["RB_USER_INSTALL"] = "1" if Bundler::FREEBSD
44
25
 
45
- # Just disable color in deployment mode
26
+ # Disable color in deployment mode
46
27
  Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
47
28
 
48
29
  check_for_options_conflicts
49
30
 
50
- if options["trust-policy"]
51
- unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
52
- Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
53
- "The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
54
- exit 1
55
- end
56
- Bundler.settings["trust-policy"] = options["trust-policy"]
57
- else
58
- Bundler.settings["trust-policy"] = nil if Bundler.settings["trust-policy"]
59
- end
31
+ check_trust_policy
60
32
 
61
33
  if options[:deployment] || options[:frozen]
62
34
  unless Bundler.default_lockfile.exist?
@@ -77,25 +49,15 @@ module Bundler
77
49
  options[:system] = true
78
50
  end
79
51
 
80
- Bundler.settings[:path] = nil if options[:system]
81
- Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
82
- Bundler.settings[:path] = options["path"] if options["path"]
83
- Bundler.settings[:path] ||= "bundle" if options["standalone"]
84
- Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
85
- Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
86
- Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
87
- Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
88
- Bundler.settings[:no_prune] = true if options["no-prune"]
89
- Bundler.settings[:no_install] = true if options["no-install"]
90
- Bundler.settings[:clean] = options["clean"] if options["clean"]
91
- Bundler.settings.without = options[:without]
92
- Bundler.settings.with = options[:with]
52
+ normalize_settings
53
+
93
54
  Bundler::Fetcher.disable_endpoint = options["full-index"]
94
- Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? true : nil
95
55
 
96
56
  # rubygems plugins sometimes hook into the gem install process
97
57
  Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
98
58
 
59
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
60
+
99
61
  definition = Bundler.definition
100
62
  definition.validate_ruby!
101
63
 
@@ -119,16 +81,7 @@ module Bundler
119
81
  end
120
82
  end
121
83
 
122
- Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
123
- Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
124
- Bundler.ui.error "Installed from: #{installed_from_uri}"
125
- Bundler.ui.error "Also found in:"
126
- also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
127
- Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
128
- Bundler.ui.error "For example:"
129
- Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
130
- Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
131
- end
84
+ warn_ambiguous_gems
132
85
 
133
86
  if Bundler.settings[:clean] && Bundler.settings[:path]
134
87
  require "bundler/cli/clean"
@@ -182,6 +135,17 @@ module Bundler
182
135
  Bundler.ui.info msg
183
136
  end
184
137
 
138
+ def check_for_group_conflicts
139
+ if options[:without] && options[:with]
140
+ conflicting_groups = options[:without] & options[:with]
141
+ unless conflicting_groups.empty?
142
+ Bundler.ui.error "You can't list a group in both, --with and --without." \
143
+ "The offending groups are: #{conflicting_groups.join(", ")}."
144
+ exit 1
145
+ end
146
+ end
147
+ end
148
+
185
149
  def check_for_options_conflicts
186
150
  if (options[:path] || options[:deployment]) && options[:system]
187
151
  error_message = String.new
@@ -190,5 +154,72 @@ module Bundler
190
154
  raise InvalidOption.new(error_message)
191
155
  end
192
156
  end
157
+
158
+ def check_trust_policy
159
+ if options["trust-policy"]
160
+ unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
161
+ Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
162
+ "The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
163
+ exit 1
164
+ end
165
+ Bundler.settings["trust-policy"] = options["trust-policy"]
166
+ else
167
+ Bundler.settings["trust-policy"] = nil if Bundler.settings["trust-policy"]
168
+ end
169
+ end
170
+
171
+ def normalize_groups
172
+ Bundler.settings.with = [] if options[:with] && options[:with].empty?
173
+ Bundler.settings.without = [] if options[:without] && options[:without].empty?
174
+
175
+ with = options.fetch("with", [])
176
+ with |= Bundler.settings.with.map(&:to_s)
177
+ with -= options[:without] if options[:without]
178
+
179
+ without = options.fetch("without", [])
180
+ without |= Bundler.settings.without.map(&:to_s)
181
+ without -= options[:with] if options[:with]
182
+
183
+ options[:with] = with
184
+ options[:without] = without
185
+ end
186
+
187
+ def normalize_settings
188
+ Bundler.settings[:path] = nil if options[:system]
189
+ Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
190
+ Bundler.settings[:path] = options["path"] if options["path"]
191
+ Bundler.settings[:path] ||= "bundle" if options["standalone"]
192
+
193
+ Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
194
+ Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
195
+
196
+ Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
197
+
198
+ Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
199
+
200
+ Bundler.settings[:no_prune] = true if options["no-prune"]
201
+
202
+ Bundler.settings[:no_install] = true if options["no-install"]
203
+
204
+ Bundler.settings[:clean] = options["clean"] if options["clean"]
205
+
206
+ Bundler.settings.without = options[:without]
207
+ Bundler.settings.with = options[:with]
208
+
209
+ Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? true : nil
210
+ end
211
+
212
+ def warn_ambiguous_gems
213
+ Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
214
+ Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
215
+ Bundler.ui.error "Installed from: #{installed_from_uri}"
216
+ Bundler.ui.error "Also found in:"
217
+ also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
218
+ Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
219
+ Bundler.ui.error "For example:"
220
+ Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
221
+ Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
222
+ end
223
+ end
193
224
  end
194
225
  end
@@ -26,6 +26,11 @@ module Bundler
26
26
  definition = Bundler.definition(true)
27
27
  end
28
28
 
29
+ options["add-platform"].each do |platform|
30
+ platform = Gem::Platform.new(platform)
31
+ definition.add_platform(platform)
32
+ end
33
+
29
34
  definition.resolve_remotely! unless options[:local]
30
35
 
31
36
  if print
@@ -16,7 +16,9 @@ module Bundler
16
16
  path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
17
17
  Dir.chdir(path) do
18
18
  command = Shellwords.split(editor) + [path]
19
- system(*command) || Bundler.ui.info("Could not run '#{command.join(" ")}'")
19
+ Bundler.with_clean_env do
20
+ system(*command)
21
+ end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
20
22
  end
21
23
  end
22
24
  end
@@ -23,11 +23,11 @@ module Bundler
23
23
  current_dependencies = {}
24
24
  Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } }
25
25
 
26
- if gems.empty? && sources.empty?
26
+ definition = if gems.empty? && sources.empty?
27
27
  # We're doing a full update
28
- definition = Bundler.definition(true)
28
+ Bundler.definition(true)
29
29
  else
30
- definition = Bundler.definition(:gems => gems, :sources => sources)
30
+ Bundler.definition(:gems => gems, :sources => sources)
31
31
  end
32
32
 
33
33
  definition_resolution = proc { options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely! }
@@ -48,13 +48,13 @@ module Bundler
48
48
  dependency = current_dependencies[current_spec.name]
49
49
 
50
50
  if options["strict"]
51
- active_spec = definition.specs.detect {|spec| spec.name == current_spec.name }
51
+ active_spec = definition.specs.detect {|spec| spec.name == current_spec.name && spec.platform == current_spec.platform }
52
52
  else
53
- active_spec = definition.index[current_spec.name].sort_by(&:version)
54
- if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1
55
- active_spec = active_spec.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
53
+ active_specs = definition.index[current_spec.name].select {|spec| spec.platform == current_spec.platform }.sort_by(&:version)
54
+ if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
55
+ active_spec = active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
56
56
  end
57
- active_spec = active_spec.last
57
+ active_spec = active_specs.last
58
58
 
59
59
  if options[:major] || options[:minor] || options[:patch]
60
60
  update_present = update_present_via_semver_portions(current_spec, active_spec, options)