Class: Babushka::BinPkgSrcHelper

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

Class Method Summary (collapse)

Methods inherited from PkgHelper

all_manager_keys, bin_path, cmd_in_path?, cmdline_spec_for, has?, install!, manager_dep, prefix, present?, should_sudo?, update_pkg_lists

Methods included from VersionOf::Helpers

#VersionOf

Methods included from ShellHelpers

#cmd_dir, #failable_shell, #log_shell, #login_shell, #raw_shell, #shell, #shell!, #shell?, #sudo, #which

Methods included from LogHelpers

#debug, #log, #log_block, #log_error, #log_ok, #log_verbose, #log_warn

Class Method Details

+ (Object) _install!(pkgs, opts)



36
37
38
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 36

def _install! pkgs, opts
  log_shell "Installing #{pkgs.join(', ')}", "pkg_radd #{pkgs.join(' ')}", :sudo => should_sudo?
end

+ (Object) existing_packages



4
5
6
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 4

def existing_packages
  shell("pkg_info -a").lines.to_a.map {|i| i.split(/\s+/)[0] }
end

+ (Object) manager_key



14
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 14

def manager_key; :binpkgsrc end

+ (Object) pkg_binary

Note that with pkg_radd it is possible to override the default repository using PKG_PATH environment variable. See man 1 pkg_add.



11
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 11

def pkg_binary; 'pkg_radd' end

+ (Object) pkg_cmd



12
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 12

def pkg_cmd; pkg_binary end

+ (Object) pkg_list_dir



28
29
30
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 28

def pkg_list_dir
  '/usr/pkgsrc/pkg_summary'.p
end

+ (Object) pkg_type



13
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 13

def pkg_type; :pkg end

+ (Object) pkg_update_command



32
33
34
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 32

def pkg_update_command
  "pkg_search -d"
end

+ (Object) pkg_update_timeout



24
25
26
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 24

def pkg_update_timeout
  3600 * 24 * 14 # 2 weeks
end

+ (Object) update_pkg_lists_if_required



16
17
18
19
20
21
22
# File 'lib/babushka/pkg_helpers/binpkgsrc_helper.rb', line 16

def update_pkg_lists_if_required
  if !File.exists? pkg_list_dir
    update_pkg_lists "Looks like pkg summary hasn't been fetched on this system yet. Updating"
  else
    super
  end
end