Updating version added, tweaking instantiation

pull/2542/head
Chris Hoffman 12 years ago
parent 2580adaeaa
commit b25d445324

@ -24,7 +24,7 @@ module: npm
short_description: Manage node.js packages with npm short_description: Manage node.js packages with npm
description: description:
- Manage node.js packages with Node Package Manager (npm) - Manage node.js packages with Node Package Manager (npm)
version_added: 1.1 version_added: 1.2
author: Chris Hoffman author: Chris Hoffman
options: options:
name: name:
@ -90,21 +90,21 @@ except ImportError:
import simplejson as json import simplejson as json
class Npm(object): class Npm(object):
def __init__(self, module, name, path, version, glbl, production, executable): def __init__(self, module, **kwargs):
self.module = module self.module = module
self.glbl = glbl self.glbl = kwargs['glbl']
self.name = name self.name = kwargs['name']
self.version = version self.version = kwargs['version']
self.path = path self.path = kwargs['path']
self.production = production self.production = kwargs['production']
if executable: if kwargs['executable']:
self.executable = executable self.executable = kwargs['executable']
else: else:
self.executable = module.get_bin_path('npm', True) self.executable = module.get_bin_path('npm', True)
if version: if kwargs['version']:
self.name_version = name + '@' + version self.name_version = self.name + '@' + self.version
else: else:
self.name_version = self.name self.name_version = self.name
@ -193,7 +193,8 @@ def main():
if state == 'absent' and not name: if state == 'absent' and not name:
module.fail_json(msg='uninstalling a package is only available for named packages') 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 changed = False
if state == 'present': if state == 'present':

Loading…
Cancel
Save