From 4c954ec417ac50d49b5c06cb8efe5e79bba103d2 Mon Sep 17 00:00:00 2001 From: Tyler Kellen Date: Fri, 29 Aug 2014 16:06:10 -0400 Subject: [PATCH 1/2] add support for --ignore-scripts when using npm --- library/packaging/npm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/packaging/npm b/library/packaging/npm index c5cc7fa510..b489073e91 100644 --- a/library/packaging/npm +++ b/library/packaging/npm @@ -50,6 +50,12 @@ options: - The executable location for npm. - This is useful if you are using a version manager, such as nvm required: false + ignoreScripts: + description: + - Use the --ignore-scripts flag when installing. + required: false + choices: [ "yes", "no" ] + default: no production: description: - Install dependencies in production mode, excluding devDependencies @@ -111,6 +117,7 @@ class Npm(object): self.path = kwargs['path'] self.registry = kwargs['registry'] self.production = kwargs['production'] + self.ignoreScripts = kwargs['ignoreScripts'] if kwargs['executable']: self.executable = kwargs['executable'].split(' ') @@ -130,6 +137,8 @@ class Npm(object): cmd.append('--global') if self.production: cmd.append('--production') + if self.ignoreScripts: + cmd.append('--ignore-scripts') if self.name: cmd.append(self.name_version) if self.registry: From dcc8d7393536100ee7843b4b0d0aac672b53f342 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 2 Sep 2014 12:13:15 -0500 Subject: [PATCH 2/2] Fixing new ignore scripts option logic and name for the npm module --- library/packaging/npm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/packaging/npm b/library/packaging/npm index b489073e91..3bcbde12d9 100644 --- a/library/packaging/npm +++ b/library/packaging/npm @@ -50,12 +50,13 @@ options: - The executable location for npm. - This is useful if you are using a version manager, such as nvm required: false - ignoreScripts: + ignore_scripts: description: - Use the --ignore-scripts flag when installing. required: false choices: [ "yes", "no" ] default: no + version_added: "1.8" production: description: - Install dependencies in production mode, excluding devDependencies @@ -117,7 +118,7 @@ class Npm(object): self.path = kwargs['path'] self.registry = kwargs['registry'] self.production = kwargs['production'] - self.ignoreScripts = kwargs['ignoreScripts'] + self.ignore_scripts = kwargs['ignore_scripts'] if kwargs['executable']: self.executable = kwargs['executable'].split(' ') @@ -137,7 +138,7 @@ class Npm(object): cmd.append('--global') if self.production: cmd.append('--production') - if self.ignoreScripts: + if self.ignore_scripts: cmd.append('--ignore-scripts') if self.name: cmd.append(self.name_version) @@ -226,6 +227,7 @@ def main(): executable = module.params['executable'] registry = module.params['registry'] state = module.params['state'] + ignore_scripts = module.params['ignore_scripts'] if not path and not glbl: module.fail_json(msg='path must be specified when not using global') @@ -233,7 +235,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, registry=registry) + executable=executable, registry=registry, ignore_scripts=ignore_scripts) changed = False if state == 'present':