mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Updating version added, tweaking instantiation
This commit is contained in:
parent
2580adaeaa
commit
b25d445324
1 changed files with 13 additions and 12 deletions
25
library/npm
25
library/npm
|
@ -24,7 +24,7 @@ module: npm
|
|||
short_description: Manage node.js packages with npm
|
||||
description:
|
||||
- Manage node.js packages with Node Package Manager (npm)
|
||||
version_added: 1.1
|
||||
version_added: 1.2
|
||||
author: Chris Hoffman
|
||||
options:
|
||||
name:
|
||||
|
@ -90,21 +90,21 @@ except ImportError:
|
|||
import simplejson as json
|
||||
|
||||
class Npm(object):
|
||||
def __init__(self, module, name, path, version, glbl, production, executable):
|
||||
def __init__(self, module, **kwargs):
|
||||
self.module = module
|
||||
self.glbl = glbl
|
||||
self.name = name
|
||||
self.version = version
|
||||
self.path = path
|
||||
self.production = production
|
||||
self.glbl = kwargs['glbl']
|
||||
self.name = kwargs['name']
|
||||
self.version = kwargs['version']
|
||||
self.path = kwargs['path']
|
||||
self.production = kwargs['production']
|
||||
|
||||
if executable:
|
||||
self.executable = executable
|
||||
if kwargs['executable']:
|
||||
self.executable = kwargs['executable']
|
||||
else:
|
||||
self.executable = module.get_bin_path('npm', True)
|
||||
|
||||
if version:
|
||||
self.name_version = name + '@' + version
|
||||
if kwargs['version']:
|
||||
self.name_version = self.name + '@' + self.version
|
||||
else:
|
||||
self.name_version = self.name
|
||||
|
||||
|
@ -193,7 +193,8 @@ def main():
|
|||
if state == 'absent' and not name:
|
||||
module.fail_json(msg='uninstalling a package is only available for named packages')
|
||||
|
||||
npm = Npm(module, name, path, version, glbl, production, executable)
|
||||
npm = Npm(module, name=name, path=path, version=version, glbl=glbl, production=production, \
|
||||
executable=executable)
|
||||
|
||||
changed = False
|
||||
if state == 'present':
|
||||
|
|
Loading…
Reference in a new issue