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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6209ba5bd75ad342ff569bcbc4a134c55b290f1e31b6073e2d8d1e9a8378ace0
4
- data.tar.gz: 5065c826088d8c4123c69876d233767c136a7c24a75807d6b1fba8fd78599edc
3
+ metadata.gz: dfd73e115e07573a200d343fa615b58145d99c31875eec4dd5e9082d8738b264
4
+ data.tar.gz: fbf663bfb19615ee023946b2adec69079a4d7ba7b2a6d69d94c2391d3cfa8fa6
5
5
  SHA512:
6
- metadata.gz: 1d18e351b8b0293f2737718e053b26d7eda3f72a76e888ddbb5761cf92d3127db4bcdb02d0b4601733f28efd1da5d04e6552c5f74f972ad6808ce0d2c03db486
7
- data.tar.gz: dcb27e24c6b779ddc9d0a3eceecc6d1e5cb1ae759d7768068a53c1894183531134227a1c1d841c98aa4f3594c97c8eaff85ea393ccdc703228982f3a480ca5a0
6
+ metadata.gz: 5b5621ad3e3e46be1b93afb3bbdf1f0ce974168cfd340766cee04357a88e3ad75aead8a2d794d535eec6462e4697cc28e7fa0853bc27b206e1f83bbcdc606d67
7
+ data.tar.gz: f051064dc386dfc6ab892f8c6406d56e154892d817c76b46b8f9cb4e3d054cfe81f770a539730260e0cdeb0ebd8f2c4f05e8bf6c1683b7af708609c023774460
data/.gitignore CHANGED
@@ -11,3 +11,6 @@ Gemfile.lock
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+
15
+ *.pem
16
+ bundler-interactive*.gem
@@ -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
- # tty-reader (shipped with tty-prompt) probably wasn't loaded when we tried to
9
- # install the plugin. For now, this is fine.
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
- rescue TTY::Reader::InputInterrupt
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bundler
4
4
  module Interactive
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-interactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes Rich