def _gem(command, ruby=None, runas=None, gem_bin=None):
 cmdline = ([(gem_bin or 'gem')] + command)
 if (gem_bin is None):
  if __salt__['rvm.is_installed'](runas=runas):
   return __salt__['rvm.do'](ruby, cmdline, runas=runas)
  if ((not salt.utils.is_windows()) and __salt__['rbenv.is_installed'](runas=runas)):
   if (ruby is None):
    return __salt__['rbenv.do'](cmdline, runas=runas)
   else:
    return __salt__['rbenv.do_with_ruby'](ruby, cmdline, runas=runas)
 ret = __salt__['cmd.run_all'](cmdline, runas=runas, python_shell=False)
 if (ret['retcode'] == 0):
  return ret['stdout']
 else:
  raise CommandExecutionError(ret['stderr'])

def _gem ( command , ruby = None , runas = None , gem_bin = None ) : cmdline = ( [ ( gem_bin or 'gem' ) ] + command ) if ( gem_bin is None ) : if __salt__ [ 'rvm.is_installed' ] ( runas = runas ) : return __salt__ [ 'rvm.do' ] ( ruby , cmdline , runas = runas ) if ( ( not salt . utils . is_windows ( ) ) and __salt__ [ 'rbenv.is_installed' ] ( runas = runas ) ) : if ( ruby is None ) : return __salt__ [ 'rbenv.do' ] ( cmdline , runas = runas ) else : return __salt__ [ 'rbenv.do_with_ruby' ] ( ruby , cmdline , runas = runas ) ret = __salt__ [ 'cmd.run_all' ] ( cmdline , runas = runas , python_shell = False ) if ( ret [ 'retcode' ] == 0 ) : return ret [ 'stdout' ] else : raise CommandExecutionError ( ret [ 'stderr' ] )
run the actual gem command .