mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Support gem execution with rbenv ruby.
This commit is contained in:
parent
055054e6e3
commit
8cb168f612
@ -16,6 +16,9 @@ def _gem(command, ruby=None, runas=None):
|
||||
if __salt__['rvm.is_installed']():
|
||||
return __salt__['rvm.do'](ruby, cmdline, runas=runas)
|
||||
|
||||
if __salt__['rbenv.is_installed'](runas=runas):
|
||||
return __salt__['rbenv.do'](cmdline, runas=runas)
|
||||
|
||||
ret = __salt__['cmd.run_all'](
|
||||
cmdline,
|
||||
runas=runas
|
||||
|
@ -257,3 +257,27 @@ def list_(runas=None):
|
||||
continue
|
||||
ret.append(line.strip())
|
||||
return ret
|
||||
|
||||
|
||||
def do(cmdline=None, runas=None):
|
||||
'''
|
||||
Execute a ruby command with rbenv's shims from the user or the system.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' rbenv.do "gem list bundler"
|
||||
salt '*' rbenv.do "gem list bundler" deploy
|
||||
'''
|
||||
|
||||
path = _rbenv_path(runas)
|
||||
result = __salt__['cmd.run_all'](
|
||||
"env PATH={0}/shims:$PATH {1}".format(path, cmdline),
|
||||
runas=runas
|
||||
)
|
||||
|
||||
if result['retcode'] == 0:
|
||||
return result['stdout']
|
||||
else:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user