class QB::Ansible::Env::Devel

@todo document QB::Ansible::Env class.

Constants

ANSIBLE_HOME

Public Instance Methods

to_h() click to toggle source

@todo Document to_h method.

@param [type] arg_name

@todo Add name param description.

@return [return_type]

@todo Document return value.
Calls superclass method QB::Ansible::Env#to_h
# File lib/qb/ansible/env/devel.rb, line 20
def to_h
  hash = super
  
  hash['ANSIBLE_HOME'] = ANSIBLE_HOME.to_s
  
  hash['PYTHONPATH'] = [
    # (QB::ROOT / 'lib' / 'python'),
    (ANSIBLE_HOME / 'lib'),
    ENV['PYTHONPATH'],
  ].
    compact.
    map( &:to_s ).
    join( ':' )
  
  path = ENV['PATH'].split ':'
  
  path.insert \
    path.find_index { |p| ! p.start_with?( './' ) },
    (ANSIBLE_HOME / 'bin').to_s
  
  hash['PATH'] = path.join ':'
  
  # hash['ANSIBLE_CONNECTION'] = 'local'
  # hash['ANSIBLE_PYTHON_INTERPRETER'] = '/usr/local/bin/python2'
  
  hash
end