Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
3722bebb
Commit
3722bebb
authored
Oct 27, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4509 from mremond/gem_executable
Add executable parameter to find gem binary in gem module
parents
3badedc9
007a3fe1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
library/packaging/gem
+17
-5
No files found.
library/packaging/gem
View file @
3722bebb
...
...
@@ -57,6 +57,11 @@ options:
required: false
default: "yes"
version_added: "1.3"
executable:
description:
- Override the path to the gem executable
required: false
version_added: "1.4"
version:
description:
- Version of the gem to be installed/removed.
...
...
@@ -77,8 +82,14 @@ EXAMPLES = '''
import
re
def
get_rubygems_path
(
module
):
if
module
.
params
[
'executable'
]:
return
module
.
params
[
'executable'
]
else
:
return
module
.
get_bin_path
(
'gem'
,
True
)
def
get_rubygems_version
(
module
):
cmd
=
[
module
.
get_bin_path
(
'gem'
,
Tru
e
),
'--version'
]
cmd
=
[
get_rubygems_path
(
modul
e
),
'--version'
]
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
,
check_rc
=
True
)
match
=
re
.
match
(
r'^(\d+)\.(\d+)\.(\d+)'
,
out
)
...
...
@@ -89,7 +100,7 @@ def get_rubygems_version(module):
def
get_installed_versions
(
module
,
remote
=
False
):
cmd
=
[
module
.
get_bin_path
(
'gem'
,
Tru
e
)
]
cmd
=
[
get_rubygems_path
(
modul
e
)
]
cmd
.
append
(
'query'
)
if
remote
:
cmd
.
append
(
'--remote'
)
...
...
@@ -126,7 +137,7 @@ def uninstall(module):
if
module
.
check_mode
:
return
cmd
=
[
module
.
get_bin_path
(
'gem'
,
Tru
e
)
]
cmd
=
[
get_rubygems_path
(
modul
e
)
]
cmd
.
append
(
'uninstall'
)
if
module
.
params
[
'version'
]:
cmd
.
extend
([
'--version'
,
module
.
params
[
'version'
]
])
...
...
@@ -146,7 +157,7 @@ def install(module):
else
:
major
=
None
cmd
=
[
module
.
get_bin_path
(
'gem'
,
Tru
e
)
]
cmd
=
[
get_rubygems_path
(
modul
e
)
]
cmd
.
append
(
'install'
)
if
module
.
params
[
'version'
]:
cmd
.
extend
([
'--version'
,
module
.
params
[
'version'
]
])
...
...
@@ -160,7 +171,7 @@ def install(module):
if
module
.
params
[
'user_install'
]:
cmd
.
append
(
'--user-install'
)
else
:
cmd
.
append
(
'--no-user-install'
)
cmd
.
append
(
'--no-user-install'
)
cmd
.
append
(
'--no-rdoc'
)
cmd
.
append
(
'--no-ri'
)
cmd
.
append
(
module
.
params
[
'gem_source'
])
...
...
@@ -170,6 +181,7 @@ def main():
module
=
AnsibleModule
(
argument_spec
=
dict
(
executable
=
dict
(
required
=
False
,
type
=
'str'
),
gem_source
=
dict
(
required
=
False
,
type
=
'str'
),
include_dependencies
=
dict
(
required
=
False
,
default
=
True
,
type
=
'bool'
),
name
=
dict
(
required
=
True
,
type
=
'str'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment