class DoubleTake::Hook
Constants
- EMPTY_ARRAY
- EMPTY_UNLOCK
Public Instance Methods
bundle_next(unlock = EMPTY_UNLOCK, next_lockfile = GEMFILE_NEXT_LOCK)
click to toggle source
# 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()
click to toggle source
# 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