module Envo::Shell::Bash

Constants

LIST_SEP

Public Instance Methods

ar_to_list(ar) click to toggle source
# File lib/envo/shell/bash.rb, line 50
def ar_to_list(ar)
  ar.join(LIST_SEP)
end
cmd_set_env_var(name, value) click to toggle source
# File lib/envo/shell/bash.rb, line 54
def cmd_set_env_var(name, value)
  escaped = value.to_s.inspect.gsub("'"){ "\\'" }
  "export #{name}=#{escaped}"
end
cmd_unset_env_var(name) click to toggle source
# File lib/envo/shell/bash.rb, line 58
def cmd_unset_env_var(name)
  "unset -v #{name}"
end
fix_path(path) click to toggle source
# File lib/envo/shell/bash.rb, line 23
def fix_path(path)
  path
end
home_var_name() click to toggle source
# File lib/envo/shell/bash.rb, line 13
def home_var_name
  'HOME'
end
installer() click to toggle source
# File lib/envo/shell/bash.rb, line 6
def installer
  Cli::InstallerBash
end
likely_abs_path?(val) click to toggle source
# File lib/envo/shell/bash.rb, line 17
def likely_abs_path?(val)
  !val.empty? && val[0] == '/'
end
likely_list?(val) click to toggle source
# File lib/envo/shell/bash.rb, line 28
def likely_list?(val)
  # we have some work
  # if the value includes our list separtor ":", we need to make sure whether a url:port combination is not a better fit
  return false if !val.include?(LIST_SEP)

  sep_cnt = val.count(LIST_SEP)
  return true if sep_cnt > 2

  # match scheme://url
  return false if val =~ /^\w+\:\/\//

  return true if sep_cnt == 2 # everything else with 2 separators is a list

  # match display type strings address:digit.digit
  return false if val =~ /\:\d.\d$/

  # match something:number to be interpreted as addr:port
  !(val =~ /.*\:\d+$/)
end
likely_rel_path?(val) click to toggle source
# File lib/envo/shell/bash.rb, line 20
def likely_rel_path?(val)
  return !val.empty? && val[0] == '.'
end
list_to_ar(list) click to toggle source
# File lib/envo/shell/bash.rb, line 47
def list_to_ar(list)
  list.split(LIST_SEP)
end
path_var_name() click to toggle source
# File lib/envo/shell/bash.rb, line 10
def path_var_name
  'PATH'
end