Class: Bundler::SelfManager

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/self_manager.rb

Overview

This class handles installing and switching to the version of bundler needed by an application.

Instance Method Summary collapse

Instance Method Details

#install_locked_bundler_and_restart_with_it_if_neededObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bundler/self_manager.rb', line 16

def install_locked_bundler_and_restart_with_it_if_needed
  restart_version = find_restart_version
  return unless restart_version

  if restart_version == lockfile_version
    Bundler.ui.info \
      "Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
      "Installing Bundler #{lockfile_version} and restarting using that version."
  else
    Bundler.ui.info \
      "Bundler #{current_version} is running, but your configuration was #{restart_version}. " \
      "Installing Bundler #{restart_version} and restarting using that version."
  end

  install_and_restart_with(restart_version)
end

#restart_with_locked_bundler_if_neededObject



9
10
11
12
13
14
# File 'lib/bundler/self_manager.rb', line 9

def restart_with_locked_bundler_if_needed
  restart_version = find_restart_version
  return unless restart_version && installed?(restart_version)

  restart_with(restart_version)
end

#update_bundler_and_restart_with_it_if_needed(target) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bundler/self_manager.rb', line 33

def update_bundler_and_restart_with_it_if_needed(target)
  spec = resolve_update_version_from(target)
  return unless spec

  version = spec.version

  Bundler.ui.info "Updating bundler to #{version}."

  install(spec) unless installed?(version)

  restart_with(version)
end