From b25d4453243deb6bf8d3100591d3de4b6fd9f0cf Mon Sep 17 00:00:00 2001 From: Chris Hoffman Date: Thu, 4 Apr 2013 14:59:57 -0400 Subject: [PATCH] Updating version added, tweaking instantiation --- library/npm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/library/npm b/library/npm index 620c760ab5..f992b054a1 100644 --- a/library/npm +++ b/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':