Class: DoubleTake::Hook
- Inherits:
-
Bundler::Plugin::API
- Object
- Bundler::Plugin::API
- DoubleTake::Hook
- Defined in:
- lib/double_take/hook.rb
Constant Summary collapse
- EMPTY_ARRAY =
[].freeze
- EMPTY_UNLOCK =
{ gems: EMPTY_ARRAY, sources: EMPTY_ARRAY, ruby: false }.freeze
Instance Method Summary collapse
Instance Method Details
#bundle_next(unlock = EMPTY_UNLOCK, next_lockfile = GEMFILE_NEXT_LOCK) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/double_take/hook.rb', line 27 def bundle_next(unlock = EMPTY_UNLOCK, next_lockfile = GEMFILE_NEXT_LOCK) return if ENV["DEPENDENCIES_NEXT"] || !next_lockfile.file? # this method memoizes an instance of the current definition # so we need to fill that cache for other bundler internals to use Bundler.definition DoubleTake.with_dependency_next do next_definition = Bundler::Definition .build(GEMFILE, next_lockfile, unlock) Bundler.ui.confirm("Installing bundle for NEXT") # TODO: pass options parameter to installer Bundler::Installer.new(Bundler.root, next_definition).run({}) end end |
#register ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/double_take/hook.rb', line 8 def register self.class.hook("before-install-all") do next if !GEMFILE_NEXT_LOCK.file? @previous_lockfile = Bundler.default_lockfile.read end self.class.hook("after-install-all") do next if ENV["DEPENDENCIES_NEXT"] || !GEMFILE_NEXT_LOCK.file? current_definition = Bundler.definition unlock = current_definition.instance_variable_get(:@unlock) if current_definition.to_lock == @previous_lockfile bundle_next(unlock) end end end |