bundler 1.15.1 → 1.15.2

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6aa71f486e6b4b5d1692c18491fcb29101802c4
4
- data.tar.gz: b2fab0763dac40223188dd8fdfc4d662693d6be3
3
+ metadata.gz: 11b70c8e5ed4f9294f1f27b2c8120a0e6bf3dd57
4
+ data.tar.gz: 726b8467dd3ac471c3077bc81cb37e160cab2da5
5
5
  SHA512:
6
- metadata.gz: b2aaf805b52b9bfef1c380f9ea835d0b7fefb8aa4962b8b5706f24fe23ff4ebbf3eb2b58a51d1dfc8fa228d3ce0b5a8a260b37028b8a9ca58451b3f4615a9d13
7
- data.tar.gz: 36eb16b2c3e86df6010ea8623260c61ac1b82f4333fb69d091839e263aa7e49d1d35bd3fc831c283bb2b732b7405db08fb8668c03fb47ebb9256ae62e1019eaf
6
+ metadata.gz: 8ea76414ad963d6fc48c3b433c775f3d2936d13d35de47db84aa32249ea7566b62538bd0827d4dca2a73a9414277d9b1d5ba0671410751340fb16adde302c889
7
+ data.tar.gz: 0c88dd85d2c24e495541d6b3d4bc34b870bd04945e03ef4645235be292cfc0bfb3b9a50f43cdc1ef34f74021ff12173ac0f1b1ceb23b9a405cc91cdda387b2fd
@@ -1,3 +1,21 @@
1
+ ## 1.15.2 (2017-07-17)
2
+
3
+ Features:
4
+
5
+ - new gemfiles created by bundler will include an explicit `github` git source that uses `https` (@segiddins)
6
+
7
+ Bugfixes:
8
+
9
+ - inline gemfiles work when `BUNDLE_BIN` is set (#5847, @segiddins)
10
+ - avoid using the old dependency API when there are no changes to the compact index files (#5373, @greysteil)
11
+ - fail gracefully when the full index serves gemspecs with invalid dependencies (#5797, @segiddins)
12
+ - support installing gemfiles that use `eval_gemfile`, `:path` gems with relative paths, and `--deployment` simultaneously (@NickLaMuro)
13
+ - `bundle config` will print settings as the type they are interpreted as (@segiddins)
14
+ - respect the `no_proxy` environment variable when making network requests (#5781, @jakauppila)
15
+ - commands invoked with `--verbose` will not have default flags printed (@segiddins)
16
+ - allow `bundle viz` to work when another gem has a requirable `grapviz` file (#5707, @segiddins)
17
+ - ensure bundler puts activated gems on the `$LOAD_PATH` in a consistent order (#5696, @segiddins)
18
+
1
19
  ## 1.15.1 (2017-06-02)
2
20
 
3
21
  Bugfixes:
data/Rakefile CHANGED
@@ -299,13 +299,6 @@ begin
299
299
  lib.vendor_lib = "lib/bundler/vendor/thor"
300
300
  end
301
301
 
302
- Automatiek::RakeTask.new("postit") do |lib|
303
- lib.download = { :github => "https://github.com/bundler/postit" }
304
- lib.namespace = "PostIt"
305
- lib.prefix = "BundlerVendoredPostIt"
306
- lib.vendor_lib = "lib/bundler/vendor/postit"
307
- end
308
-
309
302
  Automatiek::RakeTask.new("net-http-persistent") do |lib|
310
303
  lib.download = { :github => "https://github.com/drbrain/net-http-persistent" }
311
304
  lib.namespace = "Net::HTTP::Persistent"
@@ -326,7 +319,6 @@ rescue LoadError
326
319
  namespace :vendor do
327
320
  task(:molinillo) { abort "Install the automatiek gem to be able to vendor gems." }
328
321
  task(:thor) { abort "Install the automatiek gem to be able to vendor gems." }
329
- task(:postit) { abort "Install the automatiek gem to be able to vendor gems." }
330
322
  task("net-http-persistent") { abort "Install the automatiek gem to be able to vendor gems." }
331
323
  end
332
324
  end
@@ -17,22 +17,22 @@ Welcome to Bundler! We are so happy that you're here. We know it can be daunting
17
17
 
18
18
  You can start learning about Bundler by reading [the documentation](http://bundler.io). If you want, you can also read a (lengthy) explanation of [why Bundler exists and what it does](http://bundler.io/rationale.html).
19
19
 
20
- ##[How you can help: your first contributions!](HOW_YOU_CAN_HELP.md)
20
+ ## [How you can help: your first contributions!](HOW_YOU_CAN_HELP.md)
21
21
 
22
22
  A detailed overview of how to get started contributing to Bundler, including a long list of suggestions for your first project.
23
23
 
24
- ##[Bug triage](BUG_TRIAGE.md)
24
+ ## [Bug triage](BUG_TRIAGE.md)
25
25
 
26
26
  Want to take a stab at processing issues? Start here.
27
27
 
28
- ##[Getting help](GETTING_HELP.md)
28
+ ## [Getting help](GETTING_HELP.md)
29
29
 
30
30
  How to get in touch with folks who can help when you're stuck. Don't worry! This happens to all of us. We're really nice, we promise.
31
31
 
32
- ##[Filing issues](ISSUES.md)
32
+ ## [Filing issues](ISSUES.md)
33
33
 
34
34
  We see a lot of issues in the Bundler repo! Use this guide to file informative, actionable issues.
35
35
 
36
- ##[Community](COMMUNITY.md)
36
+ ## [Community](COMMUNITY.md)
37
37
 
38
38
  Learn more about our goals for the Bundler community and the ways you can help us build better together.
@@ -20,9 +20,7 @@ Bundler doesn't use a Gemfile to list development dependencies, because when we
20
20
 
21
21
  4. Set up a shell alias to run Bundler from your clone, e.g. a Bash alias:
22
22
 
23
- $ alias dbundle='BUNDLE_TRAMPOLINE_DISABLE=1 ruby -I /path/to/bundler/lib /path/to/bundler/exe/bundle'
24
-
25
- The `BUNDLE_TRAMPOLINE_DISABLE` environment variable ensures that the version of Bundler in `/path/to/bundler/lib` will be used. Without that environment setting, Bundler will automatically download, install, and run the version of Bundler listed in `Gemfile.lock`. With that set up, you can test changes you've made to Bundler by running `dbundle`, without interfering with the regular `bundle` command.
23
+ `$ alias dbundle='ruby -I /path/to/bundler/lib /path/to/bundler/exe/bundle'`
26
24
 
27
25
  ## Debugging with `pry`
28
26
 
data/exe/bundle CHANGED
@@ -7,11 +7,6 @@ Signal.trap("INT") do
7
7
  exit 1
8
8
  end
9
9
 
10
- update = "update".start_with?(ARGV.first || " ") && ARGV.find {|a| a.start_with?("--bundler") }
11
- update &&= update =~ /--bundler(?:=(.+))?/ && $1 || "> 0.a"
12
- ENV["BUNDLER_VERSION"] = update if update
13
- require "bundler/postit_trampoline"
14
-
15
10
  require "bundler"
16
11
  # Check if an older version of bundler is installed
17
12
  $LOAD_PATH.each do |path|
@@ -612,12 +612,18 @@ module Bundler
612
612
  end
613
613
 
614
614
  def print_command
615
- return unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] || Bundler.ui.debug?
615
+ return unless Bundler.ui.debug?
616
616
  _, _, config = @_initializer
617
- current_command = config[:current_command].name
618
- return if %w(exec version check platform show help).include?(current_command)
619
- command = ["bundle", current_command] + args
620
- command << Thor::Options.to_switches(options)
617
+ current_command = config[:current_command]
618
+ command_name = current_command.name
619
+ return if %w(exec version check platform show help).include?(command_name)
620
+ command = ["bundle", command_name] + args
621
+ options_to_print = options.dup
622
+ options_to_print.delete_if do |k, v|
623
+ next unless o = current_command.options[k]
624
+ o.default == v
625
+ end
626
+ command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
621
627
  command.reject!(&:empty?)
622
628
  Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
623
629
  end
@@ -13,8 +13,6 @@ module Bundler
13
13
 
14
14
  warn_if_root
15
15
 
16
- warn_if_outdated
17
-
18
16
  [:with, :without].each do |option|
19
17
  if options[option]
20
18
  options[option] = options[option].join(":").tr(" ", ":").split(":")
@@ -116,20 +114,6 @@ module Bundler
116
114
  "application for all non-root users on this machine.", :wrap => true
117
115
  end
118
116
 
119
- def warn_if_outdated
120
- return if ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].nil?
121
- installed_version = Gem::Version.new(ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].dup)
122
- running_version = Gem::Version.new(Bundler::VERSION)
123
- return if Gem::Requirement.new(installed_version).satisfied_by?(running_version)
124
- if Bundler.settings[:warned_version].nil? || running_version > Gem::Version.new(Bundler.settings[:warned_version])
125
- Bundler.settings[:warned_version] = running_version
126
- Bundler.ui.warn "You're running Bundler #{installed_version} but this " \
127
- "project uses #{running_version}. To update, run `bundle update " \
128
- "--bundler`. You won't see this message again unless you upgrade " \
129
- "to a newer version of Bundler.", :wrap => true
130
- end
131
- end
132
-
133
117
  def dependencies_count_for(definition)
134
118
  count = definition.dependencies.count
135
119
  "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
@@ -145,7 +129,7 @@ module Bundler
145
129
  conflicting_groups = options[:without] & options[:with]
146
130
  unless conflicting_groups.empty?
147
131
  Bundler.ui.error "You can't list a group in both, --with and --without." \
148
- "The offending groups are: #{conflicting_groups.join(", ")}."
132
+ " The offending groups are: #{conflicting_groups.join(", ")}."
149
133
  exit 1
150
134
  end
151
135
  end
@@ -7,6 +7,9 @@ module Bundler
7
7
  end
8
8
 
9
9
  def run
10
+ # make sure we get the right `graphviz`. There is also a `graphviz`
11
+ # gem we're not built to support
12
+ gem "ruby-graphviz"
10
13
  require "graphviz"
11
14
 
12
15
  options[:without] = options[:without].join(":").tr(" ", ":").split(":")
@@ -34,7 +34,14 @@ module Bundler
34
34
  if retrying.nil? && local_path.file?
35
35
  FileUtils.cp local_path, local_temp_path
36
36
  headers["If-None-Match"] = etag_for(local_temp_path)
37
- headers["Range"] = "bytes=#{local_temp_path.size}-"
37
+ headers["Range"] =
38
+ if local_temp_path.size.nonzero?
39
+ # Subtract a byte to ensure the range won't be empty.
40
+ # Avoids 416 (Range Not Satisfiable) responses.
41
+ "bytes=#{local_temp_path.size - 1}-"
42
+ else
43
+ "bytes=#{local_temp_path.size}-"
44
+ end
38
45
  else
39
46
  # Fastly ignores Range when Accept-Encoding: gzip is set
40
47
  headers["Accept-Encoding"] = "gzip"
@@ -48,9 +55,12 @@ module Bundler
48
55
  content = Zlib::GzipReader.new(StringIO.new(content)).read
49
56
  end
50
57
 
51
- mode = response.is_a?(Net::HTTPPartialContent) ? "a" : "w"
52
58
  SharedHelpers.filesystem_access(local_temp_path) do
53
- local_temp_path.open(mode) {|f| f << content }
59
+ if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
60
+ local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
61
+ else
62
+ local_temp_path.open("w") {|f| f << content }
63
+ end
54
64
  end
55
65
 
56
66
  response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
@@ -74,6 +84,14 @@ module Bundler
74
84
  sum ? %("#{sum}") : nil
75
85
  end
76
86
 
87
+ def slice_body(body, range)
88
+ if body.respond_to?(:byteslice)
89
+ body.byteslice(range)
90
+ else # pre-1.9.3
91
+ body.unpack("@#{range.first}a#{range.end + 1}").first
92
+ end
93
+ end
94
+
77
95
  def checksum_for_file(path)
78
96
  return nil unless path.file?
79
97
  # This must use IO.read instead of Digest.file().hexdigest
@@ -60,9 +60,11 @@ def gemfile(install = false, options = {}, &gemfile)
60
60
 
61
61
  Bundler.ui = ui if install
62
62
  if install || missing_specs.call
63
- installer = Bundler::Installer.install(Bundler.root, definition, :system => true, :inline => true)
64
- installer.post_install_messages.each do |name, message|
65
- Bundler.ui.info "Post-install message from #{name}:\n#{message}"
63
+ Bundler.settings.temporary(:inline => true) do
64
+ installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
65
+ installer.post_install_messages.each do |name, message|
66
+ Bundler.ui.info "Post-install message from #{name}:\n#{message}"
67
+ end
66
68
  end
67
69
  end
68
70
 
@@ -212,7 +212,7 @@ module Bundler
212
212
  end
213
213
 
214
214
  def resolve_if_need(options)
215
- if !options["update"] && !options[:inline] && !options["force"] && Bundler.default_lockfile.file?
215
+ if !options["update"] && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
216
216
  local = Bundler.ui.silence do
217
217
  begin
218
218
  tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil)
@@ -65,6 +65,7 @@ module Bundler
65
65
  end
66
66
 
67
67
  def generate_executable_stubs
68
+ return if Bundler.settings[:inline]
68
69
  if Bundler.settings[:bin] && standalone
69
70
  installer.generate_standalone_bundler_executable_stubs(spec)
70
71
  elsif Bundler.settings[:bin]
@@ -73,7 +73,15 @@ module Bundler
73
73
  end
74
74
 
75
75
  def dependencies
76
- @dependencies || method_missing(:dependencies)
76
+ @dependencies ||= begin
77
+ deps = method_missing(:dependencies)
78
+
79
+ # allow us to handle when the specs dependencies are an array of array of string
80
+ # see https://github.com/bundler/bundler/issues/5797
81
+ deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) }
82
+
83
+ deps
84
+ end
77
85
  end
78
86
 
79
87
  def git_version
@@ -62,15 +62,7 @@ module Bundler
62
62
  nil
63
63
  end end end end end
64
64
 
65
- if value.nil?
66
- nil
67
- elsif is_bool(name) || value == "false"
68
- to_bool(value)
69
- elsif is_num(name)
70
- value.to_i
71
- else
72
- value
73
- end
65
+ converted_value(value, name)
74
66
  end
75
67
 
76
68
  def []=(key, value)
@@ -160,15 +152,15 @@ module Bundler
160
152
 
161
153
  locations = []
162
154
  if @local_config.key?(key)
163
- locations << "Set for your local app (#{local_config_file}): #{@local_config[key].inspect}"
155
+ locations << "Set for your local app (#{local_config_file}): #{converted_value(@local_config[key], exposed_key).inspect}"
164
156
  end
165
157
 
166
158
  if value = ENV[key]
167
- locations << "Set via #{key}: #{value.inspect}"
159
+ locations << "Set via #{key}: #{converted_value(value, exposed_key).inspect}"
168
160
  end
169
161
 
170
162
  if @global_config.key?(key)
171
- locations << "Set for the current user (#{global_config_file}): #{@global_config[key].inspect}"
163
+ locations << "Set for the current user (#{global_config_file}): #{converted_value(@global_config[key], exposed_key).inspect}"
172
164
  end
173
165
 
174
166
  return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
@@ -281,6 +273,18 @@ module Bundler
281
273
  value
282
274
  end
283
275
 
276
+ def converted_value(value, key)
277
+ if value.nil?
278
+ nil
279
+ elsif is_bool(key) || value == "false"
280
+ to_bool(value)
281
+ elsif is_num(key)
282
+ value.to_i
283
+ else
284
+ value
285
+ end
286
+ end
287
+
284
288
  def global_config_file
285
289
  if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
286
290
  Pathname.new(ENV["BUNDLE_CONFIG"])
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/postit_trampoline"
3
2
  require "bundler/shared_helpers"
4
3
 
5
4
  if Bundler::SharedHelpers.in_bundle?
@@ -20,12 +19,9 @@ if Bundler::SharedHelpers.in_bundle?
20
19
  Bundler.setup
21
20
  end
22
21
 
23
- unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"]
24
- # Add bundler to the load path after disabling system gems
25
- # This is guaranteed to be done already if we've trampolined
26
- bundler_lib = File.expand_path("../..", __FILE__)
27
- $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
28
- end
22
+ # Add bundler to the load path after disabling system gems
23
+ bundler_lib = File.expand_path("../..", __FILE__)
24
+ $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
29
25
 
30
26
  Bundler.ui = nil
31
27
  end
@@ -63,7 +63,7 @@ module Bundler
63
63
 
64
64
  def eql?(other)
65
65
  return unless other.class == self.class
66
- expand(@original_path) == expand(other.original_path) &&
66
+ expanded_original_path == other.expanded_original_path &&
67
67
  version == other.version
68
68
  end
69
69
 
@@ -117,6 +117,10 @@ module Bundler
117
117
  instance_of?(Path)
118
118
  end
119
119
 
120
+ def expanded_original_path
121
+ @expanded_original_path ||= expand(original_path)
122
+ end
123
+
120
124
  private
121
125
 
122
126
  def expanded_path
@@ -160,7 +160,8 @@ module Bundler
160
160
  end
161
161
 
162
162
  def tsort_each_node
163
- @specs.each {|s| yield s }
163
+ # MUST sort by name for backwards compatibility
164
+ @specs.sort_by(&:name).each {|s| yield s }
164
165
  end
165
166
 
166
167
  def spec_for_dependency(dep, match_current_platform)
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  source "https://rubygems.org"
3
3
 
4
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+
4
6
  # gem "rails"
@@ -1,4 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
3
5
  # Specify your gem's dependencies in <%= config[:name] %>.gemspec
4
6
  gemspec
@@ -616,6 +616,8 @@ class Bundler::Persistent::Net::HTTP::Persistent
616
616
  if @proxy_uri and not proxy_bypass? uri.host, uri.port then
617
617
  connection_id << @proxy_connection_id
618
618
  net_http_args.concat @proxy_args
619
+ else
620
+ net_http_args.concat [nil, nil, nil, nil]
619
621
  end
620
622
 
621
623
  connection = connections[connection_id]
@@ -7,7 +7,7 @@ module Bundler
7
7
  # We're doing this because we might write tests that deal
8
8
  # with other versions of bundler and we are unsure how to
9
9
  # handle this better.
10
- VERSION = "1.15.1" unless defined?(::Bundler::VERSION)
10
+ VERSION = "1.15.2" unless defined?(::Bundler::VERSION)
11
11
 
12
12
  def self.overwrite_loaded_gem_version
13
13
  begin
@@ -11,7 +11,7 @@ Generates a directory named `GEM_NAME` with a `Rakefile`, `GEM_NAME.gemspec`,
11
11
  and other supporting files and directories that can be used to develop a
12
12
  rubygem with that name.
13
13
 
14
- Run `rake -T` in the resulting project for a list of Rake tasks that can used
14
+ Run `rake -T` in the resulting project for a list of Rake tasks that can be used
15
15
  to test and publish the gem to rubygems.org.
16
16
 
17
17
  The generated project skeleton can be customized with OPTIONS, as explained
@@ -97,24 +97,6 @@ When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES,
97
97
  Bundler will try to find an executable on your path named `bundler-<command>`
98
98
  and execute it, passing down any extra arguments to it.
99
99
 
100
- ## BUNDLER TRAMPOLINING
101
-
102
- Bundler includes a feature called trampolining, designed to allow a single
103
- developer to work on multiple projects, each on different Bundler versions.
104
- The trampoline will infer the correct version of Bundler to use for each project
105
- and load that version instead of the version directly invoked (which is almost
106
- always the newest version installed locally).
107
-
108
- Bundler by default will use the Bundler version in the current directory to
109
- determine the version to trampoline to, reading from the `BUNDLED WITH` section.
110
- However, if the `BUNDLER_VERSION` environment variable is set, that version will
111
- override the lockfile inference and can be used in directories without a
112
- lockfile.
113
-
114
- Until the target version is Bundler 2 or later, `BUNDLE_TRAMPOLINE_FORCE` must
115
- be set for the trampoline to be used. Additionally, `BUNDLE_TRAMPOLINE_DISABLE` can
116
- be set to completely disable the trampoline.
117
-
118
100
  ## OBSOLETE
119
101
 
120
102
  These commands are obsolete and should no longer be used
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.1
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2017-06-02 00:00:00.000000000 Z
20
+ date: 2017-07-17 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: automatiek
@@ -228,7 +228,6 @@ files:
228
228
  - lib/bundler/plugin/installer/git.rb
229
229
  - lib/bundler/plugin/installer/rubygems.rb
230
230
  - lib/bundler/plugin/source_list.rb
231
- - lib/bundler/postit_trampoline.rb
232
231
  - lib/bundler/psyched_yaml.rb
233
232
  - lib/bundler/remote_specification.rb
234
233
  - lib/bundler/resolver.rb
@@ -311,12 +310,6 @@ files:
311
310
  - lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb
312
311
  - lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
313
312
  - lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb
314
- - lib/bundler/vendor/postit/lib/postit.rb
315
- - lib/bundler/vendor/postit/lib/postit/environment.rb
316
- - lib/bundler/vendor/postit/lib/postit/installer.rb
317
- - lib/bundler/vendor/postit/lib/postit/parser.rb
318
- - lib/bundler/vendor/postit/lib/postit/setup.rb
319
- - lib/bundler/vendor/postit/lib/postit/version.rb
320
313
  - lib/bundler/vendor/thor/lib/thor.rb
321
314
  - lib/bundler/vendor/thor/lib/thor/actions.rb
322
315
  - lib/bundler/vendor/thor/lib/thor/actions/create_file.rb
@@ -454,4 +447,3 @@ signing_key:
454
447
  specification_version: 4
455
448
  summary: The best way to manage your application's dependencies
456
449
  test_files: []
457
- has_rdoc:
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BundlerVendoredPostIt; end
4
- require "bundler/vendor/postit/lib/postit"
5
- require "rubygems"
6
-
7
- environment = BundlerVendoredPostIt::PostIt::Environment.new([])
8
- version = Gem::Requirement.new(environment.bundler_version)
9
- if version.requirements.size == 1 && version.requirements.first.first == "=" # version.exact?
10
- if version.requirements.first.last.segments.first >= 2
11
- ENV["BUNDLE_TRAMPOLINE_FORCE"] = "true"
12
- end
13
- end
14
-
15
- if ENV["BUNDLE_TRAMPOLINE_FORCE"] && !ENV["BUNDLE_TRAMPOLINE_DISABLE"]
16
- installed_version =
17
- if defined?(Bundler::VERSION)
18
- Bundler::VERSION
19
- else
20
- File.read(File.expand_path("../version.rb", __FILE__)) =~ /VERSION = "(.+)"/
21
- $1
22
- end
23
- installed_version &&= Gem::Version.new(installed_version)
24
-
25
- if !version.satisfied_by?(installed_version)
26
- begin
27
- installer = BundlerVendoredPostIt::PostIt::Installer.new(version)
28
- unless installer.installed?
29
- warn "Installing locked Bundler version #{version.to_s.gsub("= ", "")}..."
30
- installer.install!
31
- end
32
- rescue => e
33
- abort <<-EOS.strip
34
- Installing the inferred bundler version (#{version}) failed.
35
- If you'd like to update to the current bundler version (#{installed_version}) in this project, run `bundle update --bundler`.
36
- The error was: #{e}
37
- EOS
38
- end
39
-
40
- if deleted_spec = Gem.loaded_specs.delete("bundler")
41
- deleted_spec.full_require_paths.each {|path| $:.delete(path) }
42
- else
43
- $:.delete(File.expand_path("../..", __FILE__))
44
- end
45
- gem "bundler", version
46
- else
47
- begin
48
- gem "bundler", version
49
- rescue LoadError
50
- $:.unshift(File.expand_path("../..", __FILE__))
51
- end
52
- end
53
-
54
- running_version = begin
55
- require "bundler/version"
56
- Bundler::VERSION
57
- rescue LoadError, NameError
58
- nil
59
- end
60
-
61
- ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] = installed_version.to_s
62
-
63
- if !Gem::Requirement.new(">= 1.13.pre".dup).satisfied_by?(Gem::Version.new(running_version)) && (ARGV.empty? || ARGV.any? {|a| %w(install i).include? a })
64
- puts <<-WARN.strip
65
- You're running Bundler #{installed_version} but this project uses #{running_version}. To update, run `bundle update --bundler`.
66
- WARN
67
- end
68
-
69
- if !Gem::Version.correct?(running_version.to_s) || !version.satisfied_by?(Gem::Version.create(running_version))
70
- abort "The running bundler (#{running_version}) does not match the required `#{version}`"
71
- end
72
-
73
- end # if ENV["BUNDLE_TRAMPOLINE_FORCE"] && !ENV["BUNDLE_TRAMPOLINE_DISABLE"]
@@ -1,15 +0,0 @@
1
- require 'bundler/vendor/postit/lib/postit/environment'
2
- require 'bundler/vendor/postit/lib/postit/installer'
3
- require 'bundler/vendor/postit/lib/postit/parser'
4
- require 'bundler/vendor/postit/lib/postit/version'
5
- require 'rubygems'
6
-
7
- module BundlerVendoredPostIt::PostIt
8
- def self.setup
9
- load File.expand_path('../postit/setup.rb', __FILE__)
10
- end
11
-
12
- def self.bundler_version
13
- defined?(Bundler::VERSION) && Bundler::VERSION
14
- end
15
- end
@@ -1,44 +0,0 @@
1
- require 'bundler/vendor/postit/lib/postit/parser'
2
-
3
- module BundlerVendoredPostIt::PostIt
4
- class Environment
5
- def initialize(argv)
6
- @argv = argv
7
- end
8
-
9
- def env_var_version
10
- ENV['BUNDLER_VERSION']
11
- end
12
-
13
- def cli_arg_version
14
- return unless str = @argv.first
15
- str = str.dup.force_encoding('BINARY') if str.respond_to?(:force_encoding)
16
- if Gem::Version.correct?(str)
17
- @argv.shift
18
- str
19
- end
20
- end
21
-
22
- def gemfile
23
- ENV['BUNDLE_GEMFILE'] || 'Gemfile'
24
- end
25
-
26
- def lockfile
27
- File.expand_path case File.basename(gemfile)
28
- when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
29
- else "#{gemfile}.lock"
30
- end
31
- end
32
-
33
- def lockfile_version
34
- BundlerVendoredPostIt::PostIt::Parser.new(lockfile).parse
35
- end
36
-
37
- def bundler_version
38
- @bundler_version ||= begin
39
- env_var_version || cli_arg_version ||
40
- lockfile_version || "#{Gem::Requirement.default}.a"
41
- end
42
- end
43
- end
44
- end
@@ -1,28 +0,0 @@
1
- module BundlerVendoredPostIt::PostIt
2
- class Installer
3
- def initialize(bundler_version)
4
- @bundler_version = bundler_version
5
- end
6
-
7
- def installed?
8
- if Gem::Specification.respond_to?(:find_by_name)
9
- !Gem::Specification.find_by_name('bundler', @bundler_version).nil?
10
- else
11
- requirement = Gem::Requirement.new(@bundler_version)
12
- Gem.source_index.gems.values.any? do |s|
13
- s.name == 'bundler' && requirement.satisfied_by?(s.version)
14
- end
15
- end
16
- rescue LoadError
17
- false
18
- end
19
-
20
- def install!
21
- return if installed?
22
- require 'rubygems/dependency_installer'
23
- installer = Gem::DependencyInstaller.new
24
- installer.install('bundler', @bundler_version)
25
- installer.installed_gems
26
- end
27
- end
28
- end
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
-
3
- module BundlerVendoredPostIt::PostIt
4
- class Parser
5
- def initialize(file)
6
- @file = file
7
- end
8
-
9
- BUNDLED_WITH =
10
- /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
11
-
12
- def parse
13
- return unless lockfile = File.file?(@file) && File.read(@file)
14
- if lockfile =~ BUNDLED_WITH
15
- Regexp.last_match(1)
16
- else
17
- '< 1.10'
18
- end
19
- end
20
- end
21
- end
@@ -1,12 +0,0 @@
1
- require 'bundler/vendor/postit/lib/postit/environment'
2
- require 'bundler/vendor/postit/lib/postit/installer'
3
-
4
- environment = BundlerVendoredPostIt::PostIt::Environment.new(ARGV)
5
- version = environment.bundler_version
6
-
7
- installer = BundlerVendoredPostIt::PostIt::Installer.new(version)
8
- installer.install!
9
-
10
- gem 'bundler', version
11
-
12
- require 'bundler/version'
@@ -1,3 +0,0 @@
1
- module BundlerVendoredPostIt::PostIt
2
- VERSION = '0.2.0'.freeze
3
- end