bundler-interactive 0.2.0 → 0.2.1
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 +4 -4
- data/.gitignore +3 -0
- data/lib/bundler/interactive/update_interactive.rb +32 -4
- data/lib/bundler/interactive/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dfd73e115e07573a200d343fa615b58145d99c31875eec4dd5e9082d8738b264
|
|
4
|
+
data.tar.gz: fbf663bfb19615ee023946b2adec69079a4d7ba7b2a6d69d94c2391d3cfa8fa6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b5621ad3e3e46be1b93afb3bbdf1f0ce974168cfd340766cee04357a88e3ad75aead8a2d794d535eec6462e4697cc28e7fa0853bc27b206e1f83bbcdc606d67
|
|
7
|
+
data.tar.gz: f051064dc386dfc6ab892f8c6406d56e154892d817c76b46b8f9cb4e3d054cfe81f770a539730260e0cdeb0ebd8f2c4f05e8bf6c1683b7af708609c023774460
|
data/.gitignore
CHANGED
|
@@ -2,12 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
require 'io/console'
|
|
4
4
|
|
|
5
|
+
module Bundler
|
|
6
|
+
module Interactive
|
|
7
|
+
# When bundler-interactive runs as an installed Bundler plugin, its gem
|
|
8
|
+
# dependencies (tty-prompt/tty-reader and their transitive deps) are
|
|
9
|
+
# installed alongside this gem under the plugin root, but Bundler does not
|
|
10
|
+
# add them to the load path -- see the "to support plugin deps" note in
|
|
11
|
+
# Bundler::Plugin#load_plugin. This bridges that gap.
|
|
12
|
+
module PluginDependencies
|
|
13
|
+
# Adds every sibling gem's lib directory to the load path so the plugin's
|
|
14
|
+
# dependency closure can be required. +anchor+ is a directory inside this
|
|
15
|
+
# gem (e.g. __dir__); its ancestor named "gems" is the plugin gem home,
|
|
16
|
+
# whose children are this gem and its installed dependencies. Appends
|
|
17
|
+
# (rather than prepends) so host application gems keep precedence.
|
|
18
|
+
def self.load!(anchor)
|
|
19
|
+
gems_dir = File.expand_path('../../../..', anchor)
|
|
20
|
+
return unless File.basename(gems_dir) == 'gems'
|
|
21
|
+
|
|
22
|
+
Dir[File.join(gems_dir, '*', 'lib')].sort.each do |lib|
|
|
23
|
+
$LOAD_PATH.push(lib) unless $LOAD_PATH.include?(lib)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
5
30
|
begin
|
|
6
31
|
require 'tty-reader'
|
|
7
32
|
rescue LoadError
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
nil
|
|
33
|
+
Bundler::Interactive::PluginDependencies.load!(__dir__)
|
|
34
|
+
require 'tty-reader'
|
|
11
35
|
end
|
|
12
36
|
|
|
13
37
|
module Bundler
|
|
@@ -47,7 +71,11 @@ module Bundler
|
|
|
47
71
|
return Bundler.ui.info('No gems selected.') if chosen.empty?
|
|
48
72
|
|
|
49
73
|
Update.new(chosen).update!
|
|
50
|
-
|
|
74
|
+
# TTY::Reader raises InputInterrupt (a subclass of Interrupt) on Ctrl-C
|
|
75
|
+
# because the reader is created with `interrupt: :error`. Rescue Interrupt
|
|
76
|
+
# directly so exception handling never references the TTY constant, which
|
|
77
|
+
# keeps a clear error if the dependency ever fails to load.
|
|
78
|
+
rescue Interrupt
|
|
51
79
|
show_cursor
|
|
52
80
|
Bundler.ui.info("\nCanceling...")
|
|
53
81
|
end
|