bootboot 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/bootboot/bundler_patch.rb +13 -11
- data/lib/bootboot/command.rb +11 -11
- data/lib/bootboot/gemfile_next_auto_sync.rb +7 -7
- data/lib/bootboot/ruby_source.rb +24 -9
- data/lib/bootboot/version.rb +1 -1
- data/lib/bootboot.rb +5 -5
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d43952cbfd83694c174233e724fadcd4003f1ddaf8a33b79089782334cb74f
|
4
|
+
data.tar.gz: c569400d898e2d7ed519579d595c3ea79e0cc96e13300e3176c28728af49b001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00ed13d606f63cc3eed624aab9dd314b33e9b227716524c2f891ac7089acc6d6ae50e5ba68f7644af94246eaf58da7c373e76dfdc05b603d092685a9450ae746
|
7
|
+
data.tar.gz: 99bd2435970d06ea198ca27e53be25d438cb1a633cc2df6a76f551be94b8f5fc893400774b5b98d2497e3843399a708f65665230178afde35bf3f0475b61bc5c
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## 👢👢 Bootboot - [![Build Status](https://
|
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.
|
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
|
@@ -4,7 +4,7 @@ require "bootboot/ruby_source"
|
|
4
4
|
|
5
5
|
module DefinitionPatch
|
6
6
|
def initialize(wrong_lock, *args)
|
7
|
-
lockfile = if ENV[
|
7
|
+
lockfile = if ENV["BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE"]
|
8
8
|
wrong_lock
|
9
9
|
else
|
10
10
|
Bootboot::GEMFILE_NEXT_LOCK
|
@@ -16,15 +16,17 @@ end
|
|
16
16
|
|
17
17
|
module RubyVersionPatch
|
18
18
|
def system
|
19
|
-
if
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
|
@@ -54,7 +56,7 @@ Bundler::Dsl.class_eval do
|
|
54
56
|
Bundler::SharedHelpers.singleton_class.prepend(SharedHelpersPatch)
|
55
57
|
Bundler::Settings.prepend(Module.new do
|
56
58
|
def app_cache_path
|
57
|
-
|
59
|
+
"vendor/cache-next"
|
58
60
|
end
|
59
61
|
end)
|
60
62
|
end
|
data/lib/bootboot/command.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "fileutils"
|
4
4
|
|
5
5
|
module Bootboot
|
6
6
|
class Command < Bundler::Plugin::API
|
7
7
|
def setup
|
8
|
-
self.class.command(
|
8
|
+
self.class.command("bootboot")
|
9
9
|
end
|
10
10
|
|
11
11
|
def exec(_cmd, _args)
|
12
12
|
FileUtils.cp(GEMFILE_LOCK, GEMFILE_NEXT_LOCK)
|
13
13
|
|
14
|
-
File.open(GEMFILE,
|
15
|
-
f.write(
|
16
|
-
Plugin.send(:load_plugin, 'bootboot') if Plugin.installed?('bootboot')
|
14
|
+
File.open(GEMFILE, "a+") do |f|
|
15
|
+
f.write(<<~EOM)
|
16
|
+
Plugin.send(:load_plugin, 'bootboot') if Plugin.installed?('bootboot')
|
17
17
|
|
18
|
-
if ENV['#{Bootboot.env_next}']
|
19
|
-
|
18
|
+
if ENV['#{Bootboot.env_next}']
|
19
|
+
enable_dual_booting if Plugin.installed?('bootboot')
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
EOM
|
21
|
+
# Add any gem you want here, they will be loaded only when running
|
22
|
+
# bundler command prefixed with `#{Bootboot.env_next}=1`.
|
23
|
+
end
|
24
|
+
EOM
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -23,7 +23,7 @@ module Bootboot
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def opt_in
|
26
|
-
self.class.hook(
|
26
|
+
self.class.hook("before-install-all") do
|
27
27
|
@previous_lock = Bundler.default_lockfile.read
|
28
28
|
end
|
29
29
|
|
@@ -31,9 +31,9 @@ module Bootboot
|
|
31
31
|
current_definition = Bundler.definition
|
32
32
|
|
33
33
|
next if !GEMFILE_NEXT_LOCK.exist? ||
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
nothing_changed?(current_definition) ||
|
35
|
+
ENV[Bootboot.env_next] ||
|
36
|
+
ENV[Bootboot.env_previous]
|
37
37
|
|
38
38
|
update!(current_definition)
|
39
39
|
end
|
@@ -48,8 +48,8 @@ module Bootboot
|
|
48
48
|
lock = which_lock
|
49
49
|
|
50
50
|
Bundler.ui.confirm("Updating the #{lock}")
|
51
|
-
ENV[env] =
|
52
|
-
ENV[
|
51
|
+
ENV[env] = "1"
|
52
|
+
ENV["BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE"] = "1"
|
53
53
|
|
54
54
|
unlock = current_definition.instance_variable_get(:@unlock)
|
55
55
|
definition = Bundler::Definition.build(GEMFILE, lock, unlock)
|
@@ -57,7 +57,7 @@ module Bootboot
|
|
57
57
|
definition.lock(lock)
|
58
58
|
ensure
|
59
59
|
ENV.delete(env)
|
60
|
-
ENV.delete(
|
60
|
+
ENV.delete("BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE")
|
61
61
|
end
|
62
62
|
|
63
63
|
def which_env
|
data/lib/bootboot/ruby_source.rb
CHANGED
@@ -18,15 +18,30 @@ module Bootboot
|
|
18
18
|
|
19
19
|
def specs
|
20
20
|
Bundler::Index.build do |idx|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# during dependency resolution so that we can pretend
|
26
|
-
# version is present, as well as when updating the
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
data/lib/bootboot/version.rb
CHANGED
data/lib/bootboot.rb
CHANGED
@@ -8,22 +8,22 @@ module Bootboot
|
|
8
8
|
GEMFILE_LOCK = Pathname("#{GEMFILE}.lock")
|
9
9
|
GEMFILE_NEXT_LOCK = Pathname("#{GEMFILE}_next.lock")
|
10
10
|
|
11
|
-
autoload :GemfileNextAutoSync,
|
12
|
-
autoload :Command,
|
11
|
+
autoload :GemfileNextAutoSync, "bootboot/gemfile_next_auto_sync"
|
12
|
+
autoload :Command, "bootboot/command"
|
13
13
|
|
14
14
|
class << self
|
15
15
|
def env_next
|
16
|
-
env_prefix +
|
16
|
+
env_prefix + "_NEXT"
|
17
17
|
end
|
18
18
|
|
19
19
|
def env_previous
|
20
|
-
env_prefix +
|
20
|
+
env_prefix + "_PREVIOUS"
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def env_prefix
|
26
|
-
Bundler.settings[
|
26
|
+
Bundler.settings["bootboot_env_prefix"] || "DEPENDENCIES"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootboot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
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:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '10.0'
|
41
41
|
description: " This gem remove the overhead of monkeypatching your Gemfile in order
|
42
42
|
to dualboot your app using the Gemfile_next lock strategy It also ensure that dependencies
|
43
43
|
in the Gemfile lock and Gemfile_next lock are in sync whenever someone updates a
|
@@ -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.
|
85
|
+
rubygems_version: 3.3.3
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Dualbooting your ruby app made easy.
|