Class: Babushka::GemHelper

Inherits:
PkgHelper show all
Defined in:
lib/babushka/pkg_helpers/gem_helper.rb

Class Method Summary collapse

Methods inherited from PkgHelper

all_manager_keys, handle_install!, has?, pkg_binary, prefix, present?, update_pkg_lists, update_pkg_lists_if_required

Methods included from ShellHelpers

cmd_dir, current_username, log_shell, login_shell, raw_shell, shell, shell!, shell?, shell_cmd, sudo, which

Methods included from LogHelpers

debug, deprecated!, log, log_block, log_error, log_ok, log_stderr, log_warn, removed!

Class Method Details

.bin_pathObject


21
22
23
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 21

def bin_path
  Babushka.ruby.bin_dir
end

.gem_path_for(gem_name, version = nil) ⇒ Object


15
16
17
18
19
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 15

def gem_path_for gem_name, version = nil
  unless (detected_version = has?(Babushka.VersionOf(gem_name, version), :log => false)).nil?
    Babushka.ruby.gem_dir / Babushka.VersionOf(gem_name, detected_version)
  end
end

.install!(pkgs, opts = nil) ⇒ Object


9
10
11
12
13
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 9

def install! pkgs, opts = nil
  super.tap {
    shell!('rbenv rehash') if Babushka.ruby.rbenv?
  }
end

.manager_depObject


7
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 7

def manager_dep; 'core:rubygems' end

.manager_keyObject


6
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 6

def manager_key; :gem end

.pkg_cmdObject


5
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 5

def pkg_cmd; 'gem' end

.pkg_typeObject


4
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 4

def pkg_type; :gem end

.should_sudo?Boolean

Returns:

  • (Boolean)

25
26
27
# File 'lib/babushka/pkg_helpers/gem_helper.rb', line 25

def should_sudo?
  super || (Babushka.ruby.gem_dir.exists? && !Babushka.ruby.gem_dir.writable_real?)
end