double_take 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/double_take.rb +7 -3
- data/lib/double_take/hook.rb +22 -9
- data/lib/double_take/version.rb +3 -1
- data/plugins.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9597d31af06477de2ac02b29a24fc6f99bde3ba1cb83ac030f66eef2c608ec30
|
4
|
+
data.tar.gz: 364983fc62bc579cbde20b80d6694f58daf76fe182c1544b8a83ecae28df3068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 251a382afd4ff42b5f28a8e02491feeae5bf6d98793a5a41d5c8f88347a99c74d983dadcd00662022b6324f11ff5032eaf68d0f3ab018a3a4cc9098c3fd240ff
|
7
|
+
data.tar.gz: e95acc20e76bb6dc5f48f287ad767c62582dcf4b68b617014cd5f8a3e1c40034d0e62b1af28cd349ee5869a4682bdb5ffad7f6f14fad5f42b05ceb42edcfec66
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# double_take
|
2
2
|
|
3
|
+
## 0.2.0
|
4
|
+
- Remove registering command and hooks at file loadtime
|
5
|
+
- Create method for loading and registering command and hooks and add to `plugins.rb`
|
6
|
+
- Bundle "next" lockfile on plugin install, removing the need to `bundle` twice
|
7
|
+
|
3
8
|
## 0.1.2
|
4
9
|
- Fix helper method
|
5
10
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,7 @@ And then execute:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
The plugin is installed with
|
23
|
+
The plugin is installed with `bundle install`. It will also install all gems from both `Gemfile.lock` and `Gemfile_next.lock` on the initial `bundle` and every subsequent one as well.
|
24
24
|
|
25
25
|
_NOTE_: This plugin does not generate a `Gemfile_next.lock`, keep both lockfiles in sync over gem bumps, nor does it implement any strategy for bifurcating the `Gemfile` to load different gems. For those reasons, this plugin pairs really well with [`bootboot`](https://github.com/Shopify/bootboot). For more info on dual booting I recommend reading its `README`.
|
26
26
|
|
data/lib/double_take.rb
CHANGED
@@ -18,7 +18,11 @@ module DoubleTake
|
|
18
18
|
ensure
|
19
19
|
ENV.delete("DEPENDENCIES_NEXT")
|
20
20
|
end
|
21
|
-
end
|
22
21
|
|
23
|
-
|
24
|
-
DoubleTake::
|
22
|
+
def self.load
|
23
|
+
DoubleTake::Clean.new.register_command
|
24
|
+
hook = DoubleTake::Hook.new
|
25
|
+
hook.bundle_next unless Bundler::Plugin.installed?("double_take")
|
26
|
+
hook.register
|
27
|
+
end
|
28
|
+
end
|
data/lib/double_take/hook.rb
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module DoubleTake
|
4
4
|
class Hook < Bundler::Plugin::API
|
5
|
+
EMPTY_ARRAY = [].freeze
|
6
|
+
EMPTY_UNLOCK = { gems: EMPTY_ARRAY, sources: EMPTY_ARRAY, ruby: false }.freeze
|
7
|
+
|
5
8
|
def register
|
6
9
|
self.class.hook("before-install-all") do
|
7
10
|
next if !GEMFILE_NEXT_LOCK.file?
|
@@ -15,17 +18,27 @@ module DoubleTake
|
|
15
18
|
current_definition = Bundler.definition
|
16
19
|
unlock = current_definition.instance_variable_get(:@unlock)
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
if current_definition.to_lock == @previous_lockfile
|
22
|
+
bundle_next(unlock)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def bundle_next(unlock = EMPTY_UNLOCK)
|
28
|
+
return if ENV["DEPENDENCIES_NEXT"] || !GEMFILE_NEXT_LOCK.file?
|
21
29
|
|
22
|
-
|
23
|
-
|
30
|
+
# this method memoizes an instance of the current definition
|
31
|
+
# so we need to fill that cache for other bundler internals to use
|
32
|
+
Bundler.definition
|
24
33
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
34
|
+
DoubleTake.with_dependency_next do
|
35
|
+
next_definition = Bundler::Definition
|
36
|
+
.build(GEMFILE, GEMFILE_NEXT_LOCK, unlock)
|
37
|
+
|
38
|
+
Bundler.ui.confirm("Installing bundle for NEXT")
|
39
|
+
|
40
|
+
# TODO: pass options parameter to installer
|
41
|
+
Bundler::Installer.new(Bundler.root, next_definition).run({})
|
29
42
|
end
|
30
43
|
end
|
31
44
|
end
|
data/lib/double_take/version.rb
CHANGED
data/plugins.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: double_take
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Ewing
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|