bootboot 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14236a9169a7dea04af00afeb9f53f20cd53e70d969944f12824ba98f76e525a
4
- data.tar.gz: 9a31116c9844389ef5a40e234c15a6cdbfaaf031ed67ceaf47856dd2c3496fa7
3
+ metadata.gz: e9d43952cbfd83694c174233e724fadcd4003f1ddaf8a33b79089782334cb74f
4
+ data.tar.gz: c569400d898e2d7ed519579d595c3ea79e0cc96e13300e3176c28728af49b001
5
5
  SHA512:
6
- metadata.gz: add7b5ca8aa44d3bed18fdcc09b61cf12cc02174a9b2dc947393e22592b0ffa6bea5c4409a8f70564f7d4b501c2233e65a6a292a24c549c915fdd817d46a65f9
7
- data.tar.gz: 1114c2d69483098dab6180f7b7ed9b59aea471386c95be1df06ed38f242a021ee2fcf5a21181ebe6eb35a3b73e5b90cedbec26198d20716d4c1a3ee5b3861b0e
6
+ metadata.gz: 00ed13d606f63cc3eed624aab9dd314b33e9b227716524c2f891ac7089acc6d6ae50e5ba68f7644af94246eaf58da7c373e76dfdc05b603d092685a9450ae746
7
+ data.tar.gz: 99bd2435970d06ea198ca27e53be25d438cb1a633cc2df6a76f551be94b8f5fc893400774b5b98d2497e3843399a708f65665230178afde35bf3f0475b61bc5c
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 👢👢 Bootboot - [![Build Status](https://travis-ci.com/Shopify/bootboot.svg?branch=master)](https://travis-ci.com/Shopify/bootboot)
1
+ ## 👢👢 Bootboot - [![Build Status](https://github.com/Shopify/bootboot/actions/workflows/ci.yml/badge.svg)](https://github.com/Shopify/bootboot/actions/workflows/ci.yml)
2
2
 
3
3
  Introduction
4
4
  ------------
@@ -44,7 +44,7 @@ Installation
44
44
  ------------
45
45
  1) In your Gemfile, add this
46
46
  ```ruby
47
- plugin 'bootboot', '~> 0.1.1'
47
+ plugin 'bootboot', '~> 0.2.1'
48
48
  ```
49
49
  2) Run `bundle install && bundle bootboot`
50
50
  3) You're done. Commit the Gemfile and the Gemfile_next.lock
@@ -16,15 +16,17 @@ end
16
16
 
17
17
  module RubyVersionPatch
18
18
  def system
19
- if ENV["BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE"]
20
- # If we're updating the alternate file and the ruby version specified in
21
- # the Gemfile is different from the Ruby version currently running, we
22
- # want to write the version specified in `Gemfile` for the current
23
- # dependency set to the lock file
24
- Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version || super
25
- else
26
- super
27
- end
19
+ # Only monkey-patch if we're updating the alternate file
20
+ return super unless ENV["BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE"]
21
+
22
+ # Bail out if the Gemfile doesn't specify a Ruby requirement
23
+ requested_ruby = Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version
24
+ return super unless requested_ruby
25
+
26
+ # If the requirement is for an exact Ruby version, we should substitute the
27
+ # system version with the requirement so that it gets written to the lock file
28
+ requirement = Gem::Requirement.new(requested_ruby.versions)
29
+ requirement.exact? ? requested_ruby : super
28
30
  end
29
31
  end
30
32
 
@@ -18,15 +18,30 @@ module Bootboot
18
18
 
19
19
  def specs
20
20
  Bundler::Index.build do |idx|
21
- # If the ruby version specified in the Gemfile is different from the
22
- # Ruby version currently running, we want to build a definition without
23
- # a lockfile (so that `ruby_version` in the Gemfile isn't overridden by
24
- # the lockfile) and get its `ruby_version`. This will be used both
25
- # during dependency resolution so that we can pretend the intended Ruby
26
- # version is present, as well as when updating the lockfile itself.
27
- ruby_version = Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version
28
- ruby_version ||= Bundler::RubyVersion.system
29
- ruby_spec = Gem::Specification.new(ruby_spec_name, ruby_version.gem_version)
21
+ requested_ruby = Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version
22
+ system_version = Bundler::RubyVersion.system.gem_version
23
+ requirement = Gem::Requirement.new(requested_ruby.versions) if requested_ruby
24
+
25
+ # This will be used both during dependency resolution so that we can pretend
26
+ # the intended Ruby version is present, as well as when updating the lock file.
27
+ ruby_spec_version = if requested_ruby.nil?
28
+ # if the Gemfile doesn't request a specific Ruby version, just use system
29
+ system_version
30
+ elsif !requirement.exact? && requirement.satisfied_by?(system_version)
31
+ # if the Gemfile requests a non-exact Ruby version which is satisfied by
32
+ # the currently running Ruby, use that when updating the lock file
33
+ system_version
34
+ else
35
+ # If we're here, there's either an exact requirement for the Ruby version
36
+ # (in which case we should substitue it instead of current Ruby version),
37
+ # else the currently running Ruby doesn't satisfy the non-exact requirement
38
+ # (in which case an error will be thrown by bundler). Not sure how we can
39
+ # improve the error message, which will be vague due to using #gem_version
40
+ # of the unsatisified requirement.
41
+ requested_ruby.gem_version
42
+ end
43
+
44
+ ruby_spec = Gem::Specification.new(ruby_spec_name, ruby_spec_version)
30
45
  ruby_spec.source = self
31
46
  idx << ruby_spec
32
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootboot
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootboot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-21 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.2.20
85
+ rubygems_version: 3.3.3
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Dualbooting your ruby app made easy.