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
ff4e72d3
Commit
ff4e72d3
authored
Jan 28, 2014
by
Drew Stokes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add registry option to npm module
parent
b6875b3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
library/packaging/npm
+14
-1
No files found.
library/packaging/npm
View file @
ff4e72d3
...
...
@@ -55,6 +55,10 @@ options:
- Install dependencies in production mode, excluding devDependencies
required: false
default: no
registry:
description:
- The registry to install modules from.
required: false
state:
description:
- The state of the node.js library
...
...
@@ -76,6 +80,9 @@ description: Install "coffee-script" node.js package globally.
description: Remove the globally package "coffee-script".
- npm: name=coffee-script global=yes state=absent
description: Install "coffee-script" node.js package from custom registry.
- npm: name=coffee-script registry=http://registry.mysite.com
description: Install packages based on package.json.
- npm: path=/app/location
...
...
@@ -100,6 +107,7 @@ class Npm(object):
self
.
name
=
kwargs
[
'name'
]
self
.
version
=
kwargs
[
'version'
]
self
.
path
=
kwargs
[
'path'
]
self
.
registry
=
kwargs
[
'registry'
]
self
.
production
=
kwargs
[
'production'
]
if
kwargs
[
'executable'
]:
...
...
@@ -122,6 +130,9 @@ class Npm(object):
cmd
.
append
(
'--production'
)
if
self
.
name
:
cmd
.
append
(
self
.
name_version
)
if
self
.
registry
:
cmd
.
append
(
'--registry'
)
cmd
.
append
(
self
.
registry
)
#If path is specified, cd into that path and run the command.
if
self
.
path
:
...
...
@@ -178,6 +189,7 @@ def main():
version
=
dict
(
default
=
None
),
production
=
dict
(
default
=
'no'
,
type
=
'bool'
),
executable
=
dict
(
default
=
None
),
registry
=
dict
(
default
=
None
),
state
=
dict
(
default
=
'present'
,
choices
=
[
'present'
,
'absent'
,
'latest'
])
)
arg_spec
[
'global'
]
=
dict
(
default
=
'no'
,
type
=
'bool'
)
...
...
@@ -192,6 +204,7 @@ def main():
glbl
=
module
.
params
[
'global'
]
production
=
module
.
params
[
'production'
]
executable
=
module
.
params
[
'executable'
]
registry
=
module
.
params
[
'registry'
]
state
=
module
.
params
[
'state'
]
if
not
path
and
not
glbl
:
...
...
@@ -200,7 +213,7 @@ def main():
module
.
fail_json
(
msg
=
'uninstalling a package is only available for named packages'
)
npm
=
Npm
(
module
,
name
=
name
,
path
=
path
,
version
=
version
,
glbl
=
glbl
,
production
=
production
,
\
executable
=
executable
)
executable
=
executable
,
registry
=
registry
)
changed
=
False
if
state
==
'present'
:
...
...
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